Search completed in 1.48 seconds.
3552 results for "line":
Your results are loading. Please wait...
Online and offline events - Web APIs
Some browsers implement Online/Offline events from the WHATWG Web Applications 1.0 specification. Overview In order to build a good offline-capable web application, you need to know when your application is actually offline. You also need to know when your application has returned to an 'online' status again. Effectively, the requirements break down as such: You need to know when the user comes back online, so that you can re-synchronize with the server. You need to know when the user is offline, so that you can queue your server requests for a later time. It is this process that online/offline events help to simplify. API navigator.onLine navigator.onLine is a property that maintains a true/false value (true for online, false for offline). This property is updated whenever ...
... Additionally, this property should update whenever a browser is no longer capable of connecting to the network. ...
... Additionally, this property should update whenever a browser is no longer capable of connecting to the network. According to the specification: The navigator.onLine attribute must return false if the user agent will not contact the network when the user follows links or when a script requests a remote page (or knows that such an attempt would fail)... ...
...And 13 more matches
OfflineAudioContext.OfflineAudioContext() - Web APIs
Either way, the individual parameters are the same. numberOfChannels An integer specifying the number of channels the resulting AudioBuffer should have. ...
...Either way, the individual parameters are the same. numberOfChannels An integer specifying the number of channels the resulting AudioBuffer should have. ...
...Either way, the individual parameters are the same. numberOfChannels An integer specifying the number of channels the resulting AudioBuffer should have. ...
...And 7 more matches
::first-line (:first-line) - CSS: Cascading Style Sheets
The ::first-line CSS pseudo-element applies styles to the first line of a block-level element. Note that the length of the first line depends on many factors, including the width of the element, the width of the document, and the font size of the text. /* Selects the first line of a <p> */ p::first-line { color: red; } CSS3 introduced the ::first-line notation (with two colons) to distinguish pseudo-classes from pseudo-elements. Browsers also accept :first-line, introduced in CSS2. ...
...he element, the width of the document, and the font size of the text. /* Selects the first line of a <p> */ p::first-line { color: red; } CSS3 introduced the ::first-line notation (with two colons) to distinguish pseudo-classes from pseudo-elements. Browsers also accept :first-line, introduced in CSS2. ...
... font-language-override, font-weight, font-size, font-size-adjust, font-stretch, and font-family All background-related properties: background-color, background-clip, background-image, background-origin, background-position, background-repeat, background-size, background-attachment, and background-blend-mode The color property word-spacing, letter-spacing, text-decoration, text-transform, and line-height text-shadow, text-decoration, text-decoration-color, text-decoration-line, text-decoration-style, and vertical-align. Syntax /* CSS3 syntax */ ::first-line /* CSS2 syntax */ :first-line Examples HTML <p>Styles will only be applied to the first line of this paragraph. After that, all text will be styled like normal. See what I mean?</p> <span>The first line of this text will not re...
...And 3 more matches
DocumentTimeline.DocumentTimeline() - Web APIs
The DocumentTimeline() constructor of the Web Animations API creates a new instance of the DocumentTimeline object associated with the active document of the current browsing context. Syntax var sharedTimeline = new DocumentTimeline(options); Parameters options An object specifying options for the new timeline. Currently the only supported option is the originTime member which specifies the zero time for the documentTimeline as a real number of milliseconds relative to the navigationStart moment of the active document for the current browsing context. Examples We could share a single documentTimeline among multiple animations, thus allowing us to manipulate just that group of animations via their shared timeline. This bit of code would start all the cats animating 500 millisecon...
...ve to the navigationStart moment of the active document for the current browsing context. Examples We could share a single documentTimeline among multiple animations, thus allowing us to manipulate just that group of animations via their shared timeline. ...
...rent browsing context. Examples We could share a single documentTimeline among multiple animations, thus allowing us to manipulate just that group of animations via their shared timeline. This bit of code would start all the cats animating 500 milliseconds into their animations: var cats = document.querySelectorAll('.sharedTimelineCat'); cats = Array.prototype.slice.call(cats); var sharedTimeline = new DocumentTimeline({ originTime: 500 }); cats.forEach(function(cat) { var catKeyframes = new KeyframeEffect(cat, keyframes, timing); var catAnimation = new Animation(catKeyframes, sharedTimeline); catAnimation.play(); }); Specifications Specification Status Comment Web AnimationsThe definition of 'DocumentTimeline()' in that specification. Working Draft ...
LinearAccelerationSensor.LinearAccelerationSensor() - Web APIs
The LinearAccelerationSensor constructor creates a new LinearAccelerationSensor object which provides on each reading the acceleration applied to the device along all three axes, but without the contribution of gravity. If a feature policy blocks use of a feature, it is because your code is inconsistent with the policies set on your server. This is not something that would ever be shown to a user. See Feature-Policy for implementation instructions. Syntax var linearAccelerationSensor = new LinearAccelerationSensor([options]) Parameters options Optional Options are as follows: frequency: The desired number of times per second a sample should be taken, meaning the number of times per second that sensor.onreading will be called. A whole number or decimal may be used, the latter for f...
... frequencies less than a second. The actual reading frequency depends on device hardware and consequently may be less than requested. referenceFrame: Either 'device' or 'screen'. The default is 'device'. Specifications Specification Status Comment Generic Sensor API Candidate Recommendation Defines sensors in general. AccelerometerThe definition of 'LinearAccelerationSensor' in that specification. Candidate Recommendation ...
OfflineAudioCompletionEvent.OfflineAudioCompletionEvent() - Web APIs
The OfflineAudioCompletionEvent() constructor of the Web Audio API creates a new OfflineAudioCompletionEvent object instance. Note: You wouldn't generally use the constructor manually. OfflineAudioCompletionEvents are despatched to OfflineAudioContext instances for legacy reasons. Syntax var offlineAudioCompletionEvent = new OfflineAudioCompletionEvent(type, init) Parameters type Optional A DOMString representing the type of object to create. init Optional Options are as follows: renderedBuffer: The rendered AudioBuffer containing the audio data. Return value A new OfflineAudioCompletionEvent object instance. Specifications Specification Status Comment Web Audio APIThe definition of 'OfflineAudioCompletionEvent()' in that specification. Work...
...nition. Browser Compatibility The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
Command line crash course - Learn web development
Previous Overview: Understanding client-side tools Next In your development process you'll undoubtedly be required to run some command in the terminal (or on the "command line" -- these are effectively the same thing). This article provides an introduction to the terminal, the essential commands you'll need to enter into it, how to chain commands together, and how to add your own command line interface (CLI) tools. Prerequisites: Familiarity with the core HTML, CSS, and JavaScript languages. Objective: To understand what the terminal/command line is, what basic commands you should learn, and how to install new command line tools. Welcome to the terminal The terminal is a text interface for executing text-based programs. If you're running any tooling f...
... JavaScript languages. Objective: To understand what the terminal/command line is, what basic commands you should learn, and how to install new command line tools. Welcome to the terminal The terminal is a text interface for executing text-based programs. If you're running any tooling for web development there's a near-guaranteed chance that you'll have to pop open the command line and run some commands to use your chosen tools (you'll often see such tools referred to as CLI tools -- command line interface tools). ...
...erminal is a text interface for executing text-based programs. If you're running any tooling for web development there's a near-guaranteed chance that you'll have to pop open the command line and run some commands to use your chosen tools (you'll often see such tools referred to as CLI tools -- command line interface tools). A large number of tools can be used by typing commands into the command line; many come pre-installed on your system, and a huge number of others are installable from package registries. Package registries are like app stores, but (mostly) for command line based tools and software. ...
...And 23 more matches
Linear-gradient Generator - CSS: Cascading Style Sheets
linear-gradient generator HTML Content <div id="container"> <div id="gradient-container" data-alpha="true"> </div> <div id="controls"> <div class="section"> <div class="title"> Active point </div> <div class="property"> <div class="ui-input-slider" data-topic="point-position" data-info="position" data-unit="px" data-min="-1000" data-value="0" data-max="1000" data-sensivity="5"></div> <div id="delete-point" class="button"> delete point </div> </div> <div class="ui-color-picker" data-topic="picker"></div> </div> <div class="section"> <div class="title"> Active axis </div> ...
... <div class="property"> <div class="name"> axis unit </div> <div class="ui-dropdown" data-topic="axis-unit" data-selected="1"> <div data-value='px'> pixels (px) </div> <div data-value='%'> percentage (%) </div> </div> <div id="delete-axis" class="button"> delete line </div> </div> <div class="property"> <div class="ui-slider" data-topic="axis-rotation" data-info="rotation" data-min="-180" data-value="0" data-max="180"></div> </div> </div> <div id="tool-section" class="section"> <div class="title"> Tool settings </div> ...
...0" data-value="0" data-max="180"></div> </div> </div> <div id="tool-section" class="section"> <div class="title"> Tool settings </div> <div class="property"> <div class="name"> alpha background </div> <div id="canvas-bg"></div> <div id="add-axis" class="button"> add line </div> </div> <div id="order"> <div id="gradient-axes"></div> <div id="gradient-order"></div> </div> </div> </div> <div id="output"> <div class="css-property"> <span class="property">background:</span> <span class="value"></span> ...
...And 21 more matches
text-decoration-line - CSS: Cascading Style Sheets
The text-decoration-line CSS property sets the kind of decoration that is used on text in an element, such as an underline or overline. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. When setting multiple line-decoration properties at once, it may be more convenient to use the text-decoration shorthand property instead. ...
... for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. When setting multiple line-decoration properties at once, it may be more convenient to use the text-decoration shorthand property instead. ...
...e is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. When setting multiple line-decoration properties at once, it may be more convenient to use the text-decoration shorthand property instead. ...
...And 19 more matches
dominant-baseline - SVG: Scalable Vector Graphics
The dominant-baseline attribute specifies the dominant baseline, which is the baseline used to align the box's text and inline-level contents. It also indicates the default alignment baseline of any boxes participating in baseline alignment in the box's alignment context. It is used to determine or re-determine a scaled-baseline-table. A scaled-baseline-table is a compound value with three components: a baseline-identifier for the dominant-baseline, a baseline-table, and a baseline-table font-size. Some values of the property re-determine all three values. Others only re-establish the baseline-table font-size. When the initial value, auto, would give an undesired result, this property can be used to explicitly set the desired scaled-baseline-table. ...
... three components: a baseline-identifier for the dominant-baseline, a baseline-table, and a baseline-table font-size. Some values of the property re-determine all three values. Others only re-establish the baseline-table font-size. When the initial value, auto, would give an undesired result, this property can be used to explicitly set the desired scaled-baseline-table. If there is no baseline table in the nominal font, or if the baseline table lacks an entry for the desired baseline, then the browser may use heuristics to determine the position of the desired baseline. Note: As a presentation attribute, dominant-baseline can be used as a CSS property. See css dominant-baseline for further information. As a presentation attribute, it can be applied to any element but it only has effe...
... any element but it only has effect on the text content elements, including: <altGlyph>, <text>, <textPath>, <tref>, and <tspan> html, body, svg { height: 100%; } text { font: bold 14px Verdana, Helvetica, Arial, sans-serif; } <svg viewBox="0 0 200 120" xmlns="http://www.w3.org/2000/svg"> <path d="M20,20 L180,20 M20,50 L180,50 M20,80 L180,80" stroke="grey" /> <text dominant-baseline="baseline" x="30" y="20">Baseline</text> <text dominant-baseline="middle" x="30" y="50">Middle</text> <text dominant-baseline="hanging" x="30" y="80">Hanging</text> </svg> Usage notes Value auto | text-bottom | alphabetic | ideographic | middle | central | mathematical | hanging | text-top Default value auto Animatable Yes auto If this ...
...And 19 more matches
OfflineAudioContext - Web APIs
The OfflineAudioContext interface is an AudioContext interface representing an audio-processing graph built from linked together AudioNodes. In contrast with a standard AudioContext, an OfflineAudioContext doesn't render the audio to the device hardware; instead, it generates it, as fast as it can, and outputs the result to an AudioBuffer. ...
... The OfflineAudioContext interface is an AudioContext interface representing an audio-processing graph built from linked together AudioNodes. In contrast with a standard AudioContext, an OfflineAudioContext doesn't render the audio to the device hardware; instead, it generates it, as fast as it can, and outputs the result to an AudioBuffer. ...
... In contrast with a standard AudioContext, an OfflineAudioContext doesn't render the audio to the device hardware; instead, it generates it, as fast as it can, and outputs the result to an AudioBuffer. ...
...And 18 more matches
Layout using named grid lines - CSS: Cascading Style Sheets
In previous guides we've looked at placing items by the lines created by defining grid tracks and also how to place items using named template areas. In this guide we are going to look at how these two things work together when we use named lines. Line naming is incredibly useful, but some of the more baffling looking grid syntax comes from this combination of names and track sizes. Once you work through some examples it should become clearer and easier to work with. Naming lines when defining a grid You can assign some or all of the lines in your grid a name when you define your grid with the grid-template-rows and grid-template-columns properties. ...
...yntax comes from this combination of names and track sizes. Once you work through some examples it should become clearer and easier to work with. Naming lines when defining a grid You can assign some or all of the lines in your grid a name when you define your grid with the grid-template-rows and grid-template-columns properties. To demonstrate I'll use the simple layout created in the guide on line-based placement. This time I'll create the grid using named lines. * {box-sizing: border-box;} .wrapper { border: 2px solid #f76707; border-radius: 5px; background-color: #fff4e6; } .wrapper > div { border: 2px solid #ffa94d; border-radius: 5px; background-color: #ffd8a8; padding: 1em; color: #d9480f; } When defining the grid, I name my lines inside square brackets. Those ...
...d-color: #ffd8a8; padding: 1em; color: #d9480f; } When defining the grid, I name my lines inside square brackets. Those names can be anything you like. I have defined a name for the start and end of the container, both for rows and columns. Then defined the centre block of the grid as content-start and content-end again, both for columns and rows although you do not need to name all of the lines on your grid. You might choose to name just some key lines for your layout. .wrapper { display: grid; grid-template-columns: [main-start] 1fr [content-start] 1fr [content-end] 1fr [main-end]; grid-template-rows: [main-start] 100px [content-start] 100px [content-end] 100px [main-end]; } Once the lines have names, we can use the name to place the item rather than the line number. .box1 {...
...And 18 more matches
linear-gradient() - CSS: Cascading Style Sheets
The linear-gradient() CSS function creates an image consisting of a progressive transition between two or more colors along a straight line. Its result is an object of the <gradient> data type, which is a special kind of <image>. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...ne. Its result is an object of the <gradient> data type, which is a special kind of <image>. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...tored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...And 18 more matches
stroke-linejoin - SVG: Scalable Vector Graphics
The stroke-linejoin attribute is a presentation attribute defining the shape to be used at the corners of paths when they are stroked. Note: As a presentation attribute stroke-linejoin can be used as a CSS property. ...
... The stroke-linejoin attribute is a presentation attribute defining the shape to be used at the corners of paths when they are stroked. Note: As a presentation attribute stroke-linejoin can be used as a CSS property. ...
...t but it has effect only on the following nine elements: <altGlyph>, <path>, <polygon>, <polyline>, <rect>, <text>, <textPath>, <tref>, and <tspan> html,body,svg { height:100% } <svg viewBox="0 0 18 12" xmlns="http://www.w3.org/2000/svg"> <!-- Upper left path: Effect of the "miter" value --> <path d="M1,5 a2,2 0,0,0 2,-3 a3,3 0 0 1 2,3.5" stroke="black" fill="none" stroke-linejoin="miter" /> <!-- Center path: Effect of the "round" value --> <path d="M7,5 a2,2 0,0,0 2,-3 a3,3 0 0 1 2,3.5" stroke="black" fill="none" stroke-linejoin="round" /> <!-- Upper right path: Effect of the "bevel" value --> <path d="M13,5 a2,2 0,0,0 2,-3 a3,3 0 0 1 2,3.5" stroke="black" fill="none" stroke-linejoin="bevel" /> <!-- Bottom left path: Eff...
...And 16 more matches
Providing Command-Line Options - Archive of obsolete content
firefox.exe -viewapp url Opens a chrome window for My Application and passes it an nsIURI object. ...
... Extensions and XUL applications can modify the way command line parameters are handled by writing a component that implements the nsICommandLineHandler interface and registering it in a category. See also: XULRunner:CommandLine Overview The code below is an example of writing a JavaScript XPCOM component to handle command line parameters. You can learn more about how the command line is interpreted by looking at the documentation for the nsICommandLine interface. Example The below example component implements two command line parameters: firefox.exe -myapp Opens a chrome window for My Application. ...
...ommand line is interpreted by looking at the documentation for the nsICommandLine interface. Example The below example component implements two command line parameters: firefox.exe -myapp Opens a chrome window for My Application. firefox.exe -viewapp url Opens a chrome window for My Application and passes it an nsIURI object. ...
...And 15 more matches
Line-based placement with CSS Grid - CSS: Cascading Style Sheets
In the article covering the basic concepts of grid layout, we started to look at how to position items on a grid using line numbers. In this article we will fully explore how this fundamental feature of the specification works. Starting your exploration of grid with numbered lines is the most logical place to begin, as when you use grid layout you always have numbered lines. The lines are numbered for columns and rows, and are indexed from 1. Note that grid is indexed according to the writing mode of the document. In a left to right language such as English line 1 is on the left-hand side of the grid. If you are working in a right-to-left language then line 1 will be the far right of the grid. We will learn more about the interaction between writing modes and grids in a later guide. ...
... Inside our grid container I have four child elements. If we do not place these on to the grid in any way they will lay out according to the auto-placement rules, one item in each of the first four cells. If you use the Firefox Grid Highlighter you can see how the grid has defined columns and rows. ...
... .box1 { grid-column-start: 1; grid-column-end: 2; grid-row-start: 1; grid-row-end: 4; } As you posit...
...And 15 more matches
outline-style - CSS: Cascading Style Sheets
The outline-style CSS property sets the style of an element's outline. An outline is a line that is drawn around an element, outside the border. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. It is often more convenient to use the shorthand property outline when defining the appearance of an outline. ...
...element, outside the border. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. It is often more convenient to use the shorthand property outline when defining the appearance of an outline. Syntax /* Keyword values */ outline-style: auto; outline-style: none; outline-style: dotted; outline-style: dashed; outline-style: solid; outline-style: double; outline-style: groove; outline-style: ridge; outline-style: inset; outline-style: outset; /* Global values */ outline-style: inherit; outline-style: initial; outline-style: unset; The outline-style property is specified as any one of the values listed below. Values ...
...ed; outline-style: dashed; outline-style: solid; outline-style: double; outline-style: groove; outline-style: ridge; outline-style: inset; outline-style: outset; /* Global values */ outline-style: inherit; outline-style: initial; outline-style: unset; The outline-style property is specified as any one of the values listed below. Values auto Permits the user agent to render a custom outline style. none No outline is used. The outline-width is 0. dotted The outline is a series of dots. dashed The outline is a series of short line segments. solid The outline is a single line. double The outline is two single lines. The outline-width is the sum of the two lines and the space between them. ...
...And 14 more matches
stroke-linecap - SVG: Scalable Vector Graphics
The stroke-linecap attribute is a presentation attribute defining the shape to be used at the end of open subpaths when they are stroked. Note: As a presentation attribute stroke-linecap can be used as a CSS property. ...
... The stroke-linecap attribute is a presentation attribute defining the shape to be used at the end of open subpaths when they are stroked. Note: As a presentation attribute stroke-linecap can be used as a CSS property. ...
... The stroke-linecap attribute is a presentation attribute defining the shape to be used at the end of open subpaths when they are stroked. Note: As a presentation attribute stroke-linecap can be used as a CSS property. ...
...And 14 more matches
CommandLine - Archive of obsolete content
Handling command line arguments with XULRunner For Multiple Instances Application It's fairly easy to retrieve application specific command line arguments in XULRunner when it's not a single instance application. An nsICommandLine object is passed as the first argument of the launched window: Example var cmdLine = window.arguments[0]; cmdLine = cmdLine.QueryInterface(Components.interfaces.nsICommandLine); alert(cmdLine.handleFlagWithParam("test", false)); See also: Chrome: Command Line For single instance applications Of course, for a single instance application (see toolkit.singletonWindowType for more information), the last example still applies the first time your application is launched. ...
...nterface(Components.interfaces.nsICommandLine); alert(cmdLine.handleFlagWithParam("test", false)); See also: Chrome: Command Line For single instance applications Of course, for a single instance application (see toolkit.singletonWindowType for more information), the last example still applies the first time your application is launched. However, if you'd like to retrieve the latest command line arguments (to open a file for example), a possible solution is to create your own command line handler. For the sake of simplicity, the proposed solution involves the observer service to notify observers that the updated arguments are available. A similar and better way to implement this solution is by defining argument specific handlers with registering and unregistering functions in your comma...
...This has the advantage to accumulate unhandled arguments until a specific handler is added. This approach has been used in Songbird. Example Notice the changes since Gecko 2.0 (Component registration has moved into the manifest file). ...
...And 13 more matches
line-height - CSS: Cascading Style Sheets
The line-height CSS property sets the height of a line box. It's commonly used to set the distance between lines of text. On block-level elements, it specifies the minimum height of line boxes within the element. On non-replaced inline elements, it specifies the height that is used to calculate line box height. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...um height of line boxes within the element. On non-replaced inline elements, it specifies the height that is used to calculate line box height. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
... Values normal Depends on the user agent. ...
...And 13 more matches
outline - CSS: Cascading Style Sheets
Web › CSS › outline
The outline CSS shorthand property set all the outline properties in a single declaration. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Constituent properties This property is a shorthand for the following CSS properties: outline-color outline-style outline-width Syntax /* style */ outline: solid; /* color | style */ outline: #f66 dashed; /* style | width */ outline: inset thick; /* color | style | width */ outline: green solid 3px; /* Global values */ outline: inherit; outline: initial; outline: unset; The outline property may be specified using one, two, or three of the values listed below. The o...
... Syntax /* style */ outline: solid; /* color | style */ outline: #f66 dashed; /* style | width */ outline: inset thick; /* color | style | width */ outline: green solid 3px; /* Global values */ outline: inherit; outline: initial; outline: unset; The outline property may be specified using one, two, or three of the values listed below. The order of the values does not matter. Note: The outline will be invisible for many elements if its style is not defined. This is because the style defaults to none. A notable exception is input elements, which are given default styling by browsers. Values <'outline-color'> Sets the color of the outline. Defaults to currentcolor if absent. See outline-color. <'outline-style'> Sets the style of the outline. Defaults to none if absent. See outlin...
...ble for many elements if its style is not defined. This is because the style defaults to none. A notable exception is input elements, which are given default styling by browsers. Values <'outline-color'> Sets the color of the outline. Defaults to currentcolor if absent. See outline-color. <'outline-style'> Sets the style of the outline. Defaults to none if absent. See outline-style. <'outline-width'> Sets the thickness of the outline. Defaults to medium if absent. See outline-width. Description Borders and outlines are very similar. However, outlines differ from borders in the following ways: Outlines never take up space, as they are drawn outside of an element's content. According to the spec, outlines don't have to be rectangular, although they usually are. As with all sho...
...And 13 more matches
nsICommandLine
switches Flags. In normalized form, these are preceded by a single dash. Some flags may take parameters; for example: "-url <param>" or "-install-xpi <param>". ...
...switches Flags. In normalized form, these are preceded by a single dash. Some flags may take parameters; for example: "-url <param>" or "-install-xpi <param>". ...
...switches Flags. In normalized form, these are preceded by a single dash. Some flags may take parameters; for example: "-url <param>" or "-install-xpi <param>". ...
...And 12 more matches
outline-color - CSS: Cascading Style Sheets
The outline-color CSS property sets the color of an element's outline. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Syntax /* <color> values */ outline-color: #f92525; outline-color: rgb(30,222,121); outline-color: blue; /* Keyword value */ outline-color: invert; /* Global values */ outline-color: inherit; outline-color: initial; outline-color: unset; The outline-color property is specified as any one of the values listed below. Values <color> The color of the outline, specified as a <color>. invert To ensure the outline is visible, performs a color inversion of the background. Note that brow...
...The border, on the other hand, will actually alter the page's layout to ensure that it fits without overlapping anything else (unless you explicitly set it to overlap). ...
...line-color: unset; The outline-color property is specified as any one of the values listed below. Values <color> The color of the outline, specified as a <color>. invert To ensure the outline is visible, performs a color inversion of the background. Note that browsers are not required to support this value; if they don't, this keyword is considered invalid. Description An outline is a line that is drawn around an element, outside the border. Unlike the element's border, the outline is drawn outside the element's frame, and may overlap other content. The border, on the other hand, will actually alter the page's layout to ensure that it fits without overlapping anything else (unless you explicitly set it to overlap). ...
...And 12 more matches
overscroll-behavior-inline - CSS: Cascading Style Sheets
Values auto The default scroll overflow behavior occurs as normal. contain Default scroll overflow behavior is observed inside the element this value is set on (e.g. ...
... Values auto The default scroll overflow behavior occurs as normal. contain Default scroll overflow behavior is observed inside the element this value is set on (e.g. ...
... Values auto The default scroll overflow behavior occurs as normal. contain Default scroll overflow behavior is observed inside the element this value is set on (e.g. ...
...And 12 more matches
Block and Line Layout Cheat Sheet - Archive of obsolete content
nsFrame The base class for all frames. mFlags Flags set on the frame to indicate its state. These flags can be grouped into two categories: flags which affect all frames ("public" flags), and flags that are reserved for an individual frame's private use ("private" flags). ...
... nsFrame The base class for all frames. mFlags Flags set on the frame to indicate its state. These flags can be grouped into two categories: flags which affect all frames ("public" flags), and flags that are reserved for an individual frame's private use ("private" flags). ...
...rames. NS_BLOCK_SPACE_MGR This indicates that a block frame should create its own space manager. This is required by each block frame that can contain floaters: the space manager is used to reserve space for the floated frames. This is set by default for document frames, area frames, table cell inner frames, absolutely positioned wrapper frames, and floated frames when the frame is created. nsLineBox A block consists of lines and other blocks, stacked vertically. A block frame has one nsLineBox for each line, and one nsLineBox for each block child. These are stored as a doubly-linked list in the mLines member of nsBlockFrame. nsInlineFrame mFlags NS_INLINE_FRAME_CONTAINS_PERCENT_AWARE_CHILD This flag is set if the inline frame has any children that have a percentage value set (via ...
...And 11 more matches
repeating-linear-gradient() - CSS: Cascading Style Sheets
The function's result is an object of the <gradient> data type, which is a special kind of <image>. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. The length of the gradient that repeats is the distance between the first and last color stop. If the first color does not have a color-stop-length, the color-stop-length defaults to 0. ...
...e examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. The length of the gradient that repeats is the distance between the first and last color stop. If the first color does not have a color-stop-length, the color-stop-length defaults to 0. With each repetition, the positions of the color stops are shifted by a multiple of the length of the basic linear gradient. Thus, the position of each ending color stop coincides with a starting color stop; if the color values are different, this will result in a sharp visual transition. This can be altered with repeating the first color again as the last color. As with any gradient, a repeating linear gradient has no intrinsic dimensions; i.e., it has no natural or preferred size, nor a preferred ratio. ...
...ith repeating the first color again as the last color. As with any gradient, a repeating linear gradient has no intrinsic dimensions; i.e., it has no natural or preferred size, nor a preferred ratio. Its concrete size will match the size of the element it applies to. Because <gradient>s belong to the <image> data type, they can only be used where <image>s can be used. For this reason, repeating-linear-gradient() won't work on background-color and other properties that use the <color> data type. ...
...And 11 more matches
alignment-baseline - SVG: Scalable Vector Graphics
The alignment-baseline attribute specifies how an object is aligned with respect to its parent. This property specifies which baseline of this element is to be aligned with the corresponding baseline of the parent. For example, this allows alphabetic baselines in Roman text to stay aligned across font size changes. It defaults to the baseline with the same name as the computed value of the alignment-baseline property. Note: As a presentation attribute alignment-baseline can be used as a CSS property. ...
...ges. It defaults to the baseline with the same name as the computed value of the alignment-baseline property. Note: As a presentation attribute alignment-baseline can be used as a CSS property. As a presentation attribute, it can be applied to any element but it has effect only on the following four elements: <tspan>, <tref>, <altGlyph>, and <textPath> Usage notes Value auto | baseline | before-edge | text-before-edge | middle | central | after-edge | text-after-edge | ideographic | alphabetic | hanging | mathematical | top | center | bottom Default value auto Animatable Yes auto The value is the dominant-baseline of the script to which the character belongs - i.e., use the dominant-baseline of the parent. ...
... text-bottom Matches the bottom of the box to the top of the parent's content area. ...
...And 11 more matches
Block and inline layout in normal flow - CSS: Cascading Style Sheets
In this guide, we will explore the basics of how Block and Inline elements behave when they are part of the normal flow. Normal Flow is defined in the CSS 2.1 specification, which explains that any boxes in normal flow will be part of a formatting context. They can be either block or inline, but not both at once. We describe block-level boxes as participating in a block formatting context, and inline-level boxes as participating in an inline formatting context. The behaviour of elements which have a block or inline formatting context is also defined in this specification. For elements with a block formatting context, the spec says: "In a block formatting context, boxes are laid out one after the other, vertically, beginning at the top of a containing block. The vertical distance between t...
...op of a containing block. The vertical distance between two sibling boxes is determined by the 'margin' properties. Vertical margins between adjacent block-level boxes in a block formatting context collapse. In a block formatting context, each box's left outer edge touches the left edge of the containing block (for right-to-left formatting, right edges touch)." - 9.4.1 For elements with an inline formatting context: "In an inline formatting context, boxes are laid out horizontally, one after the other, beginning at the top of a containing block. Horizontal margins, borders, and padding are respected between these boxes. The boxes may be aligned vertically in different ways: their bottoms or tops may be aligned, or the baselines of text within them may be aligned. The rectangular area th...
...ne formatting context, boxes are laid out horizontally, one after the other, beginning at the top of a containing block. Horizontal margins, borders, and padding are respected between these boxes. The boxes may be aligned vertically in different ways: their bottoms or tops may be aligned, or the baselines of text within them may be aligned. The rectangular area that contains the boxes that form a line is called a line box." - 9.4.2 Note that the CSS 2.1 specification describes documents as being in a horizontal, top to bottom writing mode. For example, by describing vertical distance between block boxes. The behavior on block and inline elements is the same when working in a vertical writing mode, and we will explore this in a future guide on Flow Layout and Writing Modes. Elements particip...
...And 10 more matches
Command line options
Syntax rules But first, let's describe the syntax rules that apply for all options. Command parameters containing spaces must be enclosed in quotes, such as "Joel User". Command actions are case insensitive. Command parameters, except profile names, are case insensitive. ...
... Syntax rules But first, let's describe the syntax rules that apply for all options. Command parameters containing spaces must be enclosed in quotes, such as "Joel User". Command actions are case insensitive. ...
... this page or also in Thunderbird 52 and newer: body=c:\path\to\file.txt Separate multiple message options by comma (,), for example: "to=foo@nowhere.net,subject=cool page" . Comma separators must not follow or precede spaces ( ). To assign multiple values to a field, enclose the values in single quotes ('), for example: "to='foo@nowhere.net,foo@foo.de',subject=cool page" . Using command line options Command line options follow the command to start the application. If the option contains arguments, enter the argument after the option. Some options have abbreviations, for example, "-editor" can be abbreviated as "-edit" (available abbreviations are described in the text below). In some cases, option arguments must be enclosed in quotation marks (this is noted in the option description...
...And 9 more matches
SVG Guidelines
can be faster to send vector information from an SVG to a user's GPU than it is to extract raster data from an equivalent raster image. And even when an SVG image is slower than a raster equivalent, the difference is usually not noticable. However, just don't fall into the trap of thinking that SVGs are faster than eqivalent raster images, or vice versa. Once again, "it depends". Authoring guidelines A lot of SVG files (particularly those generated by SVG editors) ship without being cleaned up and can contain a ton of junk that bloats the file size and slows down rendering. In general the best way to combat this is to first run SVG files through a linter such as svgo (see the Tools section below). However, when authoring SVGs by hand here are some best practices to help keep them lightweigh...
...at bloats the file size and slows down rendering. In general the best way to combat this is to first run SVG files through a linter such as svgo (see the Tools section below). However, when authoring SVGs by hand here are some best practices to help keep them lightweight. These rules are based on some real examples seen in Mozilla's code. ...
...un SVG files through a linter such as svgo (see the Tools section below). However, when authoring SVGs by hand here are some best practices to help keep them lightweight. These rules are based on some real examples seen in Mozilla's code. ...
...And 9 more matches
nsICommandLineHandler
toolkit/components/commandlines/public/nsICommandLineHandler.idlScriptable Handles arguments on the command line of a XUL application. 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) Each command line handler is registered in the category "command-line-handler". The entries in this category are read in alphabetical order, and each category value is treated as a service contract ID implementing this interface. By convention, handlers with ordinary priority should begin with "m". ...
... / SeaMonkey 1.0) Each command line handler is registered in the category "command-line-handler". The entries in this category are read in alphabetical order, and each category value is treated as a service contract ID implementing this interface. By convention, handlers with ordinary priority should begin with "m". ...
...ne-handler". The entries in this category are read in alphabetical order, and each category value is treated as a service contract ID implementing this interface. By convention, handlers with ordinary priority should begin with "m". ...
...And 9 more matches
CanvasRenderingContext2D.lineCap - Web APIs
The CanvasRenderingContext2D.lineCap property of the Canvas 2D API determines the shape used to draw the end points of lines. Note: Lines can be drawn with the stroke(), strokeRect(), and strokeText() methods. Syntax ctx.lineCap = "butt" || "round" || "square"; Options "butt" The ends of lines are squared off at the endpoints. Default value. "round" The ends of lines are rounded. "square" The ends of lines are squared off by adding a box with an equal width and half the height of the line's thickness. Examples Changing the shape of line caps This example rounds the end caps of a straight line. HTML <canvas id="canvas"></canvas> JavaScript const canvas = document.getElementById('canvas'); const ctx = canvas.getContext('2d'); ctx.beginPath(); ctx.moveTo(20, 20); ctx.lin...
...ines are squared off by adding a box with an equal width and half the height of the line's thickness. Examples Changing the shape of line caps This example rounds the end caps of a straight line. HTML <canvas id="canvas"></canvas> JavaScript const canvas = document.getElementById('canvas'); const ctx = canvas.getContext('2d'); ctx.beginPath(); ctx.moveTo(20, 20); ctx.lineWidth = 15; ctx.lineCap = 'round'; ctx.lineTo(100, 100); ctx.stroke(); Result Comparison of line caps In this example three lines are drawn, each with a different value for the lineCap property. Two guides to see the exact differences between the three are added. Each of these lines starts and ends exactly on these guides. The line on the left uses the default "butt" option. It's drawn completely flush with th...
...ch with a different value for the lineCap property. Two guides to see the exact differences between the three are added. Each of these lines starts and ends exactly on these guides. The line on the left uses the default "butt" option. It's drawn completely flush with the guides. The second is set to use the "round" option. This adds a semicircle to the end that has a radius half the width of the line. The line on the right uses the "square" option. This adds a box with an equal width and half the height of the line thickness. ...
...And 9 more matches
OfflineAudioContext.startRendering() - Web APIs
The startRendering() method of the OfflineAudioContext Interface starts rendering the audio graph, taking into account the current connections and the current scheduled changes. The complete event (of type OfflineAudioCompletionEvent) is raised when the rendering is finished, containing the resulting AudioBuffer in its renderedBuffer property. Browsers currently support two versions of the startRendering() method -- an older event-based version and a newer promise-based version. The former will eventually be removed, but currently both mechanisms are provided for legacy reasons. ...
...etionEvent) is raised when the rendering is finished, containing the resulting AudioBuffer in its renderedBuffer property. Browsers currently support two versions of the startRendering() method -- an older event-based version and a newer promise-based version. The former will eventually be removed, but currently both mechanisms are provided for legacy reasons. Syntax Event-based version: offlineAudioCtx.startRendering(); offlineAudioCtx.oncomplete = function(e) { // e.renderedBuffer contains the output buffer } Promise-based version: offlineAudioCtx.startRendering().then(function(buffer) { // buffer contains the output buffer }); Parameters None. Returns Void. Example In this simple example, we declare both an AudioContext and an OfflineAudioContext object. We use the AudioC...
...redBuffer contains the output buffer } Promise-based version: offlineAudioCtx.startRendering().then(function(buffer) { // buffer contains the output buffer }); Parameters None. Returns Void. Example In this simple example, we declare both an AudioContext and an OfflineAudioContext object. We use the AudioContext to load an audio track via XHR (AudioContext.decodeAudioData), then the OfflineAudioContext to render the audio into an AudioBufferSourceNode and play the track through. After the offline audio graph is set up, you need to render it to an AudioBuffer using OfflineAudioContext.startRendering. When the startRendering() promise resolves, rendering has completed and the output AudioBuffer is returned out of the promise. At this point we create another audio context, create an ...
...And 9 more matches
-moz-outline-radius - CSS: Cascading Style Sheets
In Mozilla applications like Firefox, the -moz-outline-radius CSS shorthand property can be used to give an element's outline rounded corners. /* One value */ -moz-outline-radius: 25px; /* Two values */ -moz-outline-radius: 25px 1em; /* Three values */ -moz-outline-radius: 25px 1em 12%; /* Four values */ -moz-outline-radius: 25px 1em 12% 4mm; /* Global values */ -moz-outline-radius: inherit; -moz-outline-radius: initial; -moz-outline-radius: unset; Constituent properties This property is a shorthand for the following CSS properties: -moz-outline-radius-bottomleft -moz-outline-radius-bottomright -moz-outline-radius-topleft -moz-outline-radius-topright Syntax Values Elliptical outlines and <percentage> values follow the syntax described in border-radius. One, two, t...
... <percentage> A <percentage>; see border-radius for details. If a single value is set, it applies to all 4 corners. If two values are set, the first one applies to the top-left and bottom-right corners and the second one to the top-right and bottom-left corners. ...
...p-Left corner, the second one to the top-right and bottom-left corners and the third one to the bottom-right corner. If four values are set, the first one applies to the top-left corner, the second one to the top-right corner, the third one to the bottom-right corner and the fourth one to the bottom-left corner. ...
...And 9 more matches
AudioParam.linearRampToValueAtTime() - Web APIs
endTime A double representing the exact time (in seconds) after the ramping starts that the changing of the value will stop. Returns A reference to this AudioParam object. In some browsers older implementations of this interface return void. ...
... endTime A double representing the exact time (in seconds) after the ramping starts that the changing of the value will stop. Returns A reference to this AudioParam object. In some browsers older implementations of this interface return void. ...
... the exact time (in seconds) after the ramping starts that the changing of the value will stop. Returns A reference to this AudioParam object. In some browsers older implementations of this interface return void. Example In this example, we have a media source with two control buttons (see the audio-param repo for the source code, or view the example live.) When these buttons are pressed, linearRampToValueAtTime() is used to fade the gain value up to 1.0, and down to 0, respectively. This is pretty useful for fade in/fade out effects, although AudioParam.exponentialRampToValueAtTime() is often said to be a bit more natural. // create audio context var AudioContext = window.AudioContext || window.webkitAudioContext; var audioCtx = new AudioContext(); // set basic variables for example...
...And 8 more matches
CanvasRenderingContext2D.lineJoin - Web APIs
The default is "miter". ...
...The default is "miter". ...
...ingContext2D.lineJoin property of the Canvas 2D API determines the shape used to join two line segments where they meet. This property has no effect wherever two connected segments have the same direction, because no joining area will be added in this case. Degenerate segments with a length of zero (i.e., with all endpoints and control points at the exact same position) are also ignored. Note: Lines can be drawn with the stroke(), strokeRect(), and strokeText() methods. Syntax ctx.lineJoin = "bevel" || "round" || "miter"; Options There are three possible values for this property: "round", "bevel", and "miter". The default is "miter". "round" Rounds off the corners of a shape by filling an additional sector of disc centered at the common endpoint of connected segments. The radius...
...And 8 more matches
SVGPolylineElement - Web APIs
The SVGPolylineElement interface provides access to the properties of <polyline> elements, as well as methods to manipulate them. ...
... The SVGPolylineElement interface provides access to the properties of <polyline> elements, as well as methods to manipulate them. ...
... The SVGPolylineElement interface provides access to the properties of <polyline> elements, as well as methods to manipulate them. ...
...And 8 more matches
scroll-margin-inline - CSS: Cascading Style Sheets
Description The scroll-margin values represent outsets defining the scroll snap area that is used for snapping this box to the snapport. ...
... Description The scroll-margin values represent outsets defining the scroll snap area that is used for snapping this box to the snapport. ...
... Description The scroll-margin values represent outsets defining the scroll snap area that is used for snapping this box to the snapport. ...
...And 8 more matches
<u>: The Unarticulated Annotation (Underline) element - HTML: Hypertext Markup Language
Web › HTML › Element › u
The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
... The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
... The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...And 8 more matches
CanvasRenderingContext2D.setLineDash() - Web APIs
If the number of elements in the array is odd, the elements of the array get copied and concatenated. For example, [5, 15, 25] will become [5, 15, 25, 5, 15, 25]. If the array is empty, the line dash list is cleared and line strokes return to being solid. Return value undefined. ...
... The setLineDash() method of the Canvas 2D API's CanvasRenderingContext2D interface sets the line dash pattern used when stroking lines. It uses an array of values that specify alternating lengths of lines and gaps which describe the pattern. Note: To return to using solid lines, set the line dash list to an empty array. Syntax ctx.setLineDash(segments); Parameters segments An Array of numbers that specify distances to alternately draw a line and a gap (in coordinate space units). If the number of elements in the array is odd, the elements of the array get copied and concatenated. For example, [5, 15, 25] will become [5, 15, 25, 5, 15, 25]. If the array is empty, the line dash list is cleared and line strokes return to being solid. Return value undefined. Examples Basic example...
...to alternately draw a line and a gap (in coordinate space units). If the number of elements in the array is odd, the elements of the array get copied and concatenated. For example, [5, 15, 25] will become [5, 15, 25, 5, 15, 25]. If the array is empty, the line dash list is cleared and line strokes return to being solid. Return value undefined. ...
...And 7 more matches
Checking when a deadline is due - Web APIs
In this article we look at a complex example involving checking the current time and date against a deadline stored via IndexedDB. The main complication here is checking the stored deadline info (month, hour, day, etc.) against the current time and date taken from a Date object. The main example application we will be referring to in this article is To-do list notifications, a simple to-do list application that stores task titles and deadline times and dates via IndexedDB, and then provides users with notifications when deadline dates are reached, via the Notification, and Vibration APIs. You can download the To-do list notifications app from github and play around with the source code, or view the app running live. The basic problem In the to-do app, we wanted to first record t...
...w the app running live. The basic problem In the to-do app, we wanted to first record time and date information in a format that is both machine readable and human understandable when displayed, and then check whether each time and date is occurring at the current moment. Basically, we want to check what the time and date is right now, and then check each stored event to see if any of their deadlines match the current time and date. If they do, we want to let the user know with some kind of notification. This would be easy if we were just comparing two Date objects, but of course humans don't want to enter deadline information in the same format JavaScript understands. Human-readable dates are quite different, with a number of different representations. Recording the date information To p...
...e dates are quite different, with a number of different representations. Recording the date information To provide a reasonable user experience on mobile devices, and to cut down on ambiguities, I decided to create an HTML form with: A text input for entering a title for your to-do list. This is the least avoidable bit of user typing. Number inputs for the hour and minute parts of the deadline. On browsers that support type="number", you get a nice little up and down arrow number picker. On mobile platforms you tend to get a numeric keypad for entering data, which is helpful. On others you just get a standard text input, which is okay. <select> elements for inputting the day, month and year of the deadline. Because these values are the most ambiguous for users to enter (7, sunday, sun...
...And 7 more matches
SVGLineElement - Web APIs
The SVGLineElement interface provides access to the properties of <line> elements, as well as methods to manipulate them. <div id="interfaceDiagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 23.333333333333332%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 140" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25"...
...ink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">Node</text></a><polyline points="226,25 236,20 ...
...E4"/><a xlink:href="/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">Node</text></a><polyline points="226,25 236,20 236,30 226,25" stroke="#D4DDE4" fill="none"/><line x1="236" y1="25" x2="266" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Element" target="_top"><rect x="266" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="303.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">Element</text></a><polyline points="341,25 3...
...And 7 more matches
box-lines - CSS: Cascading Style Sheets
Web › CSS › box-lines
This is a property of the original CSS Flexible Box Layout Module draft, and has been replaced by a newer standard. See flexbox for information about the current standard. The box-lines CSS property determines whether the box may have a single or multiple lines (rows for horizontally oriented boxes, columns for vertically oriented boxes). /* Keyword values */ box-lines: single; box-lines: multiple; /* Global values */ box-lines: inherit; box-lines: initial; box-lines: unset; By default a horizontal box will lay out its children in a single row, and a vertical box will lay out its children in a single column. This behavior can be changed using the box-lines property. The default value is single, which means that all elements will be placed in a single row or column, and any el...
...a single row, and a vertical box will lay out its children in a single column. This behavior can be changed using the box-lines property. The default value is single, which means that all elements will be placed in a single row or column, and any elements that don't fit will simply be considered overflow. If a value of multiple is specified, however, then the box is allowed to expand to multiple lines (that is, multiple rows or columns) in order to accommodate all of its children. The box must attempt to fit its children on as few lines as possible by shrinking all elements down to their minimum widths or heights if necessary. ...
...d overflow. If a value of multiple is specified, however, then the box is allowed to expand to multiple lines (that is, multiple rows or columns) in order to accommodate all of its children. The box must attempt to fit its children on as few lines as possible by shrinking all elements down to their minimum widths or heights if necessary. If the children in a horizontal box still do not fit on a line after being reduced to their minimum widths, then children are moved one by one onto a new line, until the elements remaining on the previous line fit. This process can repeat to an arbitrary number of lines. ...
...And 7 more matches
text-underline-position - CSS: Cascading Style Sheets
The text-underline-position CSS property specifies the position of the underline which is set using the text-decoration property's underline value. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...ine-position CSS property specifies the position of the underline which is set using the text-decoration property's underline value. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...fies the position of the underline which is set using the text-decoration property's underline value. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...And 7 more matches
<linearGradient> - SVG: Scalable Vector Graphics
The <linearGradient> element lets authors define linear gradients that can be applied to fill or stroke of graphical elements. Don't be confused with CSS linear-gradient() as CSS gradients can only apply to HTML elements where SVG gradient can only apply to SVG elements. ...
... authors define linear gradients that can be applied to fill or stroke of graphical elements. Don't be confused with CSS linear-gradient() as CSS gradients can only apply to HTML elements where SVG gradient can only apply to SVG elements. ...
...n only apply to HTML elements where SVG gradient can only apply to SVG elements. ...
...And 7 more matches
Grid Lines - MDN Web Docs Glossary: Definitions of Web-related terms
Grid lines are created when you define tracks in the explicit grid using CSS Grid Layout. In the following example there is a grid with three column tracks and two row tracks. This gives us 4 column lines and 3 row lines. * {box-sizing: border-box;} .wrapper { border: 2px solid #f76707; border-radius: 5px; background-color: #fff4e6; display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 100px); } .wrapper > div { border: 2px solid #ffa94d; border-radius: 5px; background-color: #ffd8a8; padding: 1em; color: #d9480f; } <div class="wrapper"> <div>One</div> <div>Two</div> <div>Three</div> <div>Four</div> <div>Five</div> </div> .wrapper { display: grid; grid-template-columns: repeat(3, 1...
...The image below shows the line numbers of the grid, assuming the language is left-to-right...
... Lines are also created in the...
...And 6 more matches
border-inline-end - CSS: Cascading Style Sheets
The border-inline-end CSS property is a shorthand property for setting the individual logical inline-end border property values in a single place in the style sheet. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Constituent properties This property is a shorthand for the following CSS properties: border-inline-end-color border-inline-end-style border-inline-end-width Syntax border-inline-end: 1px; border-inline-end: 2px dashed; border-inline-end: medium dashed blue; The physical border to which border-inline-end maps depends on the element's writing mode, directionality, and text orientation. It corresp...
...nd: medium dashed blue; The physical border to which border-inline-end maps depends on the element's writing mode, directionality, and text orientation. It corresponds to the border-top, border-right, border-bottom, or border-left property depending on the values defined for writing-mode, direction, and text-orientation. Related properties are border-block-start, border-block-end, and border-inline-start, which define the other borders of the element. Initial valueas each of the properties of the shorthand:border-width: as each of the properties of the shorthand:border-top-width: mediumborder-right-width: mediumborder-bottom-width: mediumborder-left-width: mediumborder-style: as each of the properties of the shorthand:border-top-style: noneborder-right-style: noneborder-bottom-style: noneb...
...See border-s...
...And 6 more matches
line-break - CSS: Cascading Style Sheets
The line-break CSS property sets how to break lines of Chinese, Japanese, or Korean (CJK) text when working with punctuation and symbols. /* Keyword values */ line-break: auto; line-break: loose; line-break: normal; line-break: strict; line-break: anywhere; /* Global values */ line-break: inherit; line-break: initial; line-break: unset; Syntax Values auto Break text using the default line break rule. loose Break text using the least restrictive line break rule. Typically used for short lines, such as in newspapers. normal Break text using the most common line break rule. strict Break text using the most stringent line break rule. anywhere There is a soft wrap opportunity around every typographic character unit, including around any punctuation character or preserved white s...
...The different wrapping opportunities must not be prioritized. Hyphenation is not applied. ...
... Working Draft Initial definition ...
...And 6 more matches
margin-inline - CSS: Cascading Style Sheets
The margin-inline CSS shorthand property is a shorthand property that defines both the logical inline start and end margins of an element, which maps to physical margins depending on the element's writing mode, directionality, and text orientation. ...
... The margin-inline CSS shorthand property is a shorthand property that defines both the logical inline start and end margins of an element, which maps to physical margins depending on the element's writing mode, directionality, and text orientation. ...
... The margin-inline CSS shorthand property is a shorthand property that defines both the logical inline start and end margins of an element, which maps to physical margins depending on the element's writing mode, directionality, and text orientation. ...
...And 6 more matches
Inline elements - HTML: Hypertext Markup Language
HTML (Hypertext Markup Language) elements historically were categorized as either "block-level" elements or "inline-level" elements. Since this is a presentational characteristic it is nowadays specified by CSS in the Flow Layout. Inline elements are those which only occupy the space bounded by the tags defining the element, instead of breaking the flow of the content. In this article, we'll examine HTML inline-level elements and how they differ from block-level elements. An inline element does not start on a new line and only takes up as much width as necessary. Inline vs. ...
...nt. In this article, we'll examine HTML inline-level elements and how they differ from block-level elements. An inline element does not start on a new line and only takes up as much width as necessary. Inline vs. block-level elements: a demonstration This is most easily demonstrated with a simple example. First, some simple CSS that we'll be using: .highlight { background-color:#ee3; } Inline Let's look at the following example which demonstrates an inline element: <div>The following span is an <span class="highlight">inline element</span>; its background has been colored to display both the beginning and end of the inline element's influence.</div> In this example, the <div> block-level element contains some text. Within that text is a <span> element, which is an inline element. B...
...xample which demonstrates an inline element: <div>The following span is an <span class="highlight">inline element</span>; its background has been colored to display both the beginning and end of the inline element's influence.</div> In this example, the <div> block-level element contains some text. Within that text is a <span> element, which is an inline element. ...
...And 6 more matches
<polyline> - SVG: Scalable Vector Graphics
Web › SVG › Element › polyline
The <polyline> SVG element is an SVG basic shape that creates straight lines connecting several points. Typically a polyline is used to create open shapes as the last point doesn't have to be connected to the first point. For closed shapes see the <polygon> element. ...
... The <polyline> SVG element is an SVG basic shape that creates straight lines connecting several points. Typically a polyline is used to create open shapes as the last point doesn't have to be connected to the first point. For closed shapes see the <polygon> element. ...
...is an SVG basic shape that creates straight lines connecting several points. Typically a polyline is used to create open shapes as the last point doesn't have to be connected to the first point. For closed shapes see the <polygon> element. ...
...And 6 more matches
nsICommandLineRunner
Read only. Methods init() Called with the argc/argv combination passed to main. ...
...Read only. ...
...Read only. ...
...And 5 more matches
SVGLinearGradientElement - Web APIs
The SVGLinearGradientElement interface corresponds to the <linearGradient> element. <div id="interfaceDiagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 23.333333333333332%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 140" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x...
...5 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">Node</text></a><polyline points="226,25 236,20 236,30 226,25" stroke="#D4DDE4" fill="none"/><line x1="236" y1="25" x2="266" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Element" target="_top"><rect x="266" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="303.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace"...
...236,20 236,30 226,25" stroke="#D4DDE4" fill="none"/><line x1="236" y1="25" x2="266" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Element" target="_top"><rect x="266" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="303.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">Element</text></a><polyline points="341,25 351,20 351,30 341,25" stroke="#D4DDE4" fill="none"/><line x1="351" y1="25" x2="381" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/SVGElement" target="_top"><rect x="381" y="1" width="100" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="431" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monos...
...And 5 more matches
border-inline - CSS: Cascading Style Sheets
It corresponds to the border-top and border-bottom or border-right, and border-left properties, depending on the values defined for writing-mode, direction, and text-orientation. The borders in the other dimension can be set with border-block, which sets border-block-start, and border-block-end. ...
...See border-style. <'color'> The color of the border. See color. Formal definition Initial valueas each of the properties of the shortha...
...See border-style. <'color'> The color of the border. See color. Formal definition Initial valueas each of the properties of the shorthand:border-top-width: ...
...And 5 more matches
inset-inline - CSS: Cascading Style Sheets
The inset-inline CSS property defines the logical start and end offsets of an element in the inline direction, which maps to physical offsets depending on the element's writing mode, directionality, and text orientation. It corresponds to the top and bottom, or right and left properties depending on the values defined for writing-mode, direction, and text-orientation. ...
...e inset-inline CSS property defines the logical start and end offsets of an element in the inline direction, which maps to physical offsets depending on the element's writing mode, directionality, and text orientation. It corresponds to the top and bottom, or right and left properties depending on the values defined for writing-mode, direction, and text-orientation. ...
...rty defines the logical start and end offsets of an element in the inline direction, which maps to physical offsets depending on the element's writing mode, directionality, and text orientation. It corresponds to the top and bottom, or right and left properties depending on the values defined for writing-mode, direction, and text-orientation. ...
...And 5 more matches
margin-inline-end - CSS: Cascading Style Sheets
The margin-inline-end CSS property defines the logical inline end margin of an element, which maps to a physical margin depending on the element's writing mode, directionality, and text orientation. In other words, it corresponds to the margin-top, margin-right, margin-bottom or margin-left property depending on the values defined for writing-mode, direction, and text-orientation. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...rgin-right, margin-bottom or margin-left property depending on the values defined for writing-mode, direction, and text-orientation. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...pending on the values defined for writing-mode, direction, and text-orientation. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...And 5 more matches
min-inline-size - CSS: Cascading Style Sheets
The min-inline-size CSS property defines the horizontal or vertical minimal size of an element's block, depending on its writing mode. It corresponds to either the min-width or the min-height property, depending on the value of writing-mode. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...pending on its writing mode. It corresponds to either the min-width or the min-height property, depending on the value of writing-mode. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...ode. It corresponds to either the min-width or the min-height property, depending on the value of writing-mode. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...And 5 more matches
padding-inline - CSS: Cascading Style Sheets
The padding-inline CSS shorthand property defines the logical inline start and end padding of an element, which maps to physical padding properties depending on the element's writing mode, directionality, and text orientation. ...
... The padding-inline CSS shorthand property defines the logical inline start and end padding of an element, which maps to physical padding properties depending on the element's writing mode, directionality, and text orientation. ...
... The padding-inline CSS shorthand property defines the logical inline start and end padding of an element, which maps to physical padding properties depending on the element's writing mode, directionality, and text orientation. ...
...And 5 more matches
Making PWAs work offline with Service workers - Progressive web apps (PWAs)
Previous Overview: Progressive web apps Next Now that we've seen what the structure of js13kPWA looks like and have seen the basic shell up and running, let's look at how the offline capabilities using Service Worker are implemented. In this article, we look at how it is used in our js13kPWA example (see the source code also). We examine how to add offline functionality. Service workers explained Service Workers are a virtual proxy between the browser and the network. They finally fix issues that front-end developers have struggled with for years -- most notably how to properly cache the assets of a website and make them available when the user's device is offline. They run on a separate thread from the main JavaScript code of our page, and don't have any access to the DOM ...
...e, and don't have any access to the DOM structure. This introduces a different approach from traditional web programming -- the API is non-blocking, and can send and receive communication between different contexts. You are able to give a Service Worker something to work on, and receive the result whenever it is ready using a Promise-based approach. They can do a lot more than "just" offering offline capabilities, including handling notifications, performing heavy calculations on a separate thread, etc. Service workers are quite powerful as they can take control over network requests, modify them, serve custom responses retrieved from the cache, or synthesize responses completely. Security Because they are so powerful, Service Workers can only be executed in secure contexts (meaning HTTPS).
... control over network requests, modify them, serve custom responses retrieved from the cache, or synthesize responses completely. Security Because they are so powerful, Service Workers can only be executed in secure contexts (meaning HTTPS). If you want to experiment first before pushing your code to production, you can always test on a localhost or setup GitHub Pages -- both support HTTPS. Offline First The "offline first" -- or "cache first" -- pattern is the most popular strategy for serving content to the user. If a resource is cached and available offline, return it first before trying to download it from the server. If it isn't in the cache already, download it and cache it for future usage. "Progressive" in PWA When implemented properly as a progressive enhancement, service worker...
...And 5 more matches
newlines - Archive of obsolete content
<< XUL Reference home newlines Type: one of the values below How the text box handles pastes with newlines in them. ...
... << XUL Reference home newlines Type: one of the values below How the text box handles pastes with newlines in them. ...
... << XUL Reference home newlines Type: one of the values below How the text box handles pastes with newlines in them. ...
...And 4 more matches
The Firefox codebase: CSS Guidelines
Basics Here are some basic tips that can optimize reviews if you are changing CSS: Avoid !important but if you have to use it, make sure it's obvious why you're using it (ideally with a comment). The Overriding CSS section contains more information about this. Avoid magic numbers; prefer automatic sizing or alignment methods. Some examples to avoid: absolutely positioned elements hardcoded values such as: vertical-align: -2px; . The reason you should avoid such "hardcoded" values is that, they don't necessarily work for all font-size configurations. Avoid setting styles in JavaScript. ...
... editing common components to writing your own. Also, it is good practice to introduce a common class when the new element you are styling reuses some styles from another element, this allows the maintenance cost and the amount of code duplication to be reduced. Formatting Spacing & Indentation 2 spaces indentation is preferred Add a space after each comma, except within color functions: linear-gradient(to bottom, black 1px, rgba(255,255,255,0.2) 1px) Always add a space before !important. Omit units on 0 values Do this: margin: 0; Not this: margin: 0px; Use expanded syntax It is often harder to understand what the shorthand is doing and the shorthand can also hide some unwanted default values. It is good to privilege expanded syntax to make your intentions explici...
.... Omit units on 0 values Do this: margin: 0; Not this: margin: 0px; Use expanded syntax It is often harder to understand what the shorthand is doing and the shorthand can also hide some unwanted default values. It is good to privilege expanded syntax to make your intentions explicit. Do this: border-color: red; Not this: border: red; Put multiple selectors on different lines Do this: h1, h2, h3 { font-family: sans-serif; text-align: center; } Not this: h1, h2, h3 { font-family: sans-serif; text-align: center; } Naming standards for class names lower-case-with-dashes is the most common. But camelCase is also used sometimes. Try to follow the style of existing or related code. Other tips Assume ="true" in attribute selectors. Example: Use ...
...And 4 more matches
NSS API Guidelines
These rules are here to help us all immediately achieve more consistent and usable code, but some existing code won't follow all these rules. NSS API Structure This section explains the structure and relationships of the NSS libraries. ...
...These rules are here to help us all immediately achieve more consistent and usable code, but some existing code won't follow all these rules. ...
...h, secdig.h, secdigt.h, secitem.h, secoid.h, secoidt.h, secport.h, secrng.h, secrngt.h, secerr.h, watcomfx.h Naming Conventions This section describes the rules that (ideally) should be followed for naming and identifying new files, functions, and data types. CVS ID Each file should include a CVS ID string for identification. The preferred format is: "@(#) $RCSfile: nss-guidelines.html, v $ $Revision: 48936 $ $Date: 2009-08-11 07:45:57 -0700 (Tue, 11 Aug 2009) $ $Name$" You can put the string in a comment or in a static char array. Use #ifdef DEBUG to include the array in debug builds only. The advantage of using an array is that you can use strings(1) to pull the ID tags out of a (debug) compiled library. You can even put them in header files; the header fi...
...And 4 more matches
Document.ononline - Web APIs
Web › API › Document › ononline
It is important to note that this event and attribute are inherently unreliable. A computer can be connected to a network without having Internet access. ...
... It is important to note that this event and attribute are inherently unreliable. A computer can be connected to a network without having Internet access. ...
... It is important to note that this event and attribute are inherently unreliable. A computer can be connected to a network without having Internet access. ...
...And 4 more matches
border-inline-start - CSS: Cascading Style Sheets
The border-inline-start CSS property is a shorthand property for setting the individual logical inline-start border property values in a single place in the style sheet. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...nline-start border property values in a single place in the style sheet. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Constituent properties This property is a shorthand for the following CSS properties: border-inline-start-color border-inline-start-style border-inline-start-width Syntax border-inline-start: 1px; border-inline-start: 2px dotted; border-inline-start: medium dashed green; The physical border to which border-inline-start maps depends on the element's writing mode, directionality, and text orientation. It corresponds to the border-top, border-right, border-bottom, or border-left property de...
...See border-style. <'color'> The color of the border. See color. ...
...And 4 more matches
inline-size - CSS: Cascading Style Sheets
The inline-size CSS property defines the horizontal or vertical size of an element's block, depending on its writing mode. It corresponds to either the width or the height property, depending on the value of writing-mode. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...'s block, depending on its writing mode. It corresponds to either the width or the height property, depending on the value of writing-mode. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...on its writing mode. It corresponds to either the width or the height property, depending on the value of writing-mode. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...And 4 more matches
margin-inline-start - CSS: Cascading Style Sheets
The margin-inline-start CSS property defines the logical inline start margin of an element, which maps to a physical margin depending on the element's writing mode, directionality, and text orientation. It corresponds to the margin-top, margin-right, margin-bottom, or margin-left property depending on the values defined for writing-mode, direction, and text-orientation. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...gin-right, margin-bottom, or margin-left property depending on the values defined for writing-mode, direction, and text-orientation. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...ending on the values defined for writing-mode, direction, and text-orientation. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...And 4 more matches
outline-width - CSS: Cascading Style Sheets
The CSS outline-width property sets the thickness of an element's outline. An outline is a line that is drawn around an element, outside the border. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. It is often more convenient to use the shorthand property outline when defining the appearance of an outline. Syntax /* Keyword values */ outline-width: thin; outline-width: medium; outline-width: thick; /* <length> values */ outline-width: 1px; outline-width: 0.1em; /* Global values */ outline-width: inherit; The outline-width property is specified as any one of the values listed below. Values <length> The widt...
... thin Depends on the user agent. Typically equivalent to 1px in desktop browsers (including Firefox). medium Depends on the user agent. Typically equivalent to 3px in desktop browsers (including Firefox). thick Depends on the user agent. Typically equivalent to 5px in desktop browsers (including Firefox). ...
...nds on the user agent. Typically equivalent to 3px in desktop browsers (including Firefox). thick Depends on the user agent. Typically equivalent to 5px in desktop browsers (including Firefox). ...
...And 4 more matches
overflow-inline - CSS: Cascading Style Sheets
The overflow-inline CSS property sets what shows when content overflows the inline start and end edges of a box. This may be nothing, a scroll bar, or the overflow content. The overflow-inline property maps to overflow-y or overflow-x depending on the writing mode of the document. Syntax /* Keyword values */ overflow-inline: visible; overflow-inline: hidden; overflow-inline: scroll; overflow-inline: auto; /* Global values */ overflow-inline: inherit; overflow-inline: initial; overflow-inline: unset; The overflow-inline property is specified as a single keyword chosen from the list of values below. Values visible Content is not clipped and may be rendered outside the padding box's inline start and end edges. ...
...Browsers display scrollbars whether or not any content is actually clipped. (This prevents scrollbars from appearing or disappearing when the content changes.) Printers may still print overflowing content. ...
...Browsers display scrollbars whether or not any content is actually clipped. (This prevents scrollbars from appearing or disappearing when the content changes.) Printers may still print overflowing content. auto Depends on the user agent. If content fits inside the padding box, it looks the same as visible, but still establishes a new block-formatting context. ...
...And 4 more matches
padding-inline-end - CSS: Cascading Style Sheets
The padding-inline-end CSS property defines the logical inline end padding of an element, which maps to a physical padding depending on the element's writing mode, directionality, and text orientation. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...ding of an element, which maps to a physical padding depending on the element's writing mode, directionality, and text orientation. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...depending on the element's writing mode, directionality, and text orientation. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Syntax /* <length> values */ padding-inline-end: 10px; /* An absolute length */ padding-inline-end: 1em; /* A length relative to the text size */ /* <percentage> value */ padding-inline-end: 5%; /* A padding relative to the block container's width */ /* Global values */ padding-inline-end: inherit; padding-inline-end: initial; padding-inline-end: unset; Values The padding-inline-end property takes the same values as the padding-left property. Description This property corresp...
...And 4 more matches
padding-inline-start - CSS: Cascading Style Sheets
The padding-inline-start CSS property defines the logical inline start padding of an element, which maps to a physical padding depending on the element's writing mode, directionality, and text orientation. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...ding of an element, which maps to a physical padding depending on the element's writing mode, directionality, and text orientation. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...pending on the element's writing mode, directionality, and text orientation. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Syntax /* <length> values */ padding-inline-start: 10px; /* An absolute length */ padding-inline-start: 1em; /* A length relative to the text size */ /* <percentage> value */ padding-inline-start: 5%; /* A padding relative to the block container's width */ /* Global values */ padding-inline-start: inherit; padding-inline-start: initial; padding-inline-start: unset; Values The padding-inline-start property takes the same values as the padding-left property. Description This pro...
...And 4 more matches
keySplines - SVG: Scalable Vector Graphics
The keySplines attribute defines a set of Bezier curve control points associated with the keyTimes list, defining a cubic Bezier function that controls interval pacing. This attribute is ignored unless the calcMode attribute is set to spline. If there are any errors in the keySplines specification (bad values, too many or too few values), the animation will not occur. ...
...the keySplines specification (bad values, too many or too few values), the animation will not occur. ...
... ...
...And 4 more matches
XUL accessibility guidelines - Archive of obsolete content
Introduction Welcome to the XUL Accessibility Guidelines. By following these principles and practices, you will be able to write your XUL applications in such a way that all users, including those with physical, sensory, or communicative disabilities, with be able to use and enjoy them. Accessibility is not difficult, but does require a basic understanding of the different types of disabilities, commonly used assistive technologies, and special accessibility features built into the XUL languages. Most of all, accessibility requires a conscious effort on your part, and a desire to include everyone. It is hoped that these guidelines will be sufficiently clear and detailed that everyone--even someone with no previous background in accessibility--can understand them. In addition, there i...
...t everyone--even someone with no previous background in accessibility--can understand them. In addition, there is an active community of accessibility developers within the Mozilla Project that will be happy to help you with any concerns or questions you have in regards to making your XUL applications fully accessible. There is also a XUL accessibility tool which can help test some of these guidelines, but please be aware that no tool can replace human judgement for accessibility, and understanding the guidelines is vital. Learn More Accessibility Platform Features Mozilla Community Software Accessibility - Where Are We Today? Intro to accessibility, assistive technologies, and Mozilla resources. Introduction to Web Accessibility. Overview of web accessibility fr...
...al to Apple accessibility. LARS (Linux Accessibility Resource Site). Portal for general Linux accessibility. Microsoft Accessibility. Portal for Microsoft accessibility. Accessibility - MDC. Accessibility hub on the Mozilla Developer Center. mozilla.support.accessibility. Mozilla accessibility newsgroup. #accessibility. Accessibility channel on Mozilla's IRC server. Guidelines Keyboard access Keyboard access is important to users who can't use a mouse. Many screen reader users and those with physical disabilities rely on the keyboard as their primary input tool. These users require easy, predictable, and well-documented keyboard control. Tab order Provide a logical tab order and ensure that users can navigate all content using a keyboard. By default, the tab order...
...And 3 more matches
overflow-clip-box-inline
Note that this property is activated by default only in the UA stylesheet and chrome contexts. Value not found in DB! Syntax Values padding-box This keyword makes the clipping be related to the padding box. ...
...Note that this property is activated by default only in the UA stylesheet and chrome contexts. Value not found in DB! Syntax Values padding-box This keyword makes the clipping be related to the padding box. ...
...Note that this property is activated by default only in the UA stylesheet and chrome contexts. Value not found in DB! Syntax Values padding-box This keyword makes the clipping be related to the padding box. ...
...And 3 more matches
CanvasRenderingContext2D.createLinearGradient() - Web APIs
Parameters x0 The x-axis coordinate of the start point. ...
... The CanvasRenderingContext2D.createLinearGradient() method of the Canvas 2D API creates a gradient along the line connecting two given coordinates. This method returns a linear CanvasGradient. To be applied to a shape, the gradient must first be assigned to the fillStyle or strokeStyle properties. Note: Gradient coordinates are global, i.e., relative to the current coordinate space. When applied to a shape, the coordinates are NOT relative to the shape's coordinates. Syntax CanvasGradient ctx.createLinearGradient(x0, y0, x1, y1); The createLinearGradient() method is specified by four parameters defining the start and end points of the gradient line. Parameters x0 The x-axis coordinate of the start point. y0 The y-axis coordinate of the start point. x1 The x-axis coordinate ...
...ctx.createLinearGradient(x0, y0, x1, y1); The createLinearGradient() method is specified by four parameters defining the start and end points of the gradient line. Parameters x0 The x-axis coordinate of the start point. y0 The y-axis coordinate of the start point. x1 The x-axis coordinate of the end point. y1 The y-axis coordinate of the end point. Return value CanvasGradient A linear CanvasGradient initialized with the specified line. Examples Filling a rectangle with a linear gradient This example initializes a linear gradient using the createLinearGradient() method. Three color stops between the gradient's start and end points are then created. Finally, the gradient is assigned to the canvas context, and is rendered to a filled rectangle. HTML <canvas id="canvas"></...
...And 3 more matches
CanvasRenderingContext2D.textBaseline - Web APIs
The CanvasRenderingContext2D.textBaseline property of the Canvas 2D API specifies the current text baseline used when drawing text. Syntax ctx.textBaseline = "top" || "hanging" || "middle" || "alphabetic" || "ideographic" || "bottom"; Options Possible values: "top" The text baseline is the top of the em square. "hanging" The text baseline is the hanging baseline. (Used by Tibetan and other Indic scripts.) "middle" The text baseline is the middle of the em square. "alphabetic" The text baseline is the normal alphabetic baseline. Default value. "ideographic" The text baseline is the ideographic baseline; this is the bottom of the body of the characters, if the main body of characters protrudes beneath the alphabetic baseline. (Used by Chinese, Japanese, and Korean scripts.) "b...
...ddle" The text baseline is the middle of the em square. "alphabetic" The text baseline is the normal alphabetic baseline. Default value. "ideographic" The text baseline is the ideographic baseline; this is the bottom of the body of the characters, if the main body of characters protrudes beneath the alphabetic baseline. (Used by Chinese, Japanese, and Korean scripts.) "bottom" The text baseline is the bottom of the bounding box. This differs from the ideographic baseline in that the ideographic baseline doesn't consider descenders. The default value is "alphabetic". Examples Comparison of property values This example demonstrates the various textBaseline property values. HTML <canvas id="canvas" width="550" height="500"></canvas> JavaScript const canvas = document.getElementBy...
...graphic baseline in that the ideographic baseline doesn't consider descenders. The default value is "alphabetic". Examples Comparison of property values This example demonstrates the various textBaseline property values. ...
...And 3 more matches
Navigator.onLine - Web APIs
Returns the online status of the browser. The property returns a boolean value, with true meaning online and false meaning offline. The property sends updates whenever the browser's ability to connect to the network changes. The update occurs when the user follows links or when a script requests a remote page. For example, the property should return false when users click links soon after they lose internet connection. Browsers implement this property differently. In Chrome and Safari, if the browser is not able to connect to a local area network (LAN) or a router, it is offline; all other conditions return true. So while you can assume that the browser is offline when it returns a false value, you cannot assume that a true value necessarily means that the browser can access the internet. Y...
...while you can assume that the browser is offline when it returns a false value, you cannot assume that a true value necessarily means that the browser can access the internet. You could be getting false positives, such as in cases where the computer is running a virtualization software that has virtual ethernet adapters that are always "connected." Therefore, if you really want to determine the online status of the browser, you should develop additional means for checking. To learn more, see the HTML5 Rocks article, Working Off the Grid. In Firefox and Internet Explorer, switching the browser to offline mode sends a false value. Until Firefox 41, all other conditions return a true value; testing actual behavior on Nightly 68 on Windows shows that it only looks for LAN connection like Chrome ...
...Working Off the Grid. In Firefox and Internet Explorer, switching the browser to offline mode sends a false value. Until Firefox 41, all other conditions return a true value; testing actual behavior on Nightly 68 on Windows shows that it only looks for LAN connection like Chrome and Safari giving false positives. You can see changes in the network state by listening for the events on window.ononline and window.onoffline. Syntax online = window.navigator.onLine; Value online is a boolean true or false. Example View a live example. ...
...And 3 more matches
OfflineAudioContext: complete event - Web APIs
The complete event of the OfflineAudioContext interface is fired when the rendering of an offline audio context is complete. ...
... The complete event of the OfflineAudioContext interface is fired when the rendering of an offline audio context is complete. ...
... The complete event of the OfflineAudioContext interface is fired when the rendering of an offline audio context is complete. ...
...And 3 more matches
Using Performance Timeline - Web APIs
The following example show the usage of these methods getEntries(), getEntriesByName() and getEntriesByType(). ...
...The following example show the usage of these methods getEntries(), getEntriesByName() and getEntriesByType(). ...
... duration: " + pe.duration); } The performance observer entry list interface has the same three getEntries*() methods as the Performance interface and these methods are used to retrieve observed performance entries within the observer callback. These methods have been used in the above stated example. ...
...And 3 more matches
Understanding the Web Content Accessibility Guidelines - Accessibility
It is comprehensive but incredibly detailed, and quite difficult to gain a rapid understanding of. ...
...It is comprehensive but incredibly detailed, and quite difficult to gain a rapid understanding of. ...
...It is comprehensive but incredibly detailed, and quite difficult to gain a rapid understanding of. ...
...And 3 more matches
Inline formatting context - CSS: Cascading Style Sheets
This article explains the inline formatting context Core concepts The inline formatting context is part of the visual rendering of a web page. Inline boxes are laid out one after the other, in the direction sentences run in the writing mode in use: In a horizontal writing mode, boxes are laid out horizontally, starting on the left. In a vertical writing mode they would be laid out vertically starting at the top. In the example below, the two (<div>) elements with the black borders form a block formatting context, inside which each word participates in an inline formatting context. The boxes in the horizontal writing mode run horizontally, and the vertical writing mode boxes run vertically. Boxes forming a line are contained by a rectangular area called a line box. This box w...
...elow, the two (<div>) elements with the black borders form a block formatting context, inside which each word participates in an inline formatting context. The boxes in the horizontal writing mode run horizontally, and the vertical writing mode boxes run vertically. Boxes forming a line are contained by a rectangular area called a line box. This box will be large enough to contain all of the inline boxes in that line; when there is no more room in the inline direction another line will be created. Therefore a paragraph is a set of inline line boxes, stacked in the block direction. When an inline box is split, margins, borders, and padding have no visual effect where the split occurs. In the next example there is a (<span>) element wrapping a set of words wrapping onto two lines. The border...
...ll be created. Therefore a paragraph is a set of inline line boxes, stacked in the block direction. When an inline box is split, margins, borders, and padding have no visual effect where the split occurs. In the next example there is a (<span>) element wrapping a set of words wrapping onto two lines. The border on the <span> breaks at the wrapping point. Margins, borders, and padding in the inline direction are respected. In the example below you can see how the margin, border, and padding on the inline <span> element are added. Note: I am using the logical, flow-relative properties -- padding-inline-start rather than padding-left -- so that they work in the inline dimension whether the text is horizontal or vertical. Read more about these properties in Logical Properties and Values. ...
...And 3 more matches
border-inline-color - CSS: Cascading Style Sheets
Syntax Values <'color'> The color of the border. See color. ...
... Syntax Values <'color'> The color of the border. See color. ...
... Syntax Values <'color'> The color of the border. See color. ...
...And 3 more matches
border-inline-style - CSS: Cascading Style Sheets
See border-style. ...
...See border-style. ...
...See border-style. ...
...And 3 more matches
max-inline-size - CSS: Cascading Style Sheets
The max-inline-size CSS property defines the horizontal or vertical maximum size of an element's block depending on its writing mode. It corresponds to the max-width or the max-height property depending on the value defined for writing-mode. If the writing mode is vertically oriented, the value of max-inline-size relates to the maximal height of the element, otherwise it relates to the maximal width of the element. It relates to max-block-size, which defines the other dimension of the element. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...herwise it relates to the maximal width of the element. It relates to max-block-size, which defines the other dimension of the element. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...e maximal width of the element. It relates to max-block-size, which defines the other dimension of the element. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...And 3 more matches
outline-offset - CSS: Cascading Style Sheets
The outline-offset CSS property sets the amount of space between an outline and the edge or border of an element. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Syntax /* <length> values */ outline-offset: 3px; outline-offset: 0.2em; /* Global values */ outline-offset: inherit; outline-offset: initial; outline-offset: unset; Values <length> The width of the space between the element and its outline. A negative value places the outline inside the element. A value of 0 places the outline so that there is no space between it and the element. ...
...In other words, it is the same as the parent element's background. ...
...In other words, it is the same as the parent element's background. ...
...And 3 more matches
baseline-shift - SVG: Scalable Vector Graphics
The baseline-shift attribute allows repositioning of the dominant-baseline relative to the dominant-baseline of the parent text content element. The shifted object might be a sub- or superscript. Note: As a presentation attribute baseline-shift can be used as a CSS property. Note: This property is going to be deprecated and authors are advised to use vertical-align instead. As a presentation attribute, it can be applied to any element but it has effect only on the following four elements: <altGlyph>, <textPath>, <tref>, and <tspan> Usage notes Value <length-percentage> | sub | super Default value 0 Animatable Yes sub The dominant-baseline is shifted to the default position for subscripts. ...
...ead. As a presentation attribute, it can be applied to any element but it has effect only on the following four elements: <altGlyph>, <textPath>, <tref>, and <tspan> Usage notes Value <length-percentage> | sub | super Default value 0 Animatable Yes sub The dominant-baseline is shifted to the default position for subscripts. super The dominant-baseline is shifted to the default position for superscripts. <length-percentage> A length value raises (positive value) or lowers (negative value) the dominant-baseline of the parent text content element by the specified length. A percentage value raises (positive value) or lowers (negative value) the dominant-baseline of the parent text content element by the specified percentage of the line-height. ...
...gth value raises (positive value) or lowers (negative value) the dominant-baseline of the parent text content element by the specified length. A percentage value raises (positive value) or lowers (negative value) the dominant-baseline of the parent text content element by the specified percentage of the line-height. Specifications Specification Status Comment CSS Inline LayoutThe definition of 'alignment-baseline' in that specification. Working Draft Removed the baseline value, as it is a redundant keyword within the vertical-align property. Scalable Vector Graphics (SVG) 2The definition of 'alignment-baseline' in that specification. ...
...And 3 more matches
<line> - SVG: Scalable Vector Graphics
Web › SVG › Element › line
The <line> element is an SVG basic shape used to create a line connecting two points. html,body,svg { height:100% } <svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg"> <line x1="0" y1="80" x2="100" y2="20" stroke="black" /> <!-- If you do not specify the stroke color the line will not be visible --> </svg> Attributes x1 Defines the x-axis coordinate of the line starting point. Value type: <length>|<percentage>|<number> ; Default value: 0; Animatable: yes x2 Defines the x-axis coordinate of the line ending point. Value type: <length>|<percentage>|<number> ; Default value: 0; Animatable: yes y1 Defines the y-axis coordinate of the line starting point. Value type: <length>|<percentage>|<number> ; Default value: 0; Animatable: yes y2 Defines the y-axis...
... Value type: <length>|<percentage>|<number> ; Default value: 0; Animatable: yes pathLength Defines the total path length in user units. ...
...sing Attributes Most notably: requiredExtensions, systemLanguage Event Attributes Global event attributes, Graphical event attributes Presentation Attributes Most notably: clip-path, clip-rule, color, color-interpolation, color-rendering, cursor, display, 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, transform, vector-effect, visibility ARIA Attributes aria-activedescendant, aria-atomic, aria-autocomplete, aria-busy, aria-checked, aria-colcount, aria-colindex, aria-colspan, aria-controls, aria-current, aria-describedby, aria-details, aria-disabled, aria-dropeffect, aria-errormessage, aria-expanded, aria-flowto, aria-grabb...
...And 3 more matches
Inline options - Archive of obsolete content
efox 7 supports a new syntax for defining extensions' preferences for both bootstrapped and traditional extensions. The user interface for the preferences defined with this new syntax appears in the extension's detail view in the Add-on Manager. This functionality originally appeared in Firefox mobile and is now available in Firefox on the desktop as well. Options file The XUL allowed for the inline options is limited to a few new tags. Here is an example of an options.xul file: <?xml version="1.0"?> <!DOCTYPE mydialog SYSTEM "chrome://myaddon/locale/mydialog.dtd"> <vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <setting type="bool" pref="extensions.myaddon.bool" title="Boolean" desc="Stored as a boolean preference" /> </vbox> Note that it's limited to <se...
...lick Me" oncommand="alert('Thank you!');"/> </setting> Setting element changed notifications Most of the setting elements (it might be all I havent really looked), support oninputchanged attribute. So like for the type="file", once a user browses and picks a file, when it updates the label it will trigger the oninputchanged attribute. So if you would like to do some changes to the XUL on the inline options page you can do so. The this value is the setting XUL element. See MXR for what all this holds: http://mxr.mozilla.org/mozilla-release/source/toolkit/mozapps/extensions/content/setting.xml for example you can fire this.inputChanged() etc etc. <setting pref="extensions.ThrobberRestored.showTxtOnToolbar" title="Show Text on Toolbar Button" type="bool" oninputchanged="alert('New value i...
... 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 attribute, otherwise the oninputchanged will not trigger. Some discussion on the subject at StackOverflow: How to use addEventListener on inputChanged of inline options Display notifications If you want to use the settings UI for anything more than storing preferences, then you will probably need to initialize them when they first appear. You can't do this until your options XUL has been loaded into the Add-on Manager window, so you should listen for the addon-options-displayed notification to initialize your settings. For example: var observer = { ...
...And 2 more matches
OES_texture_half_float_linear - Web APIs
This extension enables this ability. ...
...This extension enables this ability. ...
... The OES_texture_half_float_linear extension is part of the WebGL API and allows linear filtering with half floating-point pixel types for textures. WebGL extensions are available using the WebGLRenderingContext.getExtension() method. For more information, see also Using Extensions in the WebGL tutorial. Availability: This extension is available to both, WebGL1 and WebGL2 contexts. Linear filtering The OES_texture_half_float extension alone does not allow linear filtering with half floating-point textures. This extension enables this ability. With the help of this extension, you can now set the magnification or minification filter in the WebGLRenderingContext.texParameter() method to one of gl.LINEAR, gl.LINEAR_MIPMAP_NEAREST, gl.NEAREST_MIPMAP_LINEAR, or gl.LINEAR_MIPMAP_LINEAR, and us...
...And 2 more matches
PaymentAddress.addressLine - Web APIs
The addressLine read-only property of the PaymentAddress interface is an array of DOMString objects, each specifying a line of the address that is not covered by one of the other properties of PaymentAddress. These lines may include the street name, house number, apartment number, rural delivery route, descriptive instructions, or post office box. Syntax var paymentAddressLines = PaymentAddress.addressLine; Value An array of DOMString objects, each containing one line of the address. ...
...a line of the address that is not covered by one of the other properties of PaymentAddress. These lines may include the street name, house number, apartment number, rural delivery route, descriptive instructions, or post office box. Syntax var paymentAddressLines = PaymentAddress.addressLine; Value An array of DOMString objects, each containing one line of the address. ...
... may include the street name, house number, apartment number, rural delivery route, descriptive instructions, or post office box. Syntax var paymentAddressLines = PaymentAddress.addressLine; Value An array of DOMString objects, each containing one line of the address. ...
...And 2 more matches
-webkit-line-clamp - CSS: Cascading Style Sheets
The -webkit-line-clamp CSS property allows limiting of the contents of a block container to the specified number of lines. It only works in combination with the display property set to -webkit-box or -webkit-inline-box and the -webkit-box-orient property set to vertical. 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. When applied to anchor elements, the truncating can happen in the middle of the text, not necessarily at the end. Note: This property was originally implemented in WebKit and has some issues. It got standardized for legacy support. ...
... the contents won't be clipped but an ellipsis will still be shown after the specified number of lines. When applied to anchor elements, the truncating can happen in the middle of the text, not necessarily at the end. Note: This property was originally implemented in WebKit and has some issues. It got standardized for legacy support. The CSS Overflow Module Level 3 specification also defines a line-clamp property, which is meant to replace this property and avoid its issues. Syntax /* Keyword value */ -webkit-line-clamp: none; /* <integer> values */ -webkit-line-clamp: 3; -webkit-line-clamp: 10; /* Global values */ -webkit-line-clamp: inherit; -webkit-line-clamp: initial; -webkit-line-clamp: unset; none This value specifies that the content won't be clamped. <integer> This value...
... meant to replace this property and avoid its issues. Syntax /* Keyword value */ -webkit-line-clamp: none; /* <integer> values */ -webkit-line-clamp: 3; -webkit-line-clamp: 10; /* Global values */ -webkit-line-clamp: inherit; -webkit-line-clamp: initial; -webkit-line-clamp: unset; none This value specifies that the content won't be clamped. <integer> This value specifies the number of lines after which the content will be clamped. It must be greater than 0. ...
...And 2 more matches
border-inline-width - CSS: Cascading Style Sheets
Syntax Values <'border-width'> The width of the border. See border-width. ...
... Syntax Values <'border-width'> The width of the border. See border-width. ...
...n element, which maps to a physical border width depending on the element's writing mode, directionality, and text orientation. It corresponds to the border-top-width and border-bottom-width, or border-left-width, and border-right-width property depending on the values defined for writing-mode, direction, and text-orientation. /* <'border-width'> values */ border-inline-width: 5px 10px; border-inline-width: 5px; border-inline-width: thick; The border width in the other dimension can be set with border-block-width, which sets border-block-start-width, and border-block-end-width. Syntax Values <'border-width'> The width of the border. See border-width. Formal definition Initial valuemediumApplies toall elementsInheritednoPercentageslogical-width of containing blockComputed valueabsol...
...And 2 more matches
inset-inline-end - CSS: Cascading Style Sheets
The inset-inline-end CSS property defines the logical inline end inset of an element, which maps to a physical inset depending on the element's writing mode, directionality, and text orientation. It corresponds to the top, right, bottom, or left property depending on the values defined for writing-mode, direction, and text-orientation. /* <length> values */ inset-inline-end: 3px; inset-inline-end: 2.4em; /* <percentage>s of the width or height of the containing block */ inset-inline-end: 10%; /* Keyword value */ inset-inline-end: auto; /* Global values */ inset-inline-end: inherit; inset-inline-end: initial; inset-inline-end: unset; The shorthand for inset-inline-start and inset-inline-end is inset-inline. ...
...alues */ inset-inline-end: 3px; inset-inline-end: 2.4em; /* <percentage>s of the width or height of the containing block */ inset-inline-end: 10%; /* Keyword value */ inset-inline-end: auto; /* Global values */ inset-inline-end: inherit; inset-inline-end: initial; inset-inline-end: unset; The shorthand for inset-inline-start and inset-inline-end is inset-inline. Syntax Values The inset-inline-end property takes the same values as the left property. ...
... Values The inset-inline-end property takes the same values as the left property. ...
...And 2 more matches
inset-inline-start - CSS: Cascading Style Sheets
The inset-inline-start CSS property defines the logical inline start inset of an element, which maps to a physical offset depending on the element's writing mode, directionality, and text orientation. It corresponds to the top, right, bottom, or left property depending on the values defined for writing-mode, direction, and text-orientation. /* <length> values */ inset-inline-start: 3px; inset-inline-start: 2.4em; /* <percentage>s of the width or height of the containing block */ inset-inline-start: 10%; /* Keyword value */ inset-inline-start: auto; /* Global values */ inset-inline-start: inherit; inset-inline-start: initial; inset-inline-start: unset; The shorthand for inset-inline-start and inset-inline-end is inset-inline. ...
...-inline-start: 3px; inset-inline-start: 2.4em; /* <percentage>s of the width or height of the containing block */ inset-inline-start: 10%; /* Keyword value */ inset-inline-start: auto; /* Global values */ inset-inline-start: inherit; inset-inline-start: initial; inset-inline-start: unset; The shorthand for inset-inline-start and inset-inline-end is inset-inline. Syntax Values The inset-inline-start property takes the same values as the left property. ...
...alues The inset-inline-start property takes the same values as the left property. ...
...And 2 more matches
scroll-padding-inline - CSS: Cascading Style Sheets
The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. The scroll-padding properties define offsets for the optimal viewing region of the scrollport: the region used as the target region for placing things in view of the user. This allows the author to exclude regions of the scrollport that are obscured by other content (such as fixed-positioned toolbars or sidebars) or simply to put more breathing room between a targetted element and the edges of the scrollport. ...
...get region for placing things in view of the user. This allows the author to exclude regions of the scrollport that are obscured by other content (such as fixed-positioned toolbars or sidebars) or simply to put more breathing room between a targetted element and the edges of the scrollport. ...
...gs in view of the user. This allows the author to exclude regions of the scrollport that are obscured by other content (such as fixed-positioned toolbars or sidebars) or simply to put more breathing room between a targetted element and the edges of the scrollport. ...
...And 2 more matches
text-underline-offset - CSS: Cascading Style Sheets
The text-underline-offset CSS property sets the offset distance of an underline text decoration line (applied using text-decoration) from its original position. text-underline-offset is not part of the text-decoration shorthand. While an element can have multiple text-decoration lines, text-underline-offset only impacts underlining, and not other possible line decoration options such as overline or line-through. Syntax /* Single keyword */ text-underline-offset: auto; /* length */ text-underline-offset: 0.1em; text-underline-offset: 3px; /* percentage */ text-underline-offset: 20%; /* Global values */ text-underline-offset: inherit; text-underline-offset: initial; text-underline-offset: unset; The text-underline-offset property is specified as a single value from the list below. Valu...
...t: auto; /* length */ text-underline-offset: 0.1em; text-underline-offset: 3px; /* percentage */ text-underline-offset: 20%; /* Global values */ text-underline-offset: inherit; text-underline-offset: initial; text-underline-offset: unset; The text-underline-offset property is specified as a single value from the list below. Values auto The browser chooses the appropriate offset for underlines. <length> Specifies the offset of underlines as a <length>, overriding the font file suggestion and the browser default. It is recommended to use em units so the offset scales with the font size. <percentage> Specifies the offset of underlines as a <percentage> of 1 em in the element's font. A percentage inherits as a relative value, and so therefore scales with changes in the font. For a gi...
...gestion and the browser default. It is recommended to use em units so the offset scales with the font size. <percentage> Specifies the offset of underlines as a <percentage> of 1 em in the element's font. A percentage inherits as a relative value, and so therefore scales with changes in the font. For a given application of this property, the offset is constant across the whole box that the underline is applied to, even if there are child elements with different font sizes or vertical alignment. Formal definition Initial valueautoApplies toall elements. ...
...And 2 more matches
Error.prototype.lineNumber - JavaScript
See the browser compatability table below. ...
...See the browser compatability table below. ...
...See the browser compatability table below. ...
...And 2 more matches
Cmdline tests - Archive of obsolete content
The cmdline testsuite is located in test/cmdline. The testsuite allows more flexibility by coding scripts in python allowing any executable to run, sending commands to stdin, and asserting output using regular expressions. See test/cmdline/README document for more information. ...
... The cmdline testsuite is located in test/cmdline. The testsuite allows more flexibility by coding scripts in python allowing any executable to run, sending commands to stdin, and asserting output using regular expressions. See test/cmdline/README document for more information. ...
... The cmdline testsuite is located in test/cmdline. The testsuite allows more flexibility by coding scripts in python allowing any executable to run, sending commands to stdin, and asserting output using regular expressions. See test/cmdline/README document for more information. ...
... test/cmdline. The testsuite allows more flexibility by coding scripts in python allowing any executable to run, sending commands to stdin, and asserting output using regular expressions. See test/cmdline/README document for more information. ...
XUL Coding Style Guidelines - Archive of obsolete content
nced as "zool", stands for "XML-based User Interface Language", is a cross platform way of describing user interface. It could contain XUL specific element types for UI controls, HTML4 markups for content data, and even JavaScript for user event handling. To make XUL files easy to read and maintain, localization friendly, and portable across user agents, we need to have a set of coding style guidelines to ensure our objectives are achievable. The author has collected a set of guidelines from various sources listed in the References section. While some of the guidelines are recommended practices, the others are mandatory. XML, XUL, HTML, and XHTML guidelines The following are considered good coding style for XML/XUL documents. Disobeying them might not cause any parsing error for now, however,...
... See details here. Making XUL localizable -- mandatory In the past, UI (display) related resource descriptions are stored in *.rc (for Windows client) or *.ad (for UNIX client) so that they can be localized for a specific language or culture. In the new world, Mozilla 5.0, this is not true any more. ...
...ng XUL localizable -- mandatory In the past, UI (display) related resource descriptions are stored in *.rc (for Windows client) or *.ad (for UNIX client) so that they can be localized for a specific language or culture. In the new world, Mozilla 5.0, this is not true any more. Most of the windows and dialogs in Mozilla will be described using XUL. To make XUL stream/file localizable, several guidelines are to be adopted to make the translation work easier and less error-prone. The issues are discussed in details here: What is localizable? Widget resources Content data Style info Layout geometry How to make them localizable? Localization Notes Localization notes are the XUL writers' notes to the localizers/translators. They are placed above the actual entity string in the format: <!-- LOCA...
...ALIZATION NOTE entity name : content We recognize that translation is a subset of localization even though we've consistently referred to our notes as "LOCALIZATION NOTE". Files not to be localized? Some files live in the tree but aren't really part of the build; they're just there as programming examples or a kind of source documentation. To prevent them from being localized, you may insert a line of comment following the XML declaration as follows. <?xml version="1.0" encoding='UTF-8'?> <!-- DO NOT localize this file: [reason...] it isn't part of the build; --> When translators see this line, they won't bother to look at the rest of the file. References XUL is discussed in depth in XUL Language Spec and XUL Window Language. XUL Localizability issues XHTML 1.1 Recommendation Namespaces...
nsIDOMOfflineResourceList
The nsIDOMOfflineResourceList interface provides access to the application cache that allows web content's resources to be cached locally for use while offline. It includes methods for adding resources to and removing resources from the cache, as well as for enumerating the dynamically managed resource list. dom/interfaces/offline/nsIDOMOfflineResourceList.idlScriptable Please add a summary to this article. Last changed in Gecko 1.9.2 (Firefox 3.6 / Thunderbird 3.1 / Fennec 1.0) Inherits from: nsISupports Method overview void mozAdd(in DOMString uri); boolean mozHasItem(in DOMString uri); DOMString mozItem(in unsigned long index); void mozRemove(in DOMString uri); void swapCache(); void update(); Attributes ...
...Read only. onchecking nsIDOMEventListener An event listener to be called when fetching the application cache manifest and checking for updates. onerror nsIDOMEvent...
... void mozAdd(in DOMString uri); boolean mozHasItem(in DOMString uri); DOMString mozItem(in unsigned long index); void mozRemove(in DOMString uri); void swapCache(); void update(); Attributes Attribute Type Description mozItems nsIDOMOfflineResourceList The list of dynamically-managed entries in the offline resource list. Read only. mozLength unsigned long The number of entries in the dynamically managed offline resource list. Read only. onchecking nsIDOMEventListener An event listener to be called when fetching the application cache manifest and checking for updates. onerror nsIDOMEventListener An event listener to be called when an error occurs during...
...loaded resources should only update after a page refresh. Note: Versioned application caches are not yet supported; this method will throw an exception. void swapCache(); Parameters None. ...
ElementCSSInlineStyle.style - Web APIs
The style property is used to get as well as set the inline style of an element. When getting, it returns a CSSStyleDeclaration object that contains a list of all styles properties for that element with values assigned for the attributes that are defined in the element's inline style attribute. See the CSS Properties Reference for a list of the CSS properties accessible via style. The style property has the same (and highest) priority in the CSS cascade as an inline style declaration set via the style attribute. Setting styles Styles should not be set by assigning a string directly to the style property (as in elt.style = "color: blue;"), since it is considered read-only, as the style attribute returns a CSSStyleDeclaration object which is also read-only. Instead, styles can be set by assi...
...ute returns a CSSStyleDeclaration object which is also read-only. Instead, styles can be set by assigning values to the properties of style. For adding specific styles to an element without altering other style values, it is preferred to use the individual properties of style (as in elt.style.color = '...') as using elt.style.cssText = '...' or elt.setAttribute('style', '...') sets the complete inline style for the element by overriding the existing inline styles. Note that the property names are in camel-case and not kebab-case while setting the style using elt.style.<property> (i.e., elt.style.fontSize, not elt.style.font-size). A style declaration is reset by setting it to null or an empty string, e.g., elt.style.color = null. Internet Explorer requires setting it to an empty string, and d...
...t to null or an empty string, e.g., elt.style.color = null. Internet Explorer requires setting it to an empty string, and does not do anything when setting it to null. Examples // Set multiple styles in a single statement elt.style.cssText = "color: blue; border: 1px solid black"; // Or elt.setAttribute("style", "color:red; border: 1px solid blue;"); // Set specific style while leaving other inline style values untouched elt.style.color = "blue"; Getting style information The style property is not useful for completely learning about the styles applied on the element, since it represents only the CSS declarations set in the element's inline style attribute, not those that come from style rules elsewhere, such as style rules in the <head> section, or external style sheets. To get the valu...
... + "'\n"; } } console.log(out) The output would be something like: ... fontWeight = '' > 'bold' color = 'red' > 'rgb(255, 0, 0)' ... Note the presence of the value bold for font-weight in the computed style and the absence of it in the element's style property Specifications Specification Status Comment CSS Object Model (CSSOM)The definition of 'the ElementCSSInlineStyle.style property' in that specification. Working Draft Initial definition. ...
OES_texture_float_linear - Web APIs
This extension enables this ability. ...
...This extension enables this ability. ...
... The OES_texture_float_linear extension is part of the WebGL API and allows linear filtering with floating-point pixel types for textures. WebGL extensions are available using the WebGLRenderingContext.getExtension() method. For more information, see also Using Extensions in the WebGL tutorial. Availability: This extension is available to both, WebGL1 and WebGL2 contexts. Linear filtering The OES_texture_float extension alone does not allow linear filtering with floating-point textures. This extension enables this ability. With the help of this extension, you can now set the magnification or minification filter in the WebGLRenderingContext.texParameter() method to one of gl.LINEAR, gl.LINEAR_MIPMAP_NEAREST, gl.NEAREST_MIPMAP_LINEAR, or gl.LINEAR_MIPMAP_LINEAR, and use floating-point tex...
...s. This extension enables this ability. With the help of this extension, you can now set the magnification or minification filter in the WebGLRenderingContext.texParameter() method to one of gl.LINEAR, gl.LINEAR_MIPMAP_NEAREST, gl.NEAREST_MIPMAP_LINEAR, or gl.LINEAR_MIPMAP_LINEAR, and use floating-point textures. Examples gl.getExtension('OES_texture_float'); gl.getExtension('OES_texture_float_linear'); var texture = gl.createTexture(); gl.bindTexture(gl.TEXTURE_2D, texture); gl.texParameterf(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR); gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.FLOAT, image); Specifications Specification Status Comment OES_texture_float_linearThe definition of 'OES_texture_float_linear' in that specification. Recommendation ...
-moz-outline-radius-bottomleft - CSS: Cascading Style Sheets
The calc() function may be used as well. Values <length> The radius of the circle defining the curvature of the bottom and left edges of the element, specified as a CSS <length>. <percentage> The radius of the circle defining the rounding of the bottom-left corner of the element, specified as the percentages of the bottom and left sides of the border box. ...
...entage> The radius of the circle defining the rounding of the bottom-left corner of the element, specified as the percentages of the bottom and left sides of the border box. ...
... the circle defining the rounding of the bottom-left corner of the element, specified as the percentages of the bottom and left sides of the border box. ...
...he element, specified as the percentages of the bottom and left sides of the border box. Formal definition Initial value0Applies toall elementsInheritednoPercentagesrefer to the corresponding dimension of the border boxComputed valueas specifiedAnimation typea length, percentage or calc(); Formal syntax <outline-radius>where <outline-radius> = <length> | <percentage> Examples Rounding a outline Since this is a Firefox-only property, this example will not display the desired effect if you are viewing this in a browser other than Firefox. HTML <p>Look at this paragraph's bottom-left corner.</p> CSS p { margin: 10px; border: solid cyan; outline: dotted green; -moz-outline-radius-bottomleft: 2em; } Result Specifications Not part of any standard. ...
border-inline-end-width - CSS: Cascading Style Sheets
The border-inline-end-width CSS property defines the width of the logical inline-end border of an element, which maps to a physical border width depending on the element's writing mode, directionality, and text orientation. It corresponds to the border-top-width, border-right-width, border-bottom-width, or border-left-width property depending on the values defined for writing-mode, direction, and text-orientation. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...ttom-width, or border-left-width property depending on the values defined for writing-mode, direction, and text-orientation. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Syntax /* <'border-width'> values */ border-inline-end-width: 2px; border-inline-end-width: thick; Related properties are border-block-start-width, border-block-end-width, and border-inline-start-width, which define the other border widths of the element. Initial valuemediumApplies toall elementsInheritednoPercentageslogical-width of containing blockComputed valueabsolute length; 0 if the border style is none or hiddenAnimation typea length V...
... Editor's Draft Initial definition ...
... Editor's Draft Initial definition ...
border-inline-start-style - CSS: Cascading Style Sheets
The border-inline-start-style CSS property defines the style of the logical inline start border of an element, which maps to a physical border style depending on the element's writing mode, directionality, and text orientation. It corresponds to the border-top-style, border-right-style, border-bottom-style, or border-left-style property depending on the values defined for writing-mode, direction, and text-orientation. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...ttom-style, or border-left-style property depending on the values defined for writing-mode, direction, and text-orientation. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...operty depending on the values defined for writing-mode, direction, and text-orientation. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Syntax /* <'border-style'> values */ border-inline-start-style: dashed; border-inline-start-style: dotted; border-inline-start-style: groove; Related properties are border-block-start-style, border-block-end-style, and border-inline-end-style, which define the other border styles of the element. Initial valuenoneApplies toall elementsInheritednoComputed valueas specifiedAnimation typediscrete Values <'border-style'> The line style of the border. See border-style. Formal ...
...order-style. Formal definition Initial valuenoneApplies toall elementsInheritednoComputed valueas specifiedAnimation typediscrete Formal syntax <'border-top-style'> Examples HTML <div> <p class="exampleText">Example text</p> </div> CSS div { background-color: yellow; width: 120px; height: 120px; } .exampleText { writing-mode: vertical-lr; border: 5px solid blue; border-inline-start-style: dashed; } Specifications Specification Status Comment CSS Logical Properties and Values Level 1The definition of 'border-inline-start-style' in that specification. Editor's Draft Initial definition ...
border-inline-start-width - CSS: Cascading Style Sheets
The border-inline-start-width CSS property defines the width of the logical inline-start border of an element, which maps to a physical border width depending on the element's writing mode, directionality, and text orientation. It corresponds to the border-top-width, border-right-width, border-bottom-width, or border-left-width property depending on the values defined for writing-mode, direction, and text-orientation. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...ttom-width, or border-left-width property depending on the values defined for writing-mode, direction, and text-orientation. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Syntax /* <'border-width'> values */ border-inline-start-width: 5px; border-inline-start-width: thick; Related properties are border-block-start-width, border-block-end-width, and border-inline-end-width, which define the other border widths of the element. Values <'border-width'> The width of the border. See border-width. Formal definition Initial valuemediumApplies toall elementsInheritednoPercentageslogical-width of containing blockC...
... Editor's Draft Initial definition ...
... Editor's Draft Initial definition ...
scroll-margin-inline-end - CSS: Cascading Style Sheets
The scroll-margin-inline-end property defines the margin of the scroll snap area at the end of the inline dimension that is used for snapping this box to the snapport. The scroll snap area is determined by taking the transformed border box, finding its rectangular bounding box (axis-aligned in the scroll container's coordinate space), then adding the specified outsets. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...ng its rectangular bounding box (axis-aligned in the scroll container's coordinate space), then adding the specified outsets. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Syntax /* <length> values */ scroll-margin-inline-end: 10px; scroll-margin-inline-end: 1em; /* Global values */ scroll-margin-inline-end: inherit; scroll-margin-inline-end: initial; scroll-margin-inline-end: unset; Values <length> An outset from the inline end edge of the scroll container. Formal definition Initial value0Applies toall elementsInheritednoComputed valueas specifiedAnimation typeby computed value type Formal syntax <len...
...r > div:nth-child(2n) { background-color: #fff; color: #663399; } The most relevant part here is scroll-snap-align: end, which specifies that the right-hand edges (the "ends" along the x axis, in our case) are the designated snap points. Last of all we specify the scroll margin values, a different one for the second and third child elements: .scroller > div:nth-child(2) { scroll-margin-inline-end: 1rem; } .scroller > div:nth-child(3) { scroll-margin-inline-end: 2rem; } This means that when scrolling past the middle child elements, the scrolling will snap to 1rem outside the inline end edge of the second <div>, and 2rems outside the inline end edge of the third <div>. Result Try it for yourself: Specifications Specification Status Comment CSS Scrol...
...argin-inline-end: 2rem; } This means that when scrolling past the middle child elements, the scrolling will snap to 1rem outside the inline end edge of the second <div>, and 2rems outside the inline end edge of the third <div>. Result Try it for yourself: Specifications Specification Status Comment CSS Scroll Snap Module Level 1The definition of 'scroll-margin-inline-end' in that specification. Candidate Recommendation Initial definition ...
scroll-margin-inline-start - CSS: Cascading Style Sheets
The scroll-margin-inline-start property defines the margin of the scroll snap area at the start of the inline dimension that is used for snapping this box to the snapport. The scroll snap area is determined by taking the transformed border box, finding its rectangular bounding box (axis-aligned in the scroll container's coordinate space), then adding the specified outsets. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...ng its rectangular bounding box (axis-aligned in the scroll container's coordinate space), then adding the specified outsets. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Syntax /* <length> values */ scroll-margin-inline-start: 10px; scroll-margin-inline-start: 1em; /* Global values */ scroll-margin-inline-start: inherit; scroll-margin-inline-start: initial; scroll-margin-inline-start: unset; Values <length> An outset from the inline start edge of the scroll container. Formal definition Initial value0Applies toall elementsInheritednoComputed valueas specifiedAnimation typeby computed value type Formal ...
... div:nth-child(2n) { background-color: #fff; color: #663399; } The most relevant part here is scroll-snap-align: start, which specifies that the left-hand edges (the "starts" along the x axis, in our case) are the designated snap points. Last of all we specify the scroll margin-values, a different one for the second and third child elements: .scroller > div:nth-child(2) { scroll-margin-inline-start: 1rem; } .scroller > div:nth-child(3) { scroll-margin-inline-start: 2rem; } This means that when scrolling past the middle child elements, the scrolling will snap to 1rem outside the inline start edge of the second <div>, and 2rems outside the inline start edge of the third <div>. Result Try it for yourself: Specifications Specification Status Comment C...
...inline-start: 2rem; } This means that when scrolling past the middle child elements, the scrolling will snap to 1rem outside the inline start edge of the second <div>, and 2rems outside the inline start edge of the third <div>. Result Try it for yourself: Specifications Specification Status Comment CSS Scroll Snap Module Level 1The definition of 'scroll-margin-inline-start' in that specification. Candidate Recommendation Initial definition ...
scroll-padding-inline-start - CSS: Cascading Style Sheets
The scroll-padding-inline-start property defines offsets for the start edge in the inline dimension of the optimal viewing region of the scrollport: the region used as the target region for placing things in view of the user. This allows the author to exclude regions of the scrollport that are obscured by other content (such as fixed-positioned toolbars or sidebars) or simply to put more breathing room between a targetted element and the edges of the scrollport. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...oned toolbars or sidebars) or simply to put more breathing room between a targetted element and the edges of the scrollport. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
... room between a targetted element and the edges of the scrollport. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Syntax /* Keyword values */ scroll-padding-inline-start: auto; /* <length> values */ scroll-padding-inline-start: 10px; scroll-padding-inline-start: 1em; scroll-padding-inline-start: 10%; /* Global values */ scroll-padding-inline-start: inherit; scroll-padding-inline-start: initial; scroll-padding-inline-start: unset; Values <length-percentage> An inwards offset from the inline start edge of the scrollport, as a valid length or a percentage. auto The offset is determind by the user agent. Thi...
... Candidate Recommendation Initial definition ...
Using HTML sections and outlines - Developer guides
Authors are advised to use heading rank (h1-h6) to convey document structure. The HTML5 specification introduced several semantic sectioning elements to help organize the structure of documents. Semantic sectioning elements are specifically designed to communicate structural meaning to browsers and other technologies interpreting the document on behalf of users, such as screen readers and voice assistants. ...
...ment more clearly describes to browsers and other devices the content contained: links or other navigational structures to help users move through and understand where they are in a site's or page's content. New semantic elements were added to HTML5 to improve and clarify the sectioning of websites into meaningful areas of content. It is important for developers to use these semantic elements in line with their intended purposes. Many accessibility tools as well as reader views provided by some browsers rely on semantic sectioning elements. So don't simply swap out an existing tangle of <div> elements for a bunch of <section> elements. Section Elements in HTML5 HTML Navigational Element (<nav>) defines a section that contains navigation links that appear often on a site. You can have prim...
...ion Element (<section>) defines a section of a document to indicate a related grouping of semantic meaning. It makes sense to use the section element to provide extra context for the parent element. HTML Aside Element (<aside>) defines a section that, though related to the main element, doesn't belong to the main flow, like an explanation box or an advertisement. The aside element has its own outline, but doesn't belong to the main one. Other Semantic HTML elements used in Sectioning HTML Body Element (<body>) defines all the content of a document. It contains all the content and HTML tags. HTML Header Element (<header>) defines a page area that typically contains a logo, title, and navigation. The header can also be used inside other semantic elements such as <article> or <section>. A ...
...dience is using Internet Explorer 8 or older, then you can follow the below instructions to make them behave as expected. However, global usage of these browsers is now very small, so this is unlikely. HTML5 semantic elements don't need a special DOM interface, but they will need a specific CSS styling in older browser that don't support them explicitly. Unknown elements are styled as display: inline by default, so you'll want to set them to display: block: article, aside, footer, header, nav, section { display: block; } Of course the web developer can style them differently, but keep in mind that in a non-HTML5 browser, the default styling is different from what is expected for such elements. Also note that the <time> element has not been included, because the default styling for it in ...
<br>: The Line Break element - HTML: Hypertext Markup Language
Web › HTML › Element › br
Note: Do not use <br> to create margins between paragraphs; wrap them in <p> elements and use the CSS margin property to control their size. ...
...he source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. As you can see from the above example, a <br> element is included at each point where we want the text to break. The text after the <br> begins again at the start of the next line of the text block. Note: Do not use <br> to create margins between paragraphs; wrap them in <p> elements and use the CSS margin property to control their size. Attributes This element's attributes include the global attributes. Deprecated attributes clear Indicates where to begin the next line after the break. Styling with CSS The <br> element has a single, well-defined purpose -- to...
...xt block. Note: Do not use <br> to create margins between paragraphs; wrap them in <p> elements and use the CSS margin property to control their size. Attributes This element's attributes include the global attributes. Deprecated attributes clear Indicates where to begin the next line after the break. Styling with CSS The <br> element has a single, well-defined purpose -- to create a line break in a block of text. As such, it has no dimensions or visual output of its own, and there is very little you can do to style it. You can set a margin on <br> elements themselves to increase the spacing between the lines of text in the block, but this is a bad practice -- you should use the line-height property that was designed for that purpose. Examples Simple br In the following exampl...
...h, it has no dimensions or visual output of its own, and there is very little you can do to style it. You can set a margin on <br> elements themselves to increase the spacing between the lines of text in the block, but this is a bad practice -- you should use the line-height property that was designed for that purpose. Examples Simple br In the following example we use <br> elements to create line breaks between the different lines of a postal address: Mozilla<br> 331 E. Evelyn Avenue<br> Mountain View, CA<br> 94041<br> USA<br> The result looks like so: Accessibility concerns Creating separate paragraphs of text using <br> is not only bad practice, it is problematic for people who navigate with the aid of screen reading technology. Screen readers may announce the presence of the ele...
Extension Theming Guidelines - Archive of obsolete content
This is a set of guidelines on how to control the look and feel of your extension while leaving it open for styling by custom themes. Skin Packages Just as extension code should exist in chrome content packages, all of the styling for an extension including CSS and images should exist in a chrome skin package. Custom themes may then register a replacement for your skin package allowing them to provide their own styles for all of your content. ...
...xtension including CSS and images should exist in a chrome skin package. Custom themes may then register a replacement for your skin package allowing them to provide their own styles for all of your content. Branding Certain items of your extensions style, in particular logos and icons can be kept in the chrome content package such that they are not replaceable by custom themes Stylesheets guidelines Include Stylesheets For every new window that your extension adds and for every window that your extension overlays content into be sure to add a stylesheet from your chrome skin package. While it may be tempting to use the same stylesheet in multiple places try to avoid this so that themes can correctly target the right windows. CSS Selectors When writing stylesheet rules for windows that you ...
...in package. While it may be tempting to use the same stylesheet in multiple places try to avoid this so that themes can correctly target the right windows. CSS Selectors When writing stylesheet rules for windows that you are overlaying always try to be specific with the css selector. If you are not then you run a risk of conflicting with content that other extensions add to the window. XUL guidelines XBL Bindings XBL bindings are applied using style rules. However these are rarely part of the style of the widgets but more about adding custom widgets. In this case you should add a stylesheet to your chrome content package and apply the bindings there. This is one of the rare cases where it is sensible to put the stylesheet into the content area. Style attributes Style attributes should only ...
ui.SpellCheckerUnderlineStyle
ui.SpellCheckerUnderlineStyle holds the style which is used to underline words not recognized by the spellchecker. Type:integer Default value:5 Exists by default: no Application support: Gecko 1.9.2 (Firefox 3.6 / Thunderbird 3.1 / Fennec 1.0) Status: Active; last updated 2012-02-22 Introduction: Pushed to Nightly on 2009-04-03 Bugs: bug 338209 Values The values are defined in nsStyleConsts.h. ...
...e words not recognized by the spellchecker. ...
...zed by the spellchecker. ...
ROLE_OUTLINEITEM
<< Gecko Roles Page Represents an item in an outline or tree structure. ...
... << Gecko Roles Page Represents an item in an outline or tree structure. ...
... << Gecko Roles Page Represents an item in an outline or tree structure. ...
CanvasRenderingContext2D.lineDashOffset - Web APIs
The CanvasRenderingContext2D.lineDashOffset property of the Canvas 2D API sets the line dash offset, or "phase." Note: Lines are drawn by calling the stroke() method. Syntax ctx.lineDashOffset = value; value A float specifying the amount of the line dash offset. The default value is 0.0. Examples Offsetting a line dash This example draws two dashed lines. The first has no dash offset. The second has a dash offset of 4. ...
...lineDashOffset = value; value A float specifying the amount of the line dash offset. The default value is 0.0. Examples Offsetting a line dash This example draws two dashed lines. The first has no dash offset. The second has a dash offset of 4. HTML <canvas id="canvas"></canvas> JavaScript const canvas = document.getElementById('canvas'); const ctx = canvas.getContext('2d'); ctx.setLineDash([4, 16]); // Dashed line with no offset ctx.beginPath(); ctx.moveTo(0, 50); ctx.lineTo(300, 50); ctx.stroke(); // Dashed line with offset of 4 ctx.beginPath(); ctx.strokeStyle = 'red'; ctx.lineDashOffset = 4; ctx.moveTo(0, 100); ctx.lineTo(300, 100); ctx.stroke(); Result The line with a dash offset is drawn in red. Marching ants The marching ants effect is an animation technique ofte...
...technique often found in selection tools of computer graphics programs. It helps the user to distinguish the selection border from the image background by animating the border. HTML <canvas id="canvas"></canvas> const canvas = document.getElementById('canvas'); const ctx = canvas.getContext('2d'); let offset = 0; function draw() { ctx.clearRect(0, 0, canvas.width, canvas.height); ctx.setLineDash([4, 2]); ctx.lineDashOffset = -offset; ctx.strokeRect(10, 10, 100, 100); } function march() { offset++; if (offset > 16) { offset = 0; } draw(); setTimeout(march, 20); } march(); Specifications Specification Status Comment HTML Living StandardThe definition of 'CanvasRenderingContext2D.lineDashOffset' in that specification. Living Standard ...
CanvasRenderingContext2D.lineTo() - Web APIs
The CanvasRenderingContext2D method lineTo(), part of the Canvas 2D API, adds a straight line to the current sub-path by connecting the sub-path's last point to the specified (x, y) coordinates. Like other methods that modify the current path, this method does not directly render anything. To draw the path onto a canvas, you can use the fill() or stroke() methods. Syntax ctx.lineTo(x, y); Parameters x The x-axis coordinate of the line's end point. y The y-axis coordinate of the line's end point. Return value undefined. Examples Drawing a straight line This example draws a straight line using the lineTo() method. HTML <canvas id="canvas"></canvas> JavaScript The line begins at (30, 50) and ends at (150, 100). const canvas = document.getElementById('canvas'); const ctx = ...
... undefined. Examples Drawing a straight line This example draws a straight line using the lineTo() method. HTML <canvas id="canvas"></canvas> JavaScript The line begins at (30, 50) and ends at (150, 100). const canvas = document.getElementById('canvas'); const ctx = canvas.getContext('2d'); ctx.beginPath(); // Start a new path ctx.moveTo(30, 50); // Move the pen to (30, 50) ctx.lineTo(150, 100); // Draw a line to (150, 100) ctx.stroke(); // Render the path Result Drawing connected lines Each call of lineTo() (and similar methods) automatically adds to the current sub-path, which means that all the lines will all be stroked or filled together. This example draws a letter 'M' with a single contiguous line. HTML <canvas id="canvas"></canvas> JavaScript const...
...nected lines Each call of lineTo() (and similar methods) automatically adds to the current sub-path, which means that all the lines will all be stroked or filled together. This example draws a letter 'M' with a single contiguous line. HTML <canvas id="canvas"></canvas> JavaScript const canvas = document.getElementById('canvas'); const ctx = canvas.getContext('2d'); ctx.moveTo(90, 130); ctx.lineTo(95, 25); ctx.lineTo(150, 80); ctx.lineTo(205, 25); ctx.lineTo(210, 130); ctx.lineWidth = 15; ctx.stroke(); Result Specifications Specification Status Comment HTML Living StandardThe definition of 'CanvasRenderingContext2D.lineTo' in that specification. Living Standard ...
CanvasRenderingContext2D.lineWidth - Web APIs
The CanvasRenderingContext2D.lineWidth property of the Canvas 2D API sets the thickness of lines. Note: Lines can be drawn with the stroke(), strokeRect(), and strokeText() methods. Syntax ctx.lineWidth = value; Options value A number specifying the line width, in coordinate space units. Zero, negative, Infinity, and NaN values are ignored. This value is 1.0 by default. Examples Changing line width This example draws a line and a rectangle, using a line width of 15 units. ...
... A number specifying the line width, in coordinate space units. Zero, negative, Infinity, and NaN values are ignored. This value is 1.0 by default. Examples Changing line width This example draws a line and a rectangle, using a line width of 15 units. HTML <canvas id="canvas"></canvas> JavaScript const canvas = document.getElementById('canvas'); const ctx = canvas.getContext('2d'); ctx.lineWidth = 15; ctx.beginPath(); ctx.moveTo(20, 20); ctx.lineTo(130, 130); ctx.rect(40, 40, 70, 70); ctx.stroke(); Result More examples For more examples and explanation about this property, see Applying styles and color in the Canvas Tutorial. ...
...t('2d'); ctx.lineWidth = 15; ctx.beginPath(); ctx.moveTo(20, 20); ctx.lineTo(130, 130); ctx.rect(40, 40, 70, 70); ctx.stroke(); Result More examples For more examples and explanation about this property, see Applying styles and color in the Canvas Tutorial. Specifications Specification Status Comment HTML Living StandardThe definition of 'CanvasRenderingContext2D.lineWidth' in that specification. Living Standard ...
DocumentTimeline - Web APIs
The DocumentTimeline interface of the the Web Animations API represents animation timelines, including the default document timeline (accessed via Document.timeline). Constructor DocumentTimeline() Creates a new DocumentTimeline object associated with the active document of the current browsing context. Properties This interface inherits its property from its parent, AnimationTimeline. AnimationTimeline.currentTime Returns the time value in milliseconds for this timeline or null if it is inactive. Examples We could share a single documentTimeline among multiple animations, thus allowing us to manipulate just that group of animations via their shared timeline. This bit of code would start all the cats animating 500 milliseconds into their animations: const cats = document.que...
...me Returns the time value in milliseconds for this timeline or null if it is inactive. Examples We could share a single documentTimeline among multiple animations, thus allowing us to manipulate just that group of animations via their shared timeline. ...
...in milliseconds for this timeline or null if it is inactive. Examples We could share a single documentTimeline among multiple animations, thus allowing us to manipulate just that group of animations via their shared timeline. This bit of code would start all the cats animating 500 milliseconds into their animations: const cats = document.querySelectorAll('.sharedTimelineCat'); const sharedTimeline = new DocumentTimeline({ originTime: 500 }); for (const cat of cats) { const catKeyframes = new KeyframeEffect(cat, keyframes, timing); const catAnimation = new Animation(catKeyframes, sharedTimeline); catAnimation.play(); } Specifications Specification Status Comment Web AnimationsThe definition of 'DocumentTimeline' in that specification. Working Draft E...
IdleDeadline.didTimeout - Web APIs
Idle callbacks support the concept of a timeout in order to ensure that whatever task they're meant to perform actually happens, even if the user agent never has enough idle time available. ...
... Idle callbacks support the concept of a timeout in order to ensure that whatever task they're meant to perform actually happens, even if the user agent never has enough idle time available. ...
...me available. Your callback will typically check the value of didTimeout if it needs to perform an action even if the browser is too busy to grant you the time; you should react by performing the needed task or, ideally, a minimal amount of work that can be done to keep things moving along, then schedule a new callback to try again to get the rest of the work done. Syntax var timedOut = IdleDeadline.didTimeout; Value A Boolean which is true if the callback is running due to the callback's timeout period elapsing or false if the callback is running because the user agent is idle and is offering time to the callback. Example See our complete example in the article Cooperative Scheduling of Background Tasks API. Specifications Specification Status Comment Cooperati...
LinearAccelerationSensor.x - Web APIs
The x read-only property of the LinearAccelerationSensor interface returns a double precision integer containing the linear acceleration of the device along the device's x axis. If a feature policy blocks use of a feature it is because your code is inconsistent with the policies set on your server. This is not something that would ever be shown to a user. See Feature-Policy for implementation instructions. Syntax var xLinearAccelerationSensor = linearAccelerationSensor.x Value A Number. Example Linear acceleration is typically read in the Sensor.onreading event callback. In the example below this occurs sixty times a second. ...
...nt with the policies set on your server. This is not something that would ever be shown to a user. See Feature-Policy for implementation instructions. Syntax var xLinearAccelerationSensor = linearAccelerationSensor.x Value A Number. Example Linear acceleration is typically read in the Sensor.onreading event callback. In the example below this occurs sixty times a second. ...
...Feature-Policy for implementation instructions. Syntax var xLinearAccelerationSensor = linearAccelerationSensor.x Value A Number. Example Linear acceleration is typically read in the Sensor.onreading event callback. In the example below this occurs sixty times a second. let laSensor = new LinearAccelerationSensor({frequency: 60}); laSensor.addEventListener('reading', e => { console.log("Linear acceleration along the X-axis " + laSensor.x); console.log("Linear acceleration along the Y-axis " + laSensor.y); console.log("Linear acceleration along the Z-axis " + laSensor.z); }); laSensor.start(); Specifications Specification Status Comment Generic Sensor API Candidate Recommendation Defines sensors in general. AccelerometerThe definition of 'x...
LinearAccelerationSensor.y - Web APIs
The y read-only property of the LinearAccelerationSensor interface returns a double precision integer containing the acceleration of the device along the device's y axis. If a feature policy blocks use of a feature it is because your code is inconsistent with the policies set on your server. This is not something that would ever be shown to a user. See Feature-Policy for implementation instructions. Syntax var yAcceleration = accelerometer.y Value A Number. Example Linear acceleration is typically read in the Sensor.onreading event callback. In the example below this occurs sixty times a second. ...
...your code is inconsistent with the policies set on your server. This is not something that would ever be shown to a user. See Feature-Policy for implementation instructions. Syntax var yAcceleration = accelerometer.y Value A Number. Example Linear acceleration is typically read in the Sensor.onreading event callback. In the example below this occurs sixty times a second. ...
...e shown to a user. See Feature-Policy for implementation instructions. Syntax var yAcceleration = accelerometer.y Value A Number. Example Linear acceleration is typically read in the Sensor.onreading event callback. In the example below this occurs sixty times a second. let laSensor = new LinearAccelerationSensor({frequency: 60}); laSensor.addEventListener('reading', e => { console.log("Linear acceleration along the X-axis " + laSensor.x); console.log("Linear acceleration along the Y-axis " + laSensor.y); console.log("Linear acceleration along the Z-axis " + laSensor.z); }); laSensor.start(); Specifications Specification Status Comment Generic Sensor API Candidate Recommendation Defines sensors in general. AccelerometerThe definition of 'y...
LinearAccelerationSensor.z - Web APIs
The z read-only property of the LinearAccelerationSensor interface returns a double precision integer containing the acceleration of the device along the device's z axis. If a feature policy blocks use of a feature it is because your code is inconsistent with the policies set on your server. This is not something that would ever be shown to a user. See Feature-Policy for implementation instructions. Syntax var zAcceleration = accelerometer.z Value A Number. Example Linear acceleration is typically read in the Sensor.onreading event callback. In the example below this occurs sixty times a second. ...
...your code is inconsistent with the policies set on your server. This is not something that would ever be shown to a user. See Feature-Policy for implementation instructions. Syntax var zAcceleration = accelerometer.z Value A Number. Example Linear acceleration is typically read in the Sensor.onreading event callback. In the example below this occurs sixty times a second. ...
...e shown to a user. See Feature-Policy for implementation instructions. Syntax var zAcceleration = accelerometer.z Value A Number. Example Linear acceleration is typically read in the Sensor.onreading event callback. In the example below this occurs sixty times a second. let laSensor = new LinearAccelerationSensor({frequency: 60}); laSensor.addEventListener('reading', e => { console.log("Linear acceleration along the X-axis " + laSensor.x); console.log("Linear acceleration along the Y-axis " + laSensor.y); console.log("Linear acceleration along the Z-axis " + laSensor.z); }); laSensor.start(); Specifications Specification Status Comment Generic Sensor API Candidate Recommendation Defines sensors in general. AccelerometerThe definition of 'z...
LinearAccelerationSensor - Web APIs
The LinearAccelerationSensor interface of the Sensor APIs provides on each reading the acceleration applied to the device along all three axes, but without the contribution of gravity. To use this sensor, the user must grant permission to the 'accelerometer' device sensor through the Permissions API. If a feature policy blocks use of a feature it is because your code is inconsistent with the policies set on your server. This is not something that would ever be shown to a user. See Feature-Policy for implementation instructions. Constructor LinearAccelerationSensor.LinearAccelerationSensor() Creates a new LinearAccelerationSensor object. Properties LinearAccelerationSensor.x Read only Returns a double containing the linear acceleration of the device along the device's x axis. L...
... to a user. See Feature-Policy for implementation instructions. Constructor LinearAccelerationSensor.LinearAccelerationSensor() Creates a new LinearAccelerationSensor object. Properties LinearAccelerationSensor.x Read only Returns a double containing the linear acceleration of the device along the device's x axis. LinearAccelerationSensor.y Read only Returns a double containing the linear acceleration of the device along the device's y axis. LinearAccelerationSensor.z Read only Returns a double containing the linear acceleration of the device along the device's z axis. Example Linear acceleration is typically read in the Sensor.onreading event callback. In the example below this occurs sixty times a second. let laSensor = new LinearAccelerationSensor({frequency: 60}); la...
... LinearAccelerationSensor.z Read only Returns a double containing the linear acceleration of the device along the device's z axis. Example Linear acceleration is typically read in the Sensor.onreading event callback. In the example below this occurs sixty times a second. let laSensor = new LinearAccelerationSensor({frequency: 60}); laSensor.addEventListener('reading', e => { console.log("Linear acceleration along the X-axis " + laSensor.x); console.log("Linear acceleration along the Y-axis " + laSensor.y); console.log("Linear acceleration along the Z-axis " + laSensor.z); }); laSensor.start(); Specifications Specification Status Comment Generic Sensor API Candidate Recommendation Defines sensors in general. AccelerometerThe definition of 'L...
Performance Timeline - Web APIs
The Performance Timeline API defines extensions to the Performance interface to support client-side latency measurements within applications. The extensions provide interfaces to retrieve performance entry metrics based on specific filter criteria. The standard also includes interfaces that allow an application to define performance observer callbacks that are notified when specific performance events are added to the browser's performance timeline. This document provides an overview of the standard's interfaces. For more details about the interfaces, see the reference pages and Using Performance Timeline. ...
...d also includes interfaces that allow an application to define performance observer callbacks that are notified when specific performance events are added to the browser's performance timeline. This document provides an overview of the standard's interfaces. For more details about the interfaces, see the reference pages and Using Performance Timeline. Performance extensions The Performance Timeline API extends the Performance interface with three methods that provide different mechanisms to get a set of performance records (metrics), depending on the specified filter criteria. The methods are: getEntries() Returns all recorded performance entries or, optionally, the entries based on the specified name, performance type and/or the initiatorType (such as an HTML element). getEntriesByNam...
...t). getEntriesByName() Returns the recorded performance entries based on the specified name and optionally the performance type. getEntriesByType() Returns the recorded performance entries based on the specified performance type. PerformanceEntry interface The PerformanceEntry interface encapsulates a single performance entry -- that is, a single data point or metric in the performance timeline. This interface has the following four properties, and these properties are extended (with additional constraints) by other interfaces (such as PerformanceMark): name The name of the performance entry when the metric was created. entryType The type of performance metric (for example, "mark"). startTime A high resolution timestamp representing the starting time for the performance entry. ...
WebGLRenderingContext.lineWidth() - Web APIs
The WebGLRenderingContext.lineWidth() method of the WebGL API sets the line width of rasterized lines. The webgl spec, based on the OpenGL ES 2.0/3.0 specs points out that the minimum and maximum width for a line is implementation defined. The maximum minimum width is allowed to be 1.0. The minimum maximum width is also allowed to be 1.0. Because of these implementation defined limits it is not recommended to use line widths other than 1.0 since there is no guarantee any user's browser will display any other width. As of January 2017 most implementations of WebGL only support a minimum of 1 and a maximum of 1 as the technology they are based on has these same limits. Syntax void gl.lineWidth(width); Parameters width A GLfloat specifying the width of rasterized lines. Default value...
...here is no guarantee any user's browser will display any other width. As of January 2017 most implementations of WebGL only support a minimum of 1 and a maximum of 1 as the technology they are based on has these same limits. Syntax void gl.lineWidth(width); Parameters width A GLfloat specifying the width of rasterized lines. Default value: 1. Return value None. Examples Setting the line width: gl.lineWidth(5); Getting the line width: gl.getParameter(gl.LINE_WIDTH); Getting the range of available widths. Returns a Float32Array. gl.getParameter(gl.ALIASED_LINE_WIDTH_RANGE); Specifications Specification Status Comment WebGL 1.0The definition of 'lineWidth' in that specification. Recommendation Initial definition. OpenGL ES 2.0The defini...
... Standard Man page of the OpenGL API. ...
Window: online event - Web APIs
The online event of the Window interface is fired when the browser has gained access to the network and the value of Navigator.onLine switches to true. Note: This event shouldn't be used to determine the availability of a particular website. Network problems or firewalls might still prevent the website from being reached. ...
...s fired when the browser has gained access to the network and the value of Navigator.onLine switches to true. Note: This event shouldn't be used to determine the availability of a particular website. Network problems or firewalls might still prevent the website from being reached. ...
...or.onLine switches to true. Note: This event shouldn't be used to determine the availability of a particular website. Network problems or firewalls might still prevent the website from being reached. Bubbles No Cancelable No Interface Event Event handler property ononline Examples // addEventListener version window.addEventListener('online', (event) => { console.log("You are now connected to the network."); }); // ononline version window.ononline = (event) => { console.log("You are now connected to the network."); }; Specifications Specification Status HTML Living StandardThe definition of 'online event' in that specification. Living Standard ...
border-inline-end-color - CSS: Cascading Style Sheets
The border-inline-end-color CSS property defines the color of the logical inline-end border of an element, which maps to a physical border color depending on the element's writing mode, directionality, and text orientation. It corresponds to the border-top-color, border-right-color, border-bottom-color, or border-left-color property depending on the values defined for writing-mode, direction, and text-orientation. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
... border-right-color, border-bottom-color, or border-left-color property depending on the values defined for writing-mode, direction, and text-orientation. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Syntax border-inline-end-color: rebeccapurple; border-inline-end-color: #663399; Related properties are border-block-start-color, border-block-end-color, and border-inline-start-color, which define the other border colors of the element. Initial valuecurrentcolorApplies toall elementsInheritednoComputed valuecomputed colorAnimation typea color Values <'color'> The color of the border. See color. Formal defi...
...r. Formal definition Initial valuecurrentcolorApplies toall elementsInheritednoComputed valuecomputed colorAnimation typea color Formal syntax <'border-top-color'> Examples HTML <div> <p class="exampleText">Example text</p> </div> CSS div { background-color: yellow; width: 120px; height: 120px; } .exampleText { writing-mode: vertical-lr; border: 10px solid blue; border-inline-end-color: red; } Specifications Specification Status Comment CSS Logical Properties and Values Level 1The definition of 'border-inline-end-color' in that specification. Editor's Draft Initial definition ...
border-inline-end-style - CSS: Cascading Style Sheets
The border-inline-end-style CSS property defines the style of the logical inline end border of an element, which maps to a physical border style depending on the element's writing mode, directionality, and text orientation. It corresponds to the border-top-style, border-right-style, border-bottom-style, or border-left-style property depending on the values defined for writing-mode, direction, and text-orientation. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...ttom-style, or border-left-style property depending on the values defined for writing-mode, direction, and text-orientation. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Syntax /* <'border-style'> values */ border-inline-end-style: dashed; border-inline-end-style: dotted; border-inline-end-style: groove; Related properties are border-block-start-style, border-block-end-style, and border-inline-start-style, which define the other border styles of the element. Values <'border-style'> The line style of the border. See border-style. Formal definition Initial valuenoneApplies toall elementsInheritednoCompute...
...order-style. Formal definition Initial valuenoneApplies toall elementsInheritednoComputed valueas specifiedAnimation typediscrete Formal syntax <'border-top-style'> Examples HTML <div> <p class="exampleText">Example text</p> </div> CSS div { background-color: yellow; width: 120px; height: 120px; } .exampleText { writing-mode: vertical-lr; border: 5px solid blue; border-inline-end-style: dashed; } Results Specifications Specification Status Comment CSS Logical Properties and Values Level 1The definition of 'border-inline-end-style' in that specification. Editor's Draft Initial definition ...
border-inline-start-color - CSS: Cascading Style Sheets
The border-inline-start-color CSS property defines the color of the logical inline start border of an element, which maps to a physical border color depending on the element's writing mode, directionality, and text orientation. It corresponds to the border-top-color, border-right-color, border-bottom-color, or border-left-color property depending on the values defined for writing-mode, direction, and text-orientation. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
... border-right-color, border-bottom-color, or border-left-color property depending on the values defined for writing-mode, direction, and text-orientation. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Syntax border-inline-start-color: red; border-inline-start-color: #ee4141; Related properties are border-block-start-color, border-block-end-color, and border-inline-end-color, which define the other border colors of the element. Values <'color'> The color of the border. See color. Formal definition Initial valuecurrentcolorApplies toall elementsInheritednoComputed valuecomputed colorAnimation typea color ...
...r. Formal definition Initial valuecurrentcolorApplies toall elementsInheritednoComputed valuecomputed colorAnimation typea color Formal syntax <'border-top-color'> Examples HTML <div> <p class="exampleText">Example text</p> </div> CSS div { background-color: yellow; width: 120px; height: 120px; } .exampleText { writing-mode: vertical-lr; border: 10px solid blue; border-inline-start-color: red; } Specifications Specification Status Comment CSS Logical Properties and Values Level 1The definition of 'border-inline-start-color' in that specification. Editor's Draft Initial definition ...
line-height-step - CSS: Cascading Style Sheets
The line-height-step CSS property sets the step unit for line box heights. When the property is set, line box heights are rounded up to the closest multiple of the unit. /* Point values */ line-height-step: 18pt; Syntax The line-height-step property is specified as any one of the following: a <length>. Values <length> The specified <length> is used in the calculation of the line box height step. Formal definition Initial value0Applies toblock containersInheritedyesComputed valueabsolute <length>Animation typediscrete Formal syntax <length> Examples Setting step unit for line box height In the following example, the height of line box in each paragraph is rounded up to the step unit. ...
...es <length> The specified <length> is used in the calculation of the line box height step. Formal definition Initial value0Applies toblock containersInheritedyesComputed valueabsolute <length>Animation typediscrete Formal syntax <length> Examples Setting step unit for line box height In the following example, the height of line box in each paragraph is rounded up to the step unit. The line box in <h1> does not fit into one step unit and thus occupies two, but it is still centered within the two step unit. ...
...uted valueabsolute <length>Animation typediscrete Formal syntax <length> Examples Setting step unit for line box height In the following example, the height of line box in each paragraph is rounded up to the step unit. The line box in <h1> does not fit into one step unit and thus occupies two, but it is still centered within the two step unit. :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. Working Draft Initial definition. ...
scroll-padding-inline-end - CSS: Cascading Style Sheets
The scroll-padding-inline-end property defines offsets for the end edge in the inline dimension of the optimal viewing region of the scrollport: the region used as the target region for placing things in view of the user. This allows the author to exclude regions of the scrollport that are obscured by other content (such as fixed-positioned toolbars or sidebars) or simply to put more breathing room between a targetted element and the edges of the scrollport. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...oned toolbars or sidebars) or simply to put more breathing room between a targetted element and the edges of the scrollport. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Syntax /* Keyword values */ scroll-padding-inline-end: auto; /* <length> values */ scroll-padding-inline-end: 10px; scroll-padding-inline-end: 1em; scroll-padding-inline-end: 10%; /* Global values */ scroll-padding-inline-end: inherit; scroll-padding-inline-end: initial; scroll-padding-inline-end: unset; Values <length-percentage> An inwards offset from the inline end edge of the scrollport, as a valid length or a percentage. auto The ...
... Candidate Recommendation Initial definition ...
<iframe>: The Inline Frame element - HTML: Hypertext Markup Language
Web › HTML › Element › iframe
The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Each embedded browsing context has its own session history and document. The browsing context that embeds the others is called the parent browsing context. The topmost browsing context -- the one with no parent -- is usually the browser window, represented by the Window object. Because each browsing context is a complete document environment, every <iframe> in a page requires increased memory and other computing resources. ...
...n Internet Explorer 9 and earlier. src The URL of the page to embed. Use a value of about:blank to embed an empty page that conforms to the same-origin policy. Also note that programatically removing an <iframe>'s src attribute (e.g. via Element.removeAttribute()) causes about:blank to be loaded in the frame in Firefox (from version 65), Chromium-based browsers, and Safari/iOS. srcdoc Inline HTML to embed, overriding the src attribute. If a browser does not support the srcdoc attribute, it will fall back to the URL in the src attribute. width The width of the frame in CSS pixels. Default is 300. Deprecated attributes These attributes are deprecated and may no longer be supported by all user agents. You should not use them in new content, and try to remove them from existing cont...
...lbar for the frame: auto: Only when the frame's content is larger than its dimensions. yes: Always show a scrollbar. no: Never show a scrollbar. Non-standard attributes mozbrowser See bug 1318532 for exposing this to WebExtensions in Firefox. Makes the <iframe> act like a top-level browser window. See Browser API for details. Available only to WebExtensions. Scripting Inline frames, like <frame> elements, are included in the window.frames pseudo-array. With the DOM HTMLIFrameElement object, scripts can access the window object of the framed resource via the contentWindow property. The contentDocument property refers to the document inside the <iframe>, same as contentWindow.document. From the inside of a frame, a script can get a reference to its parent window with...
Baseline - MDN Web Docs Glossary: Definitions of Web-related terms
The baseline is a term used in European and West Asian typography meaning an imaginary line upon which the characters of a font rest. The descenders of characters like g and p extend below this line. Glyphs with rounded lower and upper extents like C or 3 slightly extend below it. East Asian scripts have no baseline. Their glyphs are placed in a square box without ascenders or descenders. ...
...uropean and West Asian typography meaning an imaginary line upon which the characters of a font rest. The descenders of characters like g and p extend below this line. Glyphs with rounded lower and upper extents like C or 3 slightly extend below it. East Asian scripts have no baseline. Their glyphs are placed in a square box without ascenders or descenders. ...
Secure Development Guidelines
XSS: Example The following snippet of JavaScript: document.write("Welcome to " + document.location); ... is exploitable (in some browsers) with a simple request such as: http://www.victim.com?something=<SCRIPT>alert('Oops')</SCRIPT> XSS: Prevention Escape all dynamic input that will be sent back to the user HTML encoding &amp; -> & &lt; -> ...
...to be > 512, cut it off there If the input should only be [a-zA-Z0-9], enforce it Cross Site Scripting (XSS) XSS is a type of code injection attack Typically occurs in web applications Injection of arbitrary data into an HTML document from another site Victim's browser executes those HTML instructions Could be used to steal user credentials Think: webmail, online auction, CMS, online banking... XSS: Example The following snippet of JavaScript: document.write("Welcome to " + document.location); ... is exploitable (in some browsers) with a simple request such as: http://www.victim.com?something=<SCRIPT>alert('Oops')</SCRIPT> XSS: Prevention Escape all dynamic input that will be sent back to the user HTML encoding &amp; -> & &lt; -> < &gt; -> > &qu...
AddressErrors.addressLine - Web APIs
An object based on AddressErrors includes an addressLine property when validation of the address finds one or more errors in the array of strings in the address's addressLine. The returned string explains the error and should offer suggestions for how to correct it. Syntax var addressLineError = AddressErrors.addressLine; Value If an error occurred during validation of the address due to one of the strings in the addressLine array having an invalid value, this property is set to a DOMString providing a human-readable error message explaining the validation error. The text should also include, when possible, advice about how to go about correcting the error. ...
...rs.addressLine; Value If an error occurred during validation of the address due to one of the strings in the addressLine array having an invalid value, this property is set to a DOMString providing a human-readable error message explaining the validation error. The text should also include, when possible, advice about how to go about correcting the error. If the PaymentAddress object's addressLine property was determined to be valid, this property is not included in the AddressErrors dictionary. Specifications Specification Status Comment Payment Request APIThe definition of 'AddressErrors.addressLine' in that specification. Candidate Recommendation Initial definition. ...
Animation.timeline - Web APIs
The Animation.timeline property of the Animation interface returns or sets the timeline associated with this animation. A timeline is a source of time values for synchronization purposes, and is an AnimationTimeline-based object. By default, the animation's timeline and the Document's timeline are the same. Syntax var animationsTimeline = Animation.timeline; Animation.timeline = newTimeline; Value A timeline object to use as the timing source for the animation, or null to use the default, which is the Document's timeline. ...
...n purposes, and is an AnimationTimeline-based object. By default, the animation's timeline and the Document's timeline are the same. Syntax var animationsTimeline = Animation.timeline; Animation.timeline = newTimeline; Value A timeline object to use as the timing source for the animation, or null to use the default, which is the Document's timeline. Examples Here we set the animation's timeline to be the same as the document's timeline (this is the default timeline for all animations, by the way): animation.timeline = document.timeline; Specifications Specification Status Comment Web AnimationsThe definition of 'Animation.timeline' in that specification. Working Draft Editor's draft. ...
AnimationTimeline.currentTime - Web APIs
The currentTime read-only property of the Web Animations API's AnimationTimeline interface returns the timeline's current time in milliseconds, or null if the timeline is inactive. Syntax var currentTime = AnimationTimeline.currentTime; Value A number representing the timeline's current time in milliseconds, or null if the timeline is inactive. Reduced time precision To offer protection against timing attacks and fingerprinting, the precision of animationTimeline.currentTime might get rounded depending on browser settings. In Firefox, the privacy.reduceTimerPrecision preference is enabled by default and defaults to 20us in Firefox 59; in 60 it will be 2ms. // reduced time precision (2ms) in Firefox 60 animationTimeline.currentTime; // 23.404 // 24.192 // 25.514 // ... // r...
...e.currentTime might get rounded depending on browser settings. In Firefox, the privacy.reduceTimerPrecision preference is enabled by default and defaults to 20us in Firefox 59; in 60 it will be 2ms. // reduced time precision (2ms) in Firefox 60 animationTimeline.currentTime; // 23.404 // 24.192 // 25.514 // ... // reduced time precision with `privacy.resistFingerprinting` enabled animationTimeline.currentTime; // 49.8 // 50.6 // 51.7 // ... In Firefox, you can also enable privacy.resistFingerprinting; the precision will be 100ms or the value of privacy.resistFingerprinting.reduceTimerPrecision.microseconds, whichever is larger. Specifications Specification Status Comment Web AnimationsThe definition of 'currentTime' in that specification. Working Draft Edi...
CanvasRenderingContext2D.getLineDash() - Web APIs
The getLineDash() method of the Canvas 2D API's CanvasRenderingContext2D interface gets the current line dash pattern. Syntax ctx.getLineDash(); Return value An Array of numbers that specify distances to alternately draw a line and a gap (in coordinate space units). If the number, when setting the elements, is odd, the elements of the array get copied and concatenated. For example, setting the line dash to [5, 15, 25] will result in getting back [5, 15, 25, 5, 15, 25]. Examples Getting the current line dash setting This example demonstrates the getLineDash() method. HTML <canvas id="canvas"></canvas> JavaScript As set by setLineDash(), strokes consist of lines that are 10 units wide, with spaces of 20 units in between each line. const canvas = document.getElementById('canvas'); c...
...g back [5, 15, 25, 5, 15, 25]. Examples Getting the current line dash setting This example demonstrates the getLineDash() method. HTML <canvas id="canvas"></canvas> JavaScript As set by setLineDash(), strokes consist of lines that are 10 units wide, with spaces of 20 units in between each line. const canvas = document.getElementById('canvas'); const ctx = canvas.getContext('2d'); ctx.setLineDash([10, 20]); console.log(ctx.getLineDash()); // [10, 20] // Draw a dashed line ctx.beginPath(); ctx.moveTo(0, 50); ctx.lineTo(300, 50); ctx.stroke(); Result Specifications Specification Status Comment HTML Living StandardThe definition of 'CanvasRenderingContext2D.getLineDash' in that specification. Living Standard ...
Document.timeline - Web APIs
Web › API › Document › timeline
The timeline readonly property of the Document interface represents the default timeline of the current document. This timeline is a special instance of DocumentTimeline that is automatically created on page load. This timeline is unique to each document and persists for the lifetime of the document including calls to Document.open(). The time values for this timeline are calculated as a fixed offset from the global clock such that the zero time corresponds to the navigationStart moment plus a signed delta known as the origin time. Prior to establishing the navigationStart moment, the document timeline is inactive. Note: A document timeline that is associated with a non-active document is also considered to be inactive. ...
...r this timeline are calculated as a fixed offset from the global clock such that the zero time corresponds to the navigationStart moment plus a signed delta known as the origin time. Prior to establishing the navigationStart moment, the document timeline is inactive. Note: A document timeline that is associated with a non-active document is also considered to be inactive. Syntax var pageTimeline = document.timeline; var thisMoment = pageTimeline.currentTime; Value A DocumentTimeline object. Specifications Specification Status Comment Web AnimationsThe definition of 'document.timeline' in that specification. Working Draft Editor's draft. ...
IdleDeadline.timeRemaining() - Web APIs
The timeRemaining() method on the IdleDeadline interface returns the estimated number of milliseconds remaining in the current idle period. The callback can call this method at any time to determine how much time it can continue to work before it must return. For example, if the callback finishes a task and has another one to begin, it can call timeRemaining() to see if there's enough time to complete the next task. If there isn't, the callback can just return immediately, or look for other work to do with the remaining time. By the time timeRemaining() reaches 0, it is suggested that the callback should return control to the user agent's event loop. ...
...shes a task and has another one to begin, it can call timeRemaining() to see if there's enough time to complete the next task. If there isn't, the callback can just return immediately, or look for other work to do with the remaining time. By the time timeRemaining() reaches 0, it is suggested that the callback should return control to the user agent's event loop. Syntax timeRemaining = IdleDeadline.timeRemaining(); Return value A DOMHighResTimeStamp value (which is a floating-point number) representing the number of milliseconds the user agent estimates are left in the current idle period. The value is ideally accurate to within about 5 microseconds. If the IdleDeadline object's didTimeout property is true, this method returns zero. Example See our complete example in the article Coop...
IdleDeadline - Web APIs
The IdleDeadline interface is used as the data type of the input parameter to idle callbacks established by calling Window.requestIdleCallback(). It offers a method, timeRemaining(), which lets you determine how much longer the user agent estimates it will remain idle and a property, didTimeout, which lets you determine if your callback is executing because its timeout duration expired. To learn more about how request callbacks work, see Collaborative Scheduling of Background Tasks. Properties IdleDeadline.didTimeout Read only A Boolean whose value is true if the callback is being executed because the timeout specified when the idle callback was installed has expired. ...
...s you determine if your callback is executing because its timeout duration expired. To learn more about how request callbacks work, see Collaborative Scheduling of Background Tasks. Properties IdleDeadline.didTimeout Read only A Boolean whose value is true if the callback is being executed because the timeout specified when the idle callback was installed has expired. Methods IdleDeadline.timeRemaining() Returns a DOMHighResTimeStamp, which is a floating-point value providing an estimate of the number of milliseconds remaining in the current idle period. If the idle period is over, the value is 0. Your callback can call this repeatedly to see if there's enough time left to do more work before returning. Example See our complete example in the article Cooperative Scheduling ...
OfflineAudioCompletionEvent - Web APIs
The Web Audio API OfflineAudioCompletionEvent interface represents events that occur when the processing of an OfflineAudioContext is terminated. The complete event implements this interface. Note: This interface is marked as deprecated; it is still supported for legacy reasons, but it will soon be superseded when the promise version of OfflineAudioContext.startRendering is supported in browsers, which will no longer need it. Constructor OfflineAudioCompletionEvent.OfflineAudioCompletionEvent Creates a new OfflineAudioCompletionEvent object instance. Properties Also inherits properties from its parent, Event. OfflineAudioCompletionEvent.renderedBuffer Read only An AudioBuffer containing the result of processing an OfflineAudioContext. Methods Inherits methods from its paren...
...w OfflineAudioCompletionEvent object instance. Properties Also inherits properties from its parent, Event. OfflineAudioCompletionEvent.renderedBuffer Read only An AudioBuffer containing the result of processing an OfflineAudioContext. Methods Inherits methods from its parent, Event. Specifications Specification Status Comment Web Audio APIThe definition of 'OfflineAudioCompletionEvent' in that specification. Working Draft ...
OfflineAudioContext.length - Web APIs
Specifications Specification Status Comment Web Audio APIThe definition of 'length' in that specification. ...
... Specifications Specification Status Comment Web Audio APIThe definition of 'length' in that specification. ...
OfflineAudioContext.resume() - Web APIs
}); Parameters None. Returns A Promise resolving to void. Exceptions The promise is rejected when the following exception is encountered. InvalidStateError if the context is not currently suspended or the rendering has not started. ...
...}); Parameters None. Returns A Promise resolving to void. Exceptions The promise is rejected when the following exception is encountered. InvalidStateError if the context is not currently suspended or the rendering has not started. ...
RTCIceCandidate.sdpMLineIndex - Web APIs
The read-only sdpMLineIndex property on the RTCIceCandidate interface is a zero-based index of the m-line describing the media associated with the candidate. This value is specified when creating the RTCIceCandidate by setting the corresponding sdpMLineIndex value in the RTCIceCandidateInit object when creating a new candidate with new RTCIceCandidate(). If you instead call RTCIceCandidate() with a string parameter containing the candidate m-line text, the value of sdpMLineIndex is extracted from the m-line. Syntax var sdpMLineIndex = RTCIceCandidate.sdpMLineIndex; Value A number containing a 0-based index into the set of m-lines providing media descriptions, indicating which media source is associated with the candidate, or null if no such association is available. Note: Attempting t...
...d from the m-line. Syntax var sdpMLineIndex = RTCIceCandidate.sdpMLineIndex; Value A number containing a 0-based index into the set of m-lines providing media descriptions, indicating which media source is associated with the candidate, or null if no such association is available. Note: Attempting to add a candidate (using addIceCandidate()) that has a value of null for either sdpMid or sdpMLineIndex will throw a TypeError exception. Example ... Specifications Specification Status Comment WebRTC 1.0: Real-time Communication Between BrowsersThe definition of 'RTCIceCandidate.sdpMLineIndex' in that specification. Candidate Recommendation Initial definition. ...
-moz-outline-radius-bottomright - CSS: Cascading Style Sheets
The calc() function may be used as well. Values <length> The radius of the circle defining the curvature of the bottom and right edges of the element, specified as a CSS <length>. <percentage> The radius of the circle defining the rounding of the bottom-right corner of the element, specified as the percentages of the bottom and right sides of the border box. ...
...tage> The radius of the circle defining the rounding of the bottom-right corner of the element, specified as the percentages of the bottom and right sides of the border box. Formal definition Initial value0Applies toall elementsInheritednoPercentagesrefer to the corresponding dimension of the border boxComputed valueas specifiedAnimation typea length, percentage or calc(); Formal syntax <outline-radius>where <outline-radius> = <length> | <percentage> Examples HTML <p>Look at this paragraph's bottom-right corner.</p> CSS p { margin: 5px; border: solid cyan; outline: dotted red; -moz-outline-radius-bottomright: 2em; } Result The example above will not display the desired effect if you are viewing this in a browser other than Firefox. Specifications Not part of any stan...
-moz-outline-radius-topleft - CSS: Cascading Style Sheets
The calc() function may be used as well. Values <length> The radius of the circle defining the curvature of the top and left edges of the element, specified as a CSS <length>. <percentage> The radius of the circle defining the rounding of the top-left corner of the element, specified as the percentages of the top and left sides of the border box. ...
... <percentage> The radius of the circle defining the rounding of the top-left corner of the element, specified as the percentages of the top and left sides of the border box. Formal definition Initial value0Applies toall elementsInheritednoPercentagesrefer to the corresponding dimension of the border boxComputed valueas specifiedAnimation typea length, percentage or calc(); Formal syntax <outline-radius>where <outline-radius> = <length> | <percentage> Examples The example below will not display the desired effect if you are viewing this in a browser other than Firefox. HTML <p>Look at this paragraph's top-left corner.</p> CSS p { margin: 5px; border: solid cyan; outline: dotted red; -moz-outline-radius-topleft: 2em; } Result Specifications Not part of any standard. ...
-moz-outline-radius-topright - CSS: Cascading Style Sheets
The calc() function may be used as well. Values <length> The radius of the circle defining the curvature of the top and right edges of the element, specified as a CSS <length>. <percentage> The radius of the circle defining the rounding of the top-right corner of the element, specified as the percentages of the top and right sides of the border box. ...
...percentage> The radius of the circle defining the rounding of the top-right corner of the element, specified as the percentages of the top and right sides of the border box. Formal definition Initial value0Applies toall elementsInheritednoPercentagesrefer to the corresponding dimension of the border boxComputed valueas specifiedAnimation typea length, percentage or calc(); Formal syntax <outline-radius>where <outline-radius> = <length> | <percentage> Examples HTML <p>Look at this paragraph's top-right corner.</p> CSS p { margin: 5px; border: solid cyan; outline: dotted red; -moz-outline-radius-topright: 2em; } Result The example above will not display the desired effect if you are viewing this in a browser other than Firefox. Specifications Not part of any standard. ...
overflow-inline - CSS: Cascading Style Sheets
Examples HTML <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam ac turpis eleifend, fringilla velit ac, aliquam tellus. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Nunc velit erat, tempus id rutrum sed, dapibus ut urna. Integer vehicula nibh a justo imperdiet rutrum. Nam faucibus pretium orci imperdiet sollicitudin. ...
...unc velit erat, tempus id rutrum sed, dapibus ut urna. Integer vehicula nibh a justo imperdiet rutrum. Nam faucibus pretium orci imperdiet sollicitudin. Nunc id facilisis dui. Proin elementum et massa et feugiat. Integer rutrum ullamcorper eleifend. Proin sit amet tincidunt risus. Sed nec augue congue eros accumsan tincidunt sed eget ex.</p> CSS p { white-space: nowrap; } @media (overflow-inline: scroll) { p { color: red; } } Result Specifications Specification Status Comment Media Queries Level 4The definition of 'overflow-inline' in that specification. Candidate Recommendation Initial definition. ...
Mobile-friendliness - Developer guides
What is Mobile Friendliness? Mobile friendliness can mean a multitude of things, depending on who you're talking to. It can be helpful to think of it in terms of three goals for improving your site's user experience: Presentation, Content, and Performance. Goal #1 (Presentation) "Make websites that work well on a variety of screen sizes." These days, users can access the web on devices in a wide range of form factors, including phones, tablets, and eReaders. Needless to say, a fixed-width, three-column layout filled with complex JavaScript animations and mouse-over effects is not going to look or feel quite right on a phone with a 2-inch-wide screen and a diminutive processor. A slimmed-down, linearized page layout with elements sized for a touchscreen would be much more appropriate. T...
...at may eliminate certain strategies as viable options. Approaches to mobile Web development The following approaches aim to achieve each of these goals by different means. Separate sites Responsive design A hybrid approach Original document information Originally published on 4 May, 2011 on the Mozilla Webdev blog as "Approaches to Mobile Web Development Part 1 - What is Mobile Friendliness?", by Jason Grlicky. ...
RegExp.prototype.multiline - JavaScript
The multiline property indicates whether or not the "m" flag is used with the regular expression. multiline is a read-only property of an individual regular expression instance. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Property attributes of RegExp.prototype.multiline Writable no Enumerable no Configurable yes Description The value of multiline is a Boolean and is true if the "m" flag was used; otherwise, false. The "m" flag indicates that a multiline input string should be treated as multiple lines. For example,...
... Enumerable no Configurable yes Description The value of multiline is a Boolean and is true if the "m" flag was used; otherwise, false. The "m" flag indicates that a multiline input string should be treated as multiple lines. For example, if "m" is used, "^" and "$" change from matching at only the start or end of the entire string to the start or end of any line within the string. You cannot change this property directly. Examples Using multiline var regex = new RegExp('foo', 'm'); console.log(regex.multiline); // true Specifications Specification ECMAScript (ECMA-262)The definition of 'RegExp.prototype.multiline' in that specification. ...
Pipeline operator (|>) - JavaScript
The experimental pipeline operator |> (currently at stage 1) pipes the value of an expression into a function. This allows the creation of chained function calls in a readable manner. The result is syntactic sugar in which a function call with a single argument can be written like this: let url = "%21" |> decodeURI; The equivalent call in traditional syntax looks like this: let url = decodeURI("%21"); Syntax expression |> function The value of the specified expression is passed into the function as its sole parameter. Parameters expression Any valid expression. function Any function. Examples Chaining function calls The pipeline operator can improve readability when chaining several functions. const double = (n) => n * 2; const increment = (n) => n + 1; // without pipelin...
...xpression is passed into the function as its sole parameter. Parameters expression Any valid expression. function Any function. Examples Chaining function calls The pipeline operator can improve readability when chaining several functions. const double = (n) => n * 2; const increment = (n) => n + 1; // without pipeline operator double(increment(double(double(5)))); // 42 // with pipeline operator 5 |> double |> double |> increment |> double; // 42 Specifications Specification Pipeline operatorThe definition of 'Pipeline operator' in that specification. ...
overline-position - SVG: Scalable Vector Graphics
The overline-position attribute represents the ideal vertical position of the overline. The overline position is expressed in the font's coordinate system. ...
... The overline-position attribute represents the ideal vertical position of the overline. The overline position is expressed in the font's coordinate system. ...
overline-thickness - SVG: Scalable Vector Graphics
The overline-thickness attribute represents the ideal thickness of the overline. The overline thickness is expressed in the font's coordinate system. ...
... The overline-thickness attribute represents the ideal thickness of the overline. The overline thickness is expressed in the font's coordinate system. ...
underline-position - SVG: Scalable Vector Graphics
<< SVG Attribute reference home The underline-position attribute represents the ideal vertical position of the underline. The underline position is expressed in the font's coordinate system. ...
... << SVG Attribute reference home The underline-position attribute represents the ideal vertical position of the underline. The underline position is expressed in the font's coordinate system. ...
underline-thickness - SVG: Scalable Vector Graphics
<< SVG Attribute reference home The underline-thickness attribute represents the ideal thickness of the underline. The underline thickness is expressed in the font's coordinate system. ...
... << SVG Attribute reference home The underline-thickness attribute represents the ideal thickness of the underline. The underline thickness is expressed in the font's coordinate system. ...
treelines - Archive of obsolete content
<< XUL Reference home treelines Type: boolean When set to true, lines are drawn connecting the lines in the tree; when false, the lines are not drawn. This is false by default. ...
multiline - Archive of obsolete content
<< XUL Reference home multiline Type: boolean If true, the textbox displays multiple lines. If the user presses Enter, a new line is started. If false, the textbox only allows entry of one line. ...
-ms-hyphenate-limit-lines - Archive of obsolete content
The -ms-hyphenate-limit-lines CSS property is a Microsoft extension specifying the maximum number of consecutive lines in an element that may be ended with a hyphenated word. Initial valueno-limitApplies toblock container elementsInheritedyesComputed valueas specifiedAnimation typediscrete Syntax Values no-limit Indicates that hyphenation is not limited based on the number of consecutive hyphenated lines. In the flow above the consecutive hyphenated lines limit would be an infinitely large positive number. <integer> Indicates the maximum number of successive hyphenated lines. For instance, if 2, then no more than 2 successive lines may end with a hyphenated word. If 0 then no lines may end with a hyphenated word. (Hyphenation is effectively disabled.) Negative values a...
ui.SpellCheckerUnderline
Type:string Default value:#ff0000 Exists by default: no Application support: Gecko 1.9.2 (Firefox 3.6 / Thunderbird 3.1 / Fennec 1.0) Status: Active; last updated 2012-02-21 Introduction: Pushed to Nightly on 2009-04-03 Bugs: bug 338209 Values A color code like #ff0000 for red. ...
AnimationPlaybackEvent.timelineTime - Web APIs
The timelineTime read-only property of the AnimationPlaybackEvent interface represents the time value of the animation's timeline at the moment the event is queued. This will be unresolved if the animation was not associated with a timeline at the time the event was generated or if the associated timeline was inactive. Value A number representing the current time in milliseconds, or null. Specifications Specification Status Comment Web AnimationsThe definition of 'AnimationPlaybackEvent.timelineTime' in that specification. Working Draft Editor's draft. ...
AnimationTimeline - Web APIs
The AnimationTimeline interface of the Web Animations API represents the timeline of an animation. This interface exists to define timeline features (inherited by DocumentTimeline and future timeline types) and is not itself directly used by developers. Anywhere you see AnimationTimeline, you should use DocumentTimeline or any other timeline type instead. Properties AnimationTimeline.currentTime Read only Returns the time value in milliseconds for this timeline or null if this timeline is inactive. Specifications Specification Status Comment Web AnimationsThe definition of 'AnimationTimeline' in that specification. Working Draft Editor's draft. ...
Document.onoffline - Web APIs
The Document.onoffline event handler is called when an offline is fired on the <body> element and bubbles up, when navigator.onLine property changes and becomes false. ...
ElementCSSInlineStyle - Web APIs
The ElementCSSInlineStyle mixin describes CSSOM-specific features common to the HTMLElement, SVGElement and MathMLElement interfaces. Each of these interfaces can, of course, add more features in addition to the ones listed below. Note: ElementCSSInlineStyle is a mixin and not an interface; you can't actually create an object of type ElementCSSInlineStyle. PropertiesstyleThe style property is used to get as well as set the inline style of an element. When getting, it returns a CSSStyleDeclaration object that contains a list of all styles properties for that element with values assigned for the attributes that are defined in the element's inline style attribute.MethodsThis interface has no methods. Specifications Specification Status Comment CSS Object Model...
NavigatorOnLine - Web APIs
The NavigatorOnLine interface contains methods and properties related to the connectivity status of the browser. There is no object of type NavigatorOnLine, but other interfaces, like Navigator or WorkerNavigator, implement it. Properties The NavigatorOnLine interface doesn't inherit any property. NavigatorOnLine.onLine Read only Returns a Boolean indicating whether the browser is working online. Methods The NavigatorOnLine interface neither implements, nor inherit any method. Specifications Specification Status HTML Living StandardThe definition of 'NavigatorOnLine' in that specification. Living Standard ...
OfflineAudioCompletionEvent.renderedBuffer - Web APIs
Specifications Specification Status Comment Web Audio APIThe definition of 'renderedBuffer' in that specification. Working Draft Initial definition. Browser Compatibility The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. ...
OfflineAudioContext.oncomplete - Web APIs
The oncomplete event handler of the OfflineAudioContext interface is called when the audio processing is terminated, that is when the complete event (of type OfflineAudioCompletionEvent) is raised. Syntax var offlineAudioCtx = new OfflineAudioContext(); offlineAudioCtx.oncomplete = function() { ... } Example When processing is complete, you might want to use the oncomplete handler the prompt the user that the audio can now be played, and enable the play button. 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. Working...
OfflineAudioContext.suspend() - Web APIs
The suspend() method of the OfflineAudioContext interface schedules a suspension of the time progression in the audio context at the specified time and returns a promise. This is generally useful at the time of manipulating the audio graph synchronously on OfflineAudioContext. Note that the maximum precision of suspension is the size of the render quantum and the specified suspension time will be rounded down to the nearest render quantum boundary. For this reason, it is not allowed to schedule multiple suspends at the same quantized frame. Also scheduling should be done while the context is not running to ensure the precise suspension. Syntax OfflineAudioContext.suspend(suspendTime).then(function() { ... }); Parameters suspendTime A double specifying the suspend time, in seconds. R...
RTCIceCandidateInit.sdpMLineIndex - Web APIs
The optional property sdpMLineIndex in the RTCIceCandidateInit dictionary specifies the value of the RTCIceCandidate object's sdpMLineIndex property. Value A number containing a 0-based index into the set of m-lines providing media descriptions, indicating which media source is associated with the candidate, or null if no such association is available. Note: Attempting to add a candidate (using addIceCandidate()) that has a value of null for either sdpMid or sdpMLineIndex will throw a TypeError exception. Example ... Specifications Specification Status Comment WebRTC 1.0: Real-time Communication Between BrowsersThe definition of 'RTCIceCandidateInit.sdpMLineIndex' in that specification. Candidate Recommendation Initial specification. ...
SecurityPolicyViolationEvent.lineNumber - Web APIs
The lineNumber read-only property of the SecurityPolicyViolationEvent interface is the line number in the document or worker at which the violation occurred. Syntax let lineNumber = violationEventInstance.lineNumber; Value A number representing the line number at which the violation occurred. Example document.addEventListener("securitypolicyviolation", (e) => { console.log(e.lineNumber); }); Specifications Specification Status Comment Content Security Policy Level 3The definition of 'lineNumber' in that specification. Working Draft Initial definition ...
TextMetrics.alphabeticBaseline - Web APIs
The read-only alphabeticBaseline property of the TextMetrics interface is a double giving the distance from the horizontal line indicated by the CanvasRenderingContext2D.textBaseline property to the alphabetic baseline of the line box, in CSS pixels. Examples const canvas = document.createElement('canvas'); const ctx = canvas.getContext('2d'); const text = ctx.measureText('foo'); // returns TextMetrics object text.alphabeticBaseline; // -0; Specifications Specification HTML Living StandardThe definition of 'TextMetrics.alphabeticBaseline' in that specification. ...
TextMetrics.hangingBaseline - Web APIs
The read-only hangingBaseline property of the TextMetrics interface is a double giving the distance from the horizontal line indicated by the CanvasRenderingContext2D.textBaseline property to the hanging baseline of the line box, in CSS pixels. Examples const canvas = document.createElement('canvas'); const ctx = canvas.getContext('2d'); const text = ctx.measureText('foo'); // returns TextMetrics object text.hangingBaseline; // 6.078125; Specifications Specification HTML Living StandardThe definition of 'TextMetrics.hangingBaseline' in that specification. ...
TextMetrics.ideographicBaseline - Web APIs
The read-only ideographicBaseline property of the TextMetrics interface is a double giving the distance from the horizontal line indicated by the CanvasRenderingContext2D.textBaseline property to the ideographic baseline of the line box, in CSS pixels. Examples const canvas = document.createElement('canvas'); const ctx = canvas.getContext('2d'); const text = ctx.measureText('foo'); // returns TextMetrics object text.ideographicBaseline; // -1.201171875; Specifications Specification HTML Living StandardThe definition of 'TextMetrics.ideographicBaseline' in that specification. ...
Window: offline event - Web APIs
The offline event of the Window interface is fired when the browser has lost access to the network and the value of Navigator.onLine switches to false. Bubbles No Cancelable No Interface Event Event handler property onoffline Examples // addEventListener version window.addEventListener('offline', (event) => { console.log("The network connection has been lost."); }); // onoffline version window.onoffline = (event) => { console.log("The network connection has been lost."); }; Specifications Specification Status HTML Living StandardThe definition of 'offline event' in that specification. Living Standard ...
Window.scrollByLines() - Web APIs
The Window.scrollByLines() method scrolls the document by the specified number of lines. Syntax window.scrollByLines(lines) Parameters lines is the number of lines to scroll the document by. It may be a positive or negative integer. Example <!-- Scroll up the document by 5 lines --> <button id="scroll-up" onclick="scrollByLines(-5);">Up 5 lines</button> <!-- Scroll down the document by 5 lines --> <button id="scroll-down" onclick="scrollByLines(5);">Down 5 lines</button> Specification This is not part of any specification. ...
WorkerGlobalScope.onoffline - Web APIs
The onoffline property of the WorkerGlobalScope interface represents an EventHandler to be called when the offline event occurs and bubbles through the Worker. Syntax self.onoffline = function() { ... }; 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. Living Standard ...
WorkerGlobalScope.ononline - Web APIs
The ononline property of the WorkerGlobalScope interface represents an EventHandler to be called when the online event occurs and bubbles through the Worker. Syntax self.ononline = function() { ... }; 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. Living Standard ...
XRRenderState.inlineVerticalFieldOfView - Web APIs
The inlineVerticalFieldOfView read-only property of the XRRenderState interface defines the angle of the field of view in radians used when computing projection matrices for "inline" XRSession objects. This option must be null for immersive sessions. Syntax var aDouble = XRRenderState.inlineVerticalFieldOfView; Value A Number. Specifications Specification Status Comment UnknownThe definition of 'XRRenderState.inlineVerticalFieldOfView' in that specification. Unknown Initial definition. ...
XRRenderState.inlineVerticalFieldOfView - Web APIs
The read-only inlineVerticalFieldOfView property of the XRRenderState interface returns the default vertical field of view for "inline" sessions and null for all immersive sessions. Syntax var inlineVerticalFieldOfView = xrRenderState.inlineVerticalFieldOfView; Value A Number for "inline" sessions, which represents the default field of view, and null for immersive sessions. Specifications Specification Status Comment WebXR Device APIThe definition of 'XRRenderState.inlineVerticalFieldOfView' in that specification. Working Draft Initial definition. ...
<code>: The Inline Code element - HTML: Hypertext Markup Language
Web › HTML › Element › code
s the HTMLSpanElement interface for this element. Attributes This element only includes the global attributes. Example A paragraph of text that includes <code>: <p>The function <code>selectAll()</code> highlights all the text in the input field so the user can, for example, copy or delete the text.</p> The output generated by this HTML looks like this: Notes To represent multiple lines of code, wrap the <code> element within a <pre> element. The <code> element by itself only represents a single phrase of code or line of code. A CSS rule can be defined for the code selector to override the browser's default font face. Preferences set by the user might take precedence over the specified CSS. Specifications Specification Status Comment HTML Living S...
<q>: The Inline Quotation element - HTML: Hypertext Markup Language
Web › HTML › Element › q
Most modern browsers implement this by surrounding the text in quotation marks. This element is intended for short quotations that don't require paragraph breaks; for long quotations use the <blockquote> element. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Content categories Flow content, phrasing content, palpable content. Permitted content Phrasing content. Tag omission None, both the starting and ending tag are mandatory. ...
Index - Web APIs
Web › API › Index
axis. 29 AddressErrors API, Address, AddressErrors, Dictionary, Errors, Interface, Payment Address, Payment Request, Payment Request API, Reference, payment, paymentAddress The AddressErrors dictionary is used by the Payment Request API to to report validation errors in a physical address (typically a billing address or a shipping address). 30 AddressErrors.addressLine API, AddressErrors, Error, Payment Request, Payment Request API, Property, Reference, Validation, addressLine, payment An object based on AddressErrors includes an addressLine property when validation of the address finds one or more errors in the array of strings in the address's addressLine. The returned string explains the error and should offer suggestions for how to correct it. ...
...rage between the current buffer and the last buffer the AnalyserNode processed, and results in a much smoother set of value changes over time. 62 Animation API, Animations, Experimental, Interface, Reference, Web Animations, waapi, web animations api The Animation interface of the Web Animations API represents a single animation player and provides playback controls and a timeline for an animation node or source. 63 Animation() API, Animation, Animations, Constructor, Experimental, Reference, web animations api The Animation() constructor of the Web Animations API returns a new Animation object instance. 64 Animation.cancel() API, Animation, Method, Reference, Web Animations, cancel, waapi, web animations api The Web Animations API...
...d animation, the animation will continue in reverse. 79 Animation.startTime API, Animation, Interface, Property, Reference, Web Animations, startTime, web animations api The Animation.startTime property of the Animation interface is a double-precision floating-point value which indicates the scheduled time when an animation's playback should begin. ...
...And 180 more matches
Applying styles and colors - Web APIs
<< PreviousNext >> In the chapter about drawing shapes, we used only the default line and fill styles. Here we will explore the canvas options we have at our disposal to make our drawings a little more attractive. You will learn how to add different colors, line styles, gradients, patterns and shadows to your drawings. Colors Up until now we have only seen methods of the drawing context. If we want to apply colors to a shape, there are two important properties we can use: fillStyle and strokeStyle. fillStyle = color Sets the style used when filling shapes. strokeStyle = color Sets the style for shapes' outlines. color is a string representing a CSS <color>, a gradient object, or a pattern object. We'll look at gradient and pattern objects later. By default, the str...
...We use the arc() method to draw circles instead of squares. function draw() { var ctx = document.getElementById('canvas').getContext('2d'); for (var i = 0; i < 6; i++) { for (var j = 0; j < 6; j++) { ctx.strokeStyle = 'rgb(0, ' + Math.floor(255 - 42.5 * i) + ', ' + Math.floor(255 - 42.5 * j) + ')'; ctx.beginPath(); ctx.arc(12.5 +...
... lineWidth = value Sets the width of lines drawn in the future. lineCap = type Sets the appearance of the ends of lines. lineJoin = type Sets the appearance of the "corners" where lines meet. miterLimit = value Establishes a limit on the miter when two lines join at a sharp angle, to let you control how thick the junctio...
...And 57 more matches
Index - Archive of obsolete content
ported as of Firefox 44 and no longer accepted for add-on submission, jpm should now be used instead. 135 cfx to jpm CFX, JPM, SDK, add-on A guide to working with jpm if you're already familiar with cfx. 136 console Add-on SDK Enables your add-on to log error, warning or informational messages. 137 jpm Add-on SDK, JPM jpm is a command-line tool that enables you to test, run, and package add-ons. 138 jpm-mobile ADB, Add-ons, JPM, Mobile, Testing, travis-ci The Node-based replacement for cfx --force-mobile. Enables you to run and test add-ons for Firefox Mobile (aka Fennec). 139 jpmignore JPM No summary! 140 package.json CommonJS, JPM, SDK, add-on, package.json The packag...
... 239 Extension Versioning, Update and Compatibility Add-ons, Extensions Add-ons should specify their versions using the Toolkit version format. As a rough overview this is a version string split by periods, some ex...
... 239 Extension Versioning, Update and Compatibility Add-ons, Extensions Add-ons should specify their versions using the Toolkit version format. As a rough overview this is a version string split by periods, some examples: 240 Extensions support in SeaMonkey 2 ...
...And 53 more matches
Index
ingly. The templates are usually closely aligned to definitions found in RFC documents. A data block described as DER is usually in ASN.1 format. You must know which data you are expecting, and use the correct template for parsing, based on the context of your software's interaction. Data described as PEM is a base64 encoded presentation of DER, usually wrapped between human readable BEGIN/END lines. NSS prefers the binary presentation, but is often capable to use base64 or ASCII presentations, especially when importing data from files. A recent development adds support for loading external PEM files that contain private keys, in a software library called nss-pem, which is separately available, but should eventually become a core part of NSS. Looking at the code level, NSS deals with blo...
...tion, you'll already have two layers, the basic NSPR layer and an SSL library layer. The Mozilla applications define a third layer where application specific processing is performed. You can find more details in the NSPR reference documents. NSS occassionally has to create outbound network connections, in addition to the connections requested by the application. Examples are retrieving OCSP (Online Certificate Status Protocol) information or downloading a CRL (Certificate Revocation List). However, NSS doesn't have an implementation to work with network proxies. If you must support proxies in your application, you are able to register your own implementation of an http request callback interface, and NSS can use your application code that supports proxies. When using hashing, encryption,...
...). Create a context handle while providing all the parameters required for the operation, then call an "update" function multiple times to pass subsets of the input to NSS. The data will be processed and either returned directly or sent to a callback function registered in the context. When done, you call a finalization function that will flush out any pending data and free the resources. This line is a placeholder for future sections that should explain how libpkix works and is designed. If you want to work with NSS, it's often helpful to use the command line utilities that are provided by the NSS developers. There are tools for managing NSS databases, for dumping or verifying certificates, for registering PKCS#11 modules with a database, for processing CMS encrypted/signed messages, et...
...And 38 more matches
Using CSS gradients - CSS: Cascading Style Sheets
Gradients can be used anywhere you would use an <image>, such as in backgrounds. ...
... Gradients can be used anywhere you would use an <image>, such as in backgrounds. ...
... Gradients can be used anywhere you would use an <image>, such as in backgrounds. ...
...And 36 more matches
SVG documentation index - SVG: Scalable Vector Graphics
Web › SVG › Index
s the distance from the origin to the top of accent characters, measured by a distance within the font coordinate system. 20 accumulate NeedsCompatTable, NeedsExample, SVG, SVG Attribute This attribute controls whether or not the animation is cumulative. ...
...characters, measured by a distance within the font coordinate system. 20 accumulate NeedsCompatTable, NeedsExample, SVG, SVG Attribute This attribute controls whether or not the animation is cumulative. 21 additive NeedsCompatTable, NeedsExample, SVG, SVG Attribute No summary! 22 alignment-baseline SVG, SVG Attribute The alignment-baseline attribute specifies how an object is aligned with respect to its parent. This property specifies which baseline of this element is to be aligned with the corresponding baseline of the parent. For example, this allows alphabetic baselines in Roman text to stay aligned across font size changes. It defaults to the baseline with the same name as the computed value of the alignment-baseline property. ...
... 24 amplitude NeedsCompatTable, SVG, SVG Attribute The amplitude attribute controls the amplitude of the gamma function of a component transfer element when its type attribute is gamma. ...
...And 33 more matches
Web Video Text Tracks Format (WebVTT) - Web APIs
ys to a <video>. WebVTT is a text based format, which must be encoded using UTF-8. Where you can use spaces you can also use tabs. There is also a small API available to represent and manage these tracks and the data needed to perform the playback of the text at the correct times. WebVTT files The MIME type of WebVTT is text/vtt. 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. 00:05.000 --> 00:09.000 - It will perforate your stomach. - You could die. WebVTT body The structure of a WebVTT consists of the following components, some of them optional, in this order: An optional byte order mark (BOM). The string "WEBVTT". An optional text header to the right of WEBVTT...
... could die. WebVTT body The structure of a WebVTT consists of the following components, some of them optional, in this order: An optional byte order mark (BOM). The string "WEBVTT". An optional text header to the right of WEBVTT. There must be at least one space after WEBVTT. You could use this to add a description to the file. You may use anything in the text header except newlines or the string "-->". A blank line, which is equivalent to two consecutive newlines. Zero or more cues or comments. Zero or more blank lines. Example 1 - Simplest possible WebVTT file WEBVTT Example 2 - Very simple WebVTT file with a text header WEBVTT - This file has no cues. Example 3 - Common WebVTT example with a header and cues WEBVTT - This file has cues. 14 00:01:14.815 -...
...:23.868 - [ Bats Screeching ] - They won't get in your hair. They're after the bugs. Inner structure of a WebVTT file Let's re-examine one of our previous examples, and look at the cue structure in a bit more detail. WEBVTT 00:01.000 --> 00:04.000 - Never drink liquid nitrogen. 00:05.000 --> 00:09.000 - It will perforate your stomach. - You could die. In the case of each cue: The first line is started with a time, which is the starting time for showing the text that appears underneath. On the same line, we then have a string of "-->". We finish the first line with a second time, which is the ending time for showing the associated text. We can then have one or more lines that start with a hyphen (-), each containing part of the text track to be shown. We can also place comments ...
...And 31 more matches
Drawing graphics - Learn web development
We have added a class to the <canvas> element so it will be easier to select if we have multiple canvases on the page, but we have removed the width and height attributes for now (you could add them back in if you wanted, but we will set them using JavaScript in a below section). Canvases with no explicit width and height default to 300 pixels wide by 150 pixels high. ...
... with no explicit width and height default to 300 pixels wide by 150 pixels high. Now add the following lines of JavaScript inside the <script> element: const canvas = document.querySelector('.myCanvas'); const width = canvas.width = window.innerWidth; const height = canvas.height = window.innerHeight; Here we have stored a reference to the canvas in the canvas constant. In the second line we set both a new constant width and the canvas' width property equal to Window.innerWidth (which gives us the viewport width). In the third line we set both a new constant height and the canvas' height property equal to Window.innerHeight (which gives us the viewport height). So now we have a canvas that fills the entire width and height of the browser window! You'll also see that we are chai...
... thing before we can consider our canvas template finished. To draw onto the canvas we need to get a special reference to the drawing area called a context. This is done using the HTMLCanvasElement.getContext() method, which for basic usage takes a single string as a parameter representing the type of context you want to retrieve. In this case we want a 2d canvas, so add the following JavaScript line below the others inside the <script> element: const ctx = canvas.getContext('2d'); Note: other context values you could choose include webgl for WebGL, webgl2 for WebGL 2, etc., but we won't need those in this article. So that's it -- our canvas is now primed and ready for drawing on! The ctx variable now contains a CanvasRenderingContext2D object, and all drawing operations on the canvas wi...
...And 28 more matches
Client-side storage - Learn web development
This article explains the very basics of how these work. ...
...gets, color scheme, or font size). Persisting previous site activity (e.g. storing the contents of a shopping cart from a previous session, remembering if a user was previously logged in). Saving data and assets locally so a site will be quicker (and potentially less expensive) to download, or be usable without a network connection. Saving web application generated documents locally for use offline Often client-side and server-side storage are used together. For example, you could download a batch of music files (perhaps used by a web game or music player application), store them inside a client-side database, and play them as needed. The user would only have to download the music files once -- on subsequent visits they would be retrieved from the database instead. Note: There are limit...
...for storing complex data. This can be used for things from complete sets of customer records to even complex data types like audio or video files. You'll learn more about these APIs below. The future: Cache API Some modern browsers support the new Cache API. This API is designed for storing HTTP responses to specific requests, and is very useful for doing things like storing website assets offline so the site can subsequently be used without a network connection. Cache is usually used in combination with the Service Worker API, although it doesn't have to be. 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. Storing simple data -- web storag...
...And 25 more matches
display - CSS: Cascading Style Sheets
Web › CSS › display
Formally, the display property sets an element's inner and outer display types. The outer type sets an element's participation in flow layout; the inner type sets the layout of children. Some values of display are fully defined in their own individual specifications; for example the detail of what happens when display: flex is declared is defined in the CSS Flexible Box Model specification. See the table at the end of this document for all of the individual specifications. Syntax The CSS display property is specified using keyword values. ...
...value categories: .container { display: [ <display-outside> || <display-inside> ] | <display-listitem> | <display-internal> | <display-box> | <display-legacy> ; } Outside <display-outside> These keywords specify the element's outer display type, which is essentially its role in flow layout. Valid <display-outside> values: block The element generates a block element box, generating line breaks both before and after the element when in the normal flow. inline The element generates one or more inline element boxes that do not generate line breaks before or after themselves. In normal flow, the next element will be on the same line if there is space run-in The element generates a run-in box. If the adjacent sibling of the element defined as display: run-in box is a block box,...
...ement when in the normal flow. inline The element generates one or more inline element boxes that do not generate line breaks before or after themselves. In normal flow, the next element will be on the same line if there is space run-in The element generates a run-in box. If the adjacent sibling of the element defined as display: run-in box is a block box, the run-in box becomes the first inline box of the block box that follows it. Run-in elements act like inlines or blocks, depending on the surrounding elements. That is: If the run-in box contains a block box, same as block. If a block box follows the run-in box, the run-in box becomes the first inline box of the block box. If an inline box follows, the run-in box becomes a block box. Note: Browsers that support the two value sy...
...And 24 more matches
Index - MDN Web Docs Glossary: Definitions of Web-related terms
for a given IP address). 8 ASCII Glossary, Infrastructure ASCII (American Standard Code for Information Interchange) is one of the most popular coding method used by computers for converting letters, numbers, punctuation and control codes into digital form. Since 2007, UTF-8 superseded it on the Web. 9 ATAG ATAG, Accessibility, Authoring Tool Accessibility Guidelines, Glossary ATAG (Authoring Tool Accessibility Guidelines) is a W3C recommendation for building accessible-authoring tools that produce accessible contents. 10 Abstraction Abstraction, Coding, CodingScripting, Glossary, Programming Language Abstraction in computer programming is a way to reduce complexity and allow efficient design and implementation in complex software ...
...gabits-per-second (Gbps). 27 Base64 Advanced, Base64, JavaScript, Typed Arrays, URI, URL, Unicode Problem, atob(), btoa() Base64 is a group of similar binary-to-text encoding schemes that represent binary data in an ASCII string format by translating it into a radix-64 representation. The term Base64 originates from a specific MIME content transfer encoding. 28 Baseline CSS, Glossary, SVG, alignment, typography The baseline is a term used in European and West Asian typography meaning an imaginary line upon which the characters of a font rest. 29 BiDi Accessibility, Glossary BiDi (BiDirectional) refers to a document containing both right-to-left and left-to-right text. Even when both directionalities occur in the same paragraph, the...
...ibrary in WebKit, which handles layout, rendering, and DOM, but now stands on its own as a separate rendering engine. 32 Block Disambiguation, Glossary The term block can have several meanings depending on the context. It may refer to: 33 Block (CSS) CSS, CodingScripting, Design, Glossary, HTML A block on a webpage is an HTML element that appears on a new line, i.e. underneath the preceding element in a horizontal writing mode, and above the following element (commonly known as a block-level element). For example, <p> is by default a block-level element, whereas <a> is an inline element -- you can put several links next to one another in your HTML source and they will sit on the same line as one another in the rendered output. 34 Block (scri...
...And 23 more matches
Positioning - Learn web development
y this out, add the following declarations to the .positioned rule in your CSS: top: 30px; left: 30px; Note: The values of these properties can take any units you'd logically expect -- pixels, mm, rems, %, etc. If you now save and refresh, you'll get a result something like this: <h1>Relative positioning</h1> <p>I am a basic block level element. ...
...cent block level elements sit on new lines below me.</p> <p class="positioned">By default we span 100% of the width of our parent element, and we are as tall as our child content. Our total width and height is our content + padding + border width/height.</p> <p>We are separated by our margins. Because of margin collapsing, we are separated by the width of one of our margins, not both.</p> <p>inline elements <span>like this one</span> and <span>this one</span> sit on the same line as one another, and adjacent text nodes, if there is space on the same line. ...
.... Our total width and height is our content + padding + border width/height.</p> <p>We are separated by our margins. Because of margin collapsing, we are separated by the width of one of our margins, not both.</p> <p>inline elements <span>like this one</span> and <span>this one</span> sit on the same line as one another, and adjacent text nodes, if there is space on the same line. ...
...And 23 more matches
Border-image generator - CSS: Cascading Style Sheets
<div class="property right"> <div class="name">section height</div> <div class="ui-input-slider" data-topic="preview-area-height" data-min="400" data-max="1000"> </div> </div> </div> <div id="preview_section" class="group section"> <div id="subject"> <div class="guideline" data-axis="Y" data-topic="slice-top"></div> <div class="guideline" data-axis="X" data-topic="slice-right"></div> <div class="guideline" data-axis="Y" data-topic="slice-bottom"></div> <div class="guideline" data-axis="X" data-topic="slice-left"></div> </div> <div id="preview"> </div> </div> <!-- controls --> ...
...====================================== */ .col { display: block; float:left; margin: 1% 0 1% 1.6%; } .col:first-child { margin-left: 0; } /* all browsers except IE6 and lower */ /* * UI Component */ .ui-input-slider { height: 20px; font-family: "Segoe UI", Arial, Helvetica, sans-serif; -moz-user-select: none; user-select: none; } .ui-input-slider * { float: left; height: 100%; line-height: 100%; } /* Input Slider */ .ui-input-slider > input { margin: 0; padding: 0; width: 50px; text-align: center; -moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box; } .ui-input-slider-info { width: 90px; padding: 0px 10px 0px 0px; text-align: right; text-transform: lowercase; } .ui-input-slider-left, .ui-input-slider-right { width: 16px; cur...
...9/arrows.png") center left no-repeat; } .ui-input-slider-right { background: url("https://mdn.mozillademos.org/files/5679/arrows.png") center right no-repeat; } .ui-input-slider-name { width: 90px; padding: 0 10px 0 0; text-align: right; text-transform: lowercase; } .ui-input-slider-btn-set { width: 25px; background-color: #2C9FC9; border-radius: 5px; color: #FFF; font-weight: bold; line-height: 14px; text-align: center; } .ui-input-slider-btn-set:hover { background-color: #379B4A; cursor: pointer; } /*************************************************************************************/ /*************************************************************************************/ /* * UI DropDown */ /* Dropdown */ .ui-dropdown { height: 2em; width: 120px; font-family: "Sego...
...And 22 more matches
source-editor.jsm
olean redo(); void resetUndo(); void startCompoundChange(); Boolean undo(); Display management operations void focus(); Number getTopIndex(); Boolean hasFocus(); void setTopIndex(Number aTopIndex); Content management operations Number getCharCount(); String getIndentationString(); String getLineDelimiter(); Number getLineCount(); Number getLineEnd(Number aLineIndex, Boolean aIncludeDelimiter); Number getLineStart(Number aLineIndex); String getMode(); String getText([optional] Number aStart, [optional] Number aEnd); String getSelectedText(); void setMode(String aMode); void setText(String aText, [optional] Number aS...
... String getSelectedText(); void setMode(String aMode); void setText(String aText, [optional] Number aStart, [optional] Number aEnd); Selection operations void dropSelection(); Number getCaretOffset(); Object getCaretPosition(); Object getSelection(); void setCaretOffset(Number aOffset); void setCaretPosition(Number aLine, [optional] Number aColumn, [optional] Number aAlign); void setSelection(Number aStart, Number aEnd); Breakpoint management void addBreakpoint(Number aLineIndex, [optional] String aCondition); Array getBreakpoints(); Boolean removeBreakpoint(Number aLineIndex); Properties Attribute Type Description dirty Boolean ...
... Configuration defaults constants These constants represent the default values for each of the available configuration options. See The editor configuration object for details on configuring the editor. ...
...And 21 more matches
Hacking Tips
lp on just the members of that "namespace". Getting the bytecode of a function (from JS shell) The shell has a small function named dis to dump the bytecode of a function with its source notes. Without arguments, it will dump the bytecode of its caller. js> function f () { return 1; } js> dis(f); flags: loc op ----- -- main: 00000: one 00001: return 00002: stop Source notes: ofs line pc delta desc args ---- ---- ----- ------ -------- ------ 0: 1 0 [ 0] newline 1: 2 0 [ 0] colspan 2 3: 2 2 [ 2] colspan 9 Getting the bytecode of a function (from gdb) In jsopcode.cpp, a function named js::DisassembleAtPC can print the bytecode of a script. Some variants of this function such as js::DumpScript etc are convenient for debugging. Printi...
...variants of this function such as js::DumpScript etc are convenient for debugging. Printing the JS stack (from gdb) In jsobj.cpp, a function named js::DumpBacktrace prints a backtrace a la gdb for the JS stack. The backtrace contains in the following order, the stack depth, the interpreter frame pointer (see js/src/vm/Stack.h, StackFrame class) or (nil) if compiled with IonMonkey, the file and line number of the call location and under parentheses, the JSScript pointer and the jsbytecode pointer (pc) executed. $ gdb --args js [...] (gdb) b js::ReportOverRecursed (gdb) r js> function f(i) { if (i % 2) f(i + 1); else f(i + 3); } js> f(0) Breakpoint 1, js::ReportOverRecursed (maybecx=0xfdca70) at /home/nicolas/mozilla/ionmonkey/js/src/jscntxt.cpp:495 495 if (maybecx) (gdb) call j...
...p(argc, vp); (gdb) enable unwinder .* SpiderMonkey (gdb) backtrace 10 #0 0x0000000000f89979 in js::math_cos(JSContext*, unsigned int, JS::Value*) (cx=0x14f2640, argc=1, vp=0x7fffffff6a88) at js/src/jsmath.cpp:338 #1 0x0000000000ca9c6e in js::CallJSNative(JSContext*, bool (*)(JSContext*, unsigned int, JS::Value*), JS::CallArgs const&) (cx=0x14f2640, native=0xf89960 , args=...) at js/src/jscntxtinlines.h:235 #2 0x0000000000c87625 in js::Invoke(JSContext*, JS::CallArgs const&, js::MaybeConstruct) (cx=0x14f2640, args=..., construct=js::NO_CONSTRUCT) at js/src/vm/Interpreter.cpp:476 #3 0x000000000069bdcf in js::jit::DoCallFallback(JSContext*, js::jit::BaselineFrame*, js::jit::ICCall_Fallback*, uint32_t, JS::Value*, JS::MutableHandleValue) (cx=0x14f2640, frame=0x7fffffff6ad8, stub_=0x1798838, ar...
...And 21 more matches
Adapting to the new two-value syntax of display - CSS: Cascading Style Sheets
he display property, which is part of the CSS Display Module Level 3. This guide explains the change to the syntax, including the reasoning behind this change. It also details the in-built backwards compatibility for the display property. What happens when we change the value of the display property? One of the first things we learn about CSS is that some elements are block-level and some are inline-level. For example, an <h1> or a <p> are block-level by default, and a <span> is inline-level. Using the display property we can switch between block and inline. For example to make a heading inline we would use the following CSS: h1 { display: inline; } More recently we have gained CSS Grid Layout and Flexbox. To access these we also use values of the display property -- display: grid and ...
... do the children become flex or grid items and begin to respond to the other properties in the grid or flexbox specifications. Changing an element's display value changes the formatting context of its direct children. What grid and flexbox demonstrate, however, is that an element has both an outer and an inner display type. The outer display type describes whether the element is block-level or inline-level. The inner display type describes how the children of that box behave. As an example, when we use display: flex we create a block-level container, with flex children. The children are described as participating in a flex formatting context. You can see this if you take a <span> -- normally an inline-level element -- and apply display: flex to it. The <span> becomes a block-level element. I...
...apply display: flex to it. The <span> becomes a block-level element. It behaves as block-level things do in relationship to other boxes in the layout. It's as if you had applied display: block to the span, however we also get the changed behavior of the children. The live example below has a <span> with display: flex applied. It has become a block-level box taking up all available space in the inline direction. You can now use justify-content: space-between; to put this space between the two flex items. We can create inline flex containers. If you create a flex container using the single value of inline-flex you will have an inline-level box with flex children. The children behave in the same way as the flex children of a block-level container. The only thing that has changed is that the p...
...And 21 more matches
HTML documentation index - HTML: Hypertext Markup Language
Web › HTML › Index
olor With CSS, there are lots of ways to add color to your HTML elements to create just the look you want. This article is a primer introducing each of the ways CSS color can be used in HTML. 4 Block-level elements Beginner, Development, Guide, HTML, HTML5, Web HTML (Hypertext Markup Language) elements historically were categorized as either "block-level" elements or "inline-level" elements. By default, a block-level element occupies the entire space of its parent element (container), thereby creating a "block." This article helps to explain what this means. 5 DASH Adaptive Streaming for HTML 5 Video Guide, HTML, HTML5 Dynamic Adaptive Streaming over HTTP (DASH) is an adaptive streaming protocol. 6 Date and time formats used in HTML ...
...ist of all the available HTML documentation. 54 HTML elements reference Basic, Element, HTML, Reference, Web, l10n:priority This page lists all the HTML elements, which are created using tags. 55 <a>: The Anchor element Content, Element, HTML, HTML text-level semantics, HTML:Flow content, HTML:Interactive content, HTML:Palpable Content, HTML:Phrasing content, Inline element, Reference, Web The HTML <a> element (or anchor element), with its href attribute, creates a hyperlink to web pages, files, email addresses, locations in the same page, or anything else a URL can address. 56 <abbr>: The Abbreviation element Acronym, Definitions, Element, HTML, HTML text-level semantics, HTML:Flow content, HTML:Palpable Content, HTML:Phrasing content, ...
...he quotation may be given using the cite attribute, while a text representation of the source can be given using the <cite> element. 73 <body>: The Document Body element Element, HTML, Reference, Sectioning Root Element, Sections, Web The HTML <body> Element represents the content of an HTML document. There can be only one <body> element in a document. 74 <br>: The Line Break element Element, HTML, HTML text-level semantics, Reference, Web The HTML <br> element produces a line break in text (carriage-return). It is useful for writing a poem or an address, where the division of lines is significant. 75 <button>: The Button element Element, Forms, HTML, HTML forms, Reference, Web The HTML <button> element represents a clickable butto...
...And 21 more matches
Mozilla’s UAAG evaluation report
software that renders web content. The UAAG is not the basis for any government accessibility regulations at this time. This document is based on the September 12, 2001 Candidate Recommendation of UAAG 1.0. This may be different from the most recent version, check for updates on the User Agent Working Group home page. Look to the "techniques" document for real-world implementation examples of each checkpoint. This UAAG evaluation report covers nightly builds of the Mozilla web browser itself, running on Windows 2000, as of February 20, 2002. ...
...Support input and output device-independence. Checkpoint Title Status Notes/plans 1.1 Full keyboard access. (P1) VG We have some remaining bugs, and some keyboard usability issues, but in general Mozilla now has keyboard equivalents for almost everything. Most browsers do not allow the user to select text with the keyboard alone. We intend to do this with a...
...t everything. Most browsers do not allow the user to select text with the keyboard alone. We intend to do this with a caret browsing feature. 1.2 Activate event handlers. (P1) P onMouseOver, onMouseDown, onMouseUp, onMouseMove, onClick, onDBClick: no keyboard support onFocus and onBlur: Cannot be activated with pointer 1.3 Provide text messages. (P1) C Status line and alert boxes used to convey messages and alerts Guideline 2. Ensure user access to all content. Checkpoint Title Status Notes/plans Checkpoint Title Status Notes/plans 2.1 Render content according to specification. (P1) VG Renders HTML, CSS, and a number of graphic image formats. Does not contradict current specifications for HTML ...
...And 20 more matches
Python binding for NSS
bjects or Python unicode objects. If a Python unicode object is passed to a NSS/NSPR function it will be encoded as UTF-8 first before being passed to NSS/NSPR. python-nss tries to be flexible when generating a print representation of complex objects. For simplicity you can receive a block of formatted text but if you need more control, such as when building GUI elments you can access a list of "lines", each line is paired with an indentation level value. The (indent, text) pairs allow you to insert the item into a GUI tree structure or simply change the indentation formatting. Deprecated elements of the python-nss API are marked with Python deprecation warnings as well as being documented in the nss module documentation. As of Python 2.7 deprecation warnings are no longer reported by defaul...
... Release 1.0.0 Release Date 2016-09-01 SCM Tag PYNSS_RELEASE_1_0_0 Source Download https://ftp.mozilla.org/pub/mozilla.org/security/python-nss/releases/PYNSS_RELEASE_1_0_0/src/ Change Log Official 1.0.0 release, only minor tweaks from the 1.0.0beta1 release. Allow custom include root in setup.py as command line arg. Add TLS chacha20 poly1305 constants. Remove checks for whether a socket is open for reading. It's not possible for the binding to know in all cases, especially if the socket is created from an xternal socket passed in. The following module functions were added: nss.get_all_tokens The following constants were added: ssl.TLS_ECDHE_RS...
... Change Log The primary enhancement in this version is adding support for PBKDF2 The following module functions were added: nss.create_pbev2_algorithm_id The following class methods were added: nss.AlgorithmID.get_pbe_crypto_mechanism nss.AlgorithmID.get_pbe_iv nss.PK11Slot.pbe_key_gen nss.PK11Slot.format_lines nss.PK11Slot.format nss.Pk11SymKey.format_lines nss.Pk11SymKey.format nss.SecItem.to_base64 nss.SecItem.format_lines nss.SecItem.format The following files were added: doc/examples/pbkdf2_example.py The SecItem constructor added 'ascii' parameter to permit initialization from base64 and/or PEM textual dat...
...And 19 more matches
How whitespace is handled by HTML, CSS, and in the DOM - Web APIs
The presence of whitespace in the DOM can cause layout problems and make manipulation of the content tree difficult in unexpected ways, depending on where it is located. This article explores when difficulties can occur, and looks at what can be done to mitigate resulting problems. What is whitespace? Whitespace is any string of text composed only of spaces, tabs or line breaks (to be precise, CRLF sequences, carriage returns or line feeds). These characters allow you to format your code in a way that will make it easily readable by yourself and other people. In fact, much of our source code is full of these whitespace characters, and we only tend to get rid of it in a production build step to reduce code download sizes. HTML largely ignores whitespace? In the case of HTML, whitespace is ...
... to reduce code download sizes. HTML largely ignores whitespace? In the case of HTML, whitespace is largely ignored -- whitespace in between words is treated as a single character, and whitespace at the start and end of elements and outside elements is ignored. Take the following minimal example: <!DOCTYPE html> <h1> Hello World! </h1> This source code contains a couple of line feeds after the DOCTYPE and a bunch of space characters before, after, and inside the <h1> element, but the browser doesn't seem to care at all and just shows the words "Hello World!" as if these characters didn't exist at all: This is so that whitespace characters don't impact the layout of your page. Creating space around and inside elements is the job of CSS. What does happen to whitespac...
...t decide which whitespace characters are useful and which aren't -- these are specified at least in part in CSS Text Module Level 3, and especially the parts about the CSS white-space property and whitespace processing details, but we also offer an easier explanation below. Let's take another really simple example. ...
...And 19 more matches
Styling links - Learn web development
n this page are fake links -- a # (hash, or pound sign) is put in place of the real URL. This is because if the real links were included, clicking on them would break the examples (you'd end up with an error, or a page loaded in the embedded example that you couldn't get back from.) # just links to the current page. ...
...ld break the examples (you'd end up with an error, or a page loaded in the embedded example that you couldn't get back from.) # just links to the current page. You'll notice a few things as you explore the default styles: Links are underlined. Unvisited links are blue. Visited links are purple. Hovering a link makes the mouse pointer change to a little hand icon. ...
...days of browsers in the mid-1990s. This is because users know and have come to expect this behaviour -- if links were styled differently, it would confuse a lot of people. This doesn't mean that you shouldn't style links at all, just that you should not stray too far from the expected behaviour. You should at least: Use underlining for links, but not for other things. ...
...And 18 more matches
nsIMsgDatabase
oid DeleteMessage(in nsMsgKey key, in nsIDBChangeListener instigator, in boolean commit); void DeleteHeader(in nsIMsgDBHdr msgHdr, in nsIDBChangeListener instigator,in boolean commit, in boolean notify); void RemoveHeaderMdbRow(in nsIMsgDBHdr msgHdr); void UndoDelete(in nsIMsgDBHdr msgHdr); void MarkMarked(in nsMsgKey key, in boolean mark, in nsIDBChangeListener instigator); void MarkOffline(in nsMsgKey key, in boolean offline, in nsIDBChangeListener instigator); void SetLabel(in nsMsgKey key, in nsMsgLabelValue label); void setStringProperty(in nsMsgKey aKey, in string aProperty, in string aValue); void MarkImapDeleted(in nsMsgKey key, in boolean deleted, in nsIDBChangeListener instigator); void applyRetentionSettings(in nsIMsgRetentionSettings aMsgRetentionSettings, in bool...
...Key, in string aProperty, in string aValue); void MarkImapDeleted(in nsMsgKey key, in boolean deleted, in nsIDBChangeListener instigator); void applyRetentionSettings(in nsIMsgRetentionSettings aMsgRetentionSettings, in boolean aDeleteViaFolder); boolean HasNew(); void ClearNewList(in boolean notify); void AddToNewList(in nsMsgKey key); void StartBatch(); void EndBatch(); nsIMsgOfflineImapOperation GetOfflineOpForKey(in nsMsgKey messageKey, in boolean create); void RemoveOfflineOp(in nsIMsgOfflineImapOperation op); nsISimpleEnumerator EnumerateOfflineOps(); void ListAllOfflineOpIds(in nsMsgKeyArrayPtr offlineOpIds); Native code only! void ListAllOfflineDeletes(in nsMsgKeyArrayPtr offlineDeletes); Native code only! void ListAllOfflineMsgs(in nsMsgKeyArrayPtr offlineMsg...
...hFolderUri, in nsIMsgDBHdr aHdr); Attributes Attribute Type Description dBFolderInfo nsIDBFolderInfo Readonly: FirstNew nsMsgKey Readonly: msgRetentionSettings nsIMsgRetentionSettings msgDownloadSettings nsIMsgDownloadSettings lowWaterArticleNum nsMsgKey Readonly: highWaterArticleNum nsMsgKey Readonly: nextPseudoMsgKey nsMsgKey For undo-redo of move pop->imap. nextFakeOfflineMsgKey nsMsgKey Readonly: For saving "fake" offline msg hdrs. defaultViewFlags nsMsgViewFlagsTypeValue Readonly: defaultSortType nsMsgViewSortTypeValue Readonly: defaultSortOrder nsMsgViewSortOrderValue Readonly: msgHdrCacheSize unsigned long folderStream nsIOutputStream summaryValid boolean Methods Open() Opens a database folder. void Open(in nsILocalFile aFolderName, ...
...And 18 more matches
d - SVG: Scalable Vector Graphics
Web › SVG › Attribute › d
,60 50,90 Q 10,60 10,30 z" /> </svg> path For <path>, d is a string containing a series of path commands that define the path to be drawn. Value <string> Default value none Animatable Yes glyph Warning: As of SVG2 <glyph> is deprecated and shouldn't be used. For <glyph>, d is a string containing a series of path commands that define the outline shape of the glyph. Value <string> Default value none Animatable Yes Note: The point of origin (the coordinate 0,0) is usually the upper left corner of the context. However the <glyph> element has its origin in the bottom left corner of its letterbox. missing-glyph Warning: As of SVG2 <missing-glyph> is deprecated and shouldn't be used. For <missing-...
...e Animatable Yes Note: The point of origin (the coordinate 0,0) is usually the upper left corner of the context. However the <glyph> element has its origin in the bottom left corner of its letterbox. missing-glyph Warning: As of SVG2 <missing-glyph> is deprecated and shouldn't be used. For <missing-glyph>, d is a string containing a series of path commands that define the outline shape of the glyph. Value <string> Default value none Animatable Yes Path commands Path commands are instructions that define a path to be drawn. Each command is composed of a command letter and numbers that represent the command parameters. SVG defines 6 types of path commands, for a total of 20 commands: MoveTo: M, m LineTo: L, l, H, h, V, v Cu...
...gles will be anti-clockwise; absolute negative x and y values are interpreted as negative coordinates; relative negative x values move to the left, and relative negative y values move upwards. MoveTo path commands MoveTo instructions can be thought of as picking up the drawing instrument, and setting it down somewhere else--in other words, moving the current point (Po; {xo, yo}). There is no line drawn between Po and the new current point (Pn; {xn, yn}). Command Parameters Notes M (x, y)+ Move the current point to the coordinate x,y. Any subsequent coordinate pair(s) are interpreted as parameter(s) for implicit absolute LineTo (L) command(s) (see below). Formula: Pn = {x, y} m (dx, dy)+ Move the current point by shifting the...
...And 18 more matches
Using XML Data Islands in Mozilla - Archive of obsolete content
This feature is not based on multi-vendor Web standards and is not supported in Firefox (or other non-IE browsers). XML data islands are no longer supported from Internet Explorer 10 onwards. HTML5 has a more general feature called "data blocks" that can carry almost any textual data, including XML. JavaScript can use the content of a <script> element as a data block if the src attribute is omitted and the type attribute does not specify an executable script type. ...
... does not specify an executable script type. When putting XML in a data block, you need to make sure that the XML content you are embedding does not have an end tag that case-insensitively matches "</script>". ...
... executable script type. When putting XML in a data block, you need to make sure that the XML content you are embedding does not have an end tag that case-insensitively matches "</script>". ...
...And 17 more matches
The box model - Learn web development
and the terminology that relates to it. Prerequisites: Basic computer literacy, basic software installed, basic knowledge of working with files, HTML basics (study Introduction to HTML), and an idea of how CSS works (study CSS first steps.) Objective: To learn about the CSS Box Model, what makes up the box model and how to switch to the alternate model. ...
...omputer literacy, basic software installed, basic knowledge of working with files, HTML basics (study Introduction to HTML), and an idea of how CSS works (study CSS first steps.) Objective: To learn about the CSS Box Model, what makes up the box model and how to switch to the alternate model. Block and inline boxes In CSS we broadly have two types of boxes -- block boxes and inline boxes. These characteristics refer to how the box behaves in terms of page flow, and in relation to other boxes on the page: If a box is defined as a block, it will behave in the following ways: The box will break onto a new line. The box will extend in the inline direction to fill the space available in its container. In most cases this means that the box will become as wide as its containe...
...ew line. The box will extend in the inline direction to fill the space available in its container. In most cases this means that the box will become as wide as its container, filling up 100% of the space available. The width and height properties are respected. Padding, margin and border will cause other elements to be pushed away from the box Unless we decide to change the display type to inline, elements such as headings (e.g. <h1>) and <p> all use block as their outer display type by default. If a box has an outer display type of inline, then: The box will not break onto a new line. The width and height properties will not apply. Vertical padding, margins, and borders will apply but will not cause other inline boxes to move away from the box. Horizontal padding, margins, and bor...
...And 17 more matches
What went wrong? Troubleshooting JavaScript - Learn web development
our browser, follow the previous link to find out how). What's even more useful is that the console gives you error messages whenever a syntax error exists inside the JavaScript being fed into the browser's JavaScript engine. Now let's go hunting. Go to the tab that you've got number-game-errors.html open in, and open your JavaScript console. You should see an error message along the following lines: This is a pretty easy error to track down, and the browser gives you several useful bits of information to help you out (the screenshot above is from Firefox, but other browsers provide similar information). From left to right, we've got: A red "x" to indicate that this is an error. An error message to indicate what's gone wrong: "TypeError: guessSubmit.addeventListener is not a func...
...ndicate that this is an error. An error message to indicate what's gone wrong: "TypeError: guessSubmit.addeventListener is not a function" A "Learn More" link that links through to an MDN page that explains what this error means in greater detail. The name of the JavaScript file, which links through to the Debugger tab of the developer tools. ...
...essage to indicate what's gone wrong: "TypeError: guessSubmit.addeventListener is not a function" A "Learn More" link that links through to an MDN page that explains what this error means in greater detail. The name of the JavaScript file, which links through to the Debugger tab of the developer tools. If you follow this link, you'll see the exact line where the error is highlighted. ...
...And 17 more matches
nsIMsgHeaderParser
ser.idlScriptable ??? Add brief description of Interface ??? ...
...ce ??? ...
... To create an instance, use: var msgHeaderParser = Components.classes["@mozilla.org/messenger/headerparser;1"] .createInstance(Components.interfaces.nsIMsgHeaderParser); Method overview string extractHeaderAddressMailboxes(in string line); void extractHeaderAddressName(in string line, out string name); void extractHeaderAddressNames(in string line, out string userNames); AString makeFullAddress(in AString aName, in AString aAddress); string makeFullAddressString(in string aName, in string aAddress); wstring makeFullAddressWString(in wstring name, in wstring addr); Obsolete since Gecko 1.9 void parseHeaderAddresses(in string line, out string names, out string addresses, out PRUint32 numAddresses); ...
...And 16 more matches
Drawing shapes with canvas - Web APIs
Working with paths is essential when drawing objects onto the canvas and we will see how that can be done. The grid Before we can start drawing, we need to talk about the canvas grid or coordinate space. ...
... corner of the blue square becomes x pixels from the left and y pixels from the top, at coordinate (x,y). Later in this tutorial we'll see how we can translate the origin to a different position, rotate the grid and even scale it, but for now we'll stick to the default. ...
... clearRect(x, y, width, height) Clears the specified rectangular area, making it fully transparent. Each of these three functions takes the same parameters. x and y specify the position on the canvas (relative to the origin) of the top-left corner of the rectangle. width and height provide the rectangle's size. ...
...And 16 more matches
Lexical grammar - JavaScript
ECMAScript also defines certain keywords and literals and has rules for automatic insertion of semicolons to end statements. Control characters Control characters have no visual representation but are used to control the interpretation of the text. ...
...e characters are usually unnecessary for the functionality of the code. Minification tools are often used to remove whitespace in order to reduce the amount of data that needs to be transferred. White space characters Code point Name Abbreviation Description Escape sequence U+0009 Character tabulation <HT> Horizontal tabulation \t U+000B Line tabulation <VT> Vertical tabulation \v U+000C Form feed <FF> Page breaking control character (Wikipedia). \f U+0020 Space <SP> Normal space U+00A0 No-break space <NBSP> Normal space, but no point at which a line may break Others Other Unicode space characters <USP> Spaces in Unicode on Wikipedia ...
...tabulation <VT> Vertical tabulation \v U+000C Form feed <FF> Page breaking control character (Wikipedia). ...
...And 16 more matches
Index - Archive of obsolete content
Archive › Mozilla › XUL › Index
ike Firefox. 2 &lt;statusbarpanel&gt; Deprecated, XUL, XUL Elements, XUL Reference An individual element of a statusbar. This is a special type of button which is drawn differently. Unlike normal buttons, a statusbarpanel can only have a label or an image but not both. This element is often used with a short label or icon to indicate status, for instance whether the user is online or whether there are new messages. 3 A XUL Bestiary Add-ons, Extensions, NeedsTechnicalReview, XUL This XULNote presents some of the key concepts and terms in the XUL development environment. The purpose of this article is not to describe these items in any great detail but to define what they are in simple terms. I selected items for this group because they seemed to be eith...
...a context for understanding Mozilla's new technologies -- and in particular Mozilla's XML-based User Interface Language, XUL. 4 Accessibility/XUL Accessibility Reference Accessibility, XUL This table is designed to show how to expose text properly for various XUL element types. Sections in bold are to draw attention to pieces that are often overlooked for visual layouts. Underlined text may be read by the screen reader. 5 Attribute (XUL) XUL Attributes, XUL Reference No summary! 6 Flexgroup "flexgroup" is used to group flexible elements together and should be set to an integer. Elements with a lower flexgroup are flexed first. When those elements have reached their maximum sizes, the elements with the next higher flexgroup are fle...
...p XUL Attributes, XUL Reference No summary! 197 minwidth XUL Attributes, XUL Reference No summary! 198 mode No summary! 199 modifiers XUL Attributes, XUL Reference No summary! 200 mousethrough XUL Attributes, XUL Reference No summary! 201 movetoclick No summary! 202 multiline XUL Attributes, XUL Reference No summary! 203 multiple XUL Attributes, XUL Reference No summary! 204 name XUL Attributes, XUL Reference No summary! 205 negate XUL Attributes, XUL Reference No summary! 206 newlines XUL Attributes, XUL Reference No summary! 207 next XUL Attributes, XUL Refer...
...And 15 more matches
Fundamental text and font styling - Learn web development
Prerequisites: Basic computer literacy, HTML basics (study Introduction to HTML), CSS basics (study Introduction to CSS). ...
...n the fundamental properties and techniques needed to style text on web pages. What is involved in styling text in CSS? As you'll have already experienced in your work with HTML and CSS, text inside an element is laid out inside the element's content box. It starts at the top left of the content area (or the top right, in the case of RTL language content), and flows towards the end of the line. Once it reaches the end, it goes down to the next line and continues, then the next line, until all the content has been placed in the box. Text content effectively behaves like a series of inline elements, being laid out on lines adjacent to one another, and not creating line breaks until the end of the line is reached, or unless you force a line break manually using the <br> element. Note: I...
...e text generally fall into two categories, which we'll look at separately in this article: Font styles: Properties that affect the font that is applied to the text, affecting what font is applied, how big it is, whether it is bold, italic, etc. Text layout styles: Properties that affect the spacing and other layout features of the text, allowing manipulation of, for example, the space between lines and letters, and how the text is aligned within the content box. Note: Bear in mind that the text inside an element is all affected as one single entity. You can't select and style subsections of text unless you wrap them in an appropriate element (such as a <span> or <strong>), or use a text-specific pseudo-element like ::first-letter (selects the first letter of an element's text), ::first-...
...And 15 more matches
JIT Optimization Outcomes
, and the reason was not recorded. GenericSuccess Optimization succeeded. Disabled The optimization has been explicitly disallowed. NoTypeInfo Optimization failed because there was no type information associated with an object containing the property. This failure mode is unlikely and occurs if the target object is obtained in some roundabout way. NoAnalysisInfo TODO NoShapeInfo The baseline compiler recorded no usable shape information for this operation. UnknownObject The type of the object is not known. This can happen if the operation sees many different types of objects, and so the type of the input to the operation cannot be resolved to a single type. UnknownProperties Optimization failed because the object containing the property was marked as having unknown properties. Th...
...le, if the array has sparse indexes, or has indexes that overflow the array's length, the optimization strategy may fail. ArrayDoubleConversion The type-system indicates that some arrays at this site should be converted to packed arrays of doubles while others should not. The optimization strategy fails for this condition. ArrayRange Could not accurately calculate the range attributes of an inline array creation. ArraySeenNegativeIndex Arrays at this element access location have seen negative indexes. TypedObjectNeutered The typed object being accessed at this location may have been neutered (a neutered typed object is one where the underlying byte buffer has been removed or transferred to a worker). TypedObjectArrayRange Failed to do range check of element access on a typed object. ...
... NonNativeReceiver IndexType SetElemNonDenseNonTANotCached NoSimdJitSupport Optimization failed because SIMD JIT support was not enabled. SimdTypeNotOptimized The type observed as being retrieved from this property access did not match an optimizable type. UnknownSimdProperty The property being accessed on the object is not one of the optimizable property names. HasCommonInliningPath Inlined DOM Monomorphic Polymorphic Inline Cache Outcomes Outcomes describing inline cache stubs that were generated. ICOptStub_GenericSuccess ICGetPropStub_ReadSlot ICGetPropStub_CallGetter ICGetPropStub_ArrayLength ICGetPropStub_UnboxedRead ICGetPropStub_UnboxedReadExpando ICGetPropStub_UnboxedArrayLength ICGetPropStub_TypedArrayLength ICGetPropStub_DOMProxyShadowed ICGetPropStub_DOMPro...
...And 15 more matches
nsIDOMWindowUtils
[optional] in boolean aIgnoreRootScrollFrame); void sendMouseScrollEvent(in AString aType, in float aX, in float aY, in long aButton, in long aScrollFlags, in long aDelta, in long aModifiers); Obsolete since Gecko 17.0 void sendWheelEvent(in float aX, in float aY, in double aDeltaX, in double aDeltaY, in double aDeltaZ, in unsigned long aDeltaMode, in long aModifiers, in long aLineOrPageDeltaX, in long aLineOrPageDeltaY, in unsigned long aOptions); void sendNativeKeyEvent(in long aNativeKeyboardLayout, in long aNativeKeyCode, in long aModifierFlags, in AString aCharacters, in AString aUnmodifiedCharacters); void sendNativeMouseEvent(in long aScreenX, in long aScreenY, in long aNativeMessage, in long aModifierFlags, in nsIDOMElement aElement); n...
...charset of the window's current document has been forced by the user. Cannot be accessed from unprivileged context (not content-accessible) Read only. elementsRestyled Read only unsigned long long The number of elements which have been restyled for the current document. Keep in mind that during a restyle operation, an element may be restyled multiple times (for example, when an inline element contains blocks). This number also counts restyling of pseudo-elements and anonymous boxes. Throws NS_ERROR_NOT_AVAILABLE if the count can't be provided. focusedInputType string The type of the currently-focused HTML <input> element, if one is focused. imageAnimationMode unsigned short Returns the image animation mode of the window. The attribute's value mus...
... WHEEL_EVENT_CAUSED_BY_PIXEL_ONLY_DEVICE 0x0001 Used for aOptions of sendWheelEvent(). If this is set, the synthesized wheel event emulates wheel events come from some devices without the line scroll amount by the event. It means that the aLineOrPageDeltaX and aLineOrPageDeltaY don't have proper values. ...
...And 15 more matches
Migrating from Firebug - Firefox Developer Tools
o provide shortcuts for the different panels. E.g. the Network Monitor can be opened via Ctrl+Shift+Q / Cmd+Opt+Q, the Web Console via Ctrl+Shift+K / Cmd+Opt+K and the Debugger via Ctrl+Shift+S / Cmd+Opt+S. Web Console The Web Console is the equivalent of Firebug's Console panel. It shows log information associated with a web page and allows you to execute JavaScript expressions via its command line. The display between both is somewhat different. This may be changed in bug 1269730. Filter log messages Firebug offers two ways to filter log messages, via the options menu and via the filter buttons within the toolbar. The Developer Tools console offers similar functionality via the filter buttons inside its toolbar -- centralized at one place. Command Line API The Command Line API in Fireb...
... Filter log messages Firebug offers two ways to filter log messages, via the options menu and via the filter buttons within the toolbar. The Developer Tools console offers similar functionality via the filter buttons inside its toolbar -- centralized at one place. Command Line API The Command Line API in Firebug provides some special functions for your convenience. The Developer Tools command line has some functions in common, but also has some other functions and misses others. Console API To log things to the console from within the web page Firebug makes a Console API available within the page. The Developer Tools share the same API, so your console.* statements will continue to work. Persist logs In Firebug you can click the Persist button within the toolbar to keep the logged mess...
...persistent logs and is available within the Toolbox Options panel. Server logs Firebug extensions like FirePHP allow to log server-side messages to the Firebug console. This functionality is already integrated into the DevTools using the ChromeLogger protocol and doesn't require any extensions to be installed. Command history The command history available through a button in Firebug's command line, is available by pressing ?/? within the DevTools command line. Inspect object properties By clicking on an object logged within the console you can inspect the object's properties and methods within the DOM panel. In the Firefox DevTools you can also inspect the objects. The difference is that they show the properties and methods within a side panel inside the Web Console. Show network reques...
...And 15 more matches
The JavaScript input interpreter - Firefox Developer Tools
The expression you type is echoed under the input prompt, followed by the result. ...
... The expression you type is echoed under the input prompt, followed by the result. ...
... The expression you type is echoed under the input prompt, followed by the result. ...
...And 15 more matches
Logical properties for margins, borders and padding - CSS: Cascading Style Sheets
to the fact that there are four longhand values each for margin, border, and padding side, plus all the shorthand values. Mappings for margins, borders, and padding The specification details mappings for each logical value to a physical counterpart. In the table below I have given these mapped values assuming that the writing-mode in use is horizontal-tb -- with a left to right direction. The inline direction therefore runs horizontally -- left to right -- and margin-inline-start would be equivalent to margin-left. If you were using a horizontal-tb writing mode with a right-to-left text direction then margin-inline-start would be the same as margin-right, and in a vertical writing mode it would be the same as using margin-top. Logical property Physical Property bor...
...order-bottom border-block-end-color border-bottom-color border-block-end-style border-bottom-style border-block-end-width border-bottom-width border-block-start border-top border-block-start-color border-top-color border-block-start-style border-top-style border-block-start-width border-top-width border-inline-end border-right border-inline-end-color border-right-color border-inline-end-style border-right-style border-inline-end-width border-right-width border-inline-start border-left border-inline-start-color border-left-color border-inline-start-style border-left-style border-inline-start-width border-left-width ...
... border-inline-start-width border-left-width border-start-start-radius border-top-left-radius border-start-end-radius border-bottom-left-radius border-end-start-radius border-top-right-radius border-end-end-radius border-bottom-right-radius margin-block-end margin-bottom margin-block-start margin-top margin-inline-end margin-right margin-inline-start margin-left padding-block-end padding-bottom padding-block-start padding-top padding-inline-end padding-right padding-inline-start padding-left There are also some additional shorthands, made possible because we have the ability to target both block or both inline edges of the box simultaneo...
...And 15 more matches
Applying color to HTML elements using CSS - HTML: Hypertext Markup Language
lement's content and the background-color property defines the element's background color. These can be used on just about any element. Text Whenever an element is rendered, these properties are used to determine the color of the text, its background, and any decorations on the text. color The color to use when drawing the text and any text decorations (such as the addition of under- or overlines, strike-through lines, and so forth. background-color The text's background color. text-shadow Configures a shadow effect to apply to text. Among the options for the shadow is the shadow's base color (which is then blurred and blended with the background based on the other parameters). See Text drop shadows in Fundamental text and font styling to learn more. text-decoration-color By defaul...
...rth. background-color The text's background color. text-shadow Configures a shadow effect to apply to text. Among the options for the shadow is the shadow's base color (which is then blurred and blended with the background based on the other parameters). See Text drop shadows in Fundamental text and font styling to learn more. text-decoration-color By default, text decorations (such as underlines, strikethroughs, etc) use the color property as their colors. However, you can override that behavior and use a different color for them with the text-decoration-color property. text-emphasis-color The color to use when drawing emphasis symbols adjacent to each character in the text. This is used primarily when drawing text for East Asian languages. caret-color The color to use when drawing ...
...t is a box with some sort of content, and has a background and a border in addition to whatever contents the box may have. Borders See the section Borders for a list of the CSS properties you can use to set the colors of a box's borders. background-color The background color to use in areas of the element that have no foreground content. column-rule-color The color to use when drawing the line separating columns of text. outline-color The color to use when drawing an outline around the outside of the element. This outline is different from the border in that it doesn't get space set aside for it in the document (so it may overlap other content). It's generally used as a focus indicator, to show which element will receive input events. Borders Any element can have a border drawn ar...
...And 15 more matches
HTML elements reference - HTML: Hypertext Markup Language
Web › HTML › Element
title bar or a page's tab. Sectioning root Element Description <body> The HTML <body> Element represents the content of an HTML document. There can be only one <body> element in a document. Content sectioning Content sectioning elements allow you to organize the document content into logical pieces. Use the sectioning elements to create a broad outline for your page content, including header and footer navigation, and heading elements to identify sections of content. Element Description <address> The HTML <address> element indicates that the enclosed HTML provides contact information for a person or people, or for an organization. <article> The HTML <article> element represents a self-contained c...
...esents an ordered list of items -- typically rendered as a numbered list. <p> The HTML <p> element represents a paragraph. <pre> The HTML <pre> element represents preformatted text which is to be presented exactly as written in the HTML file. <ul> The HTML <ul> element represents an unordered list of items, typically rendered as a bulleted list. Inline text semantics Use the HTML inline text semantic to define the meaning, structure, or style of a word, line, or any arbitrary piece of text. Element Description <a> The HTML <a> element (or anchor element), with its href attribute, creates a hyperlink to web pages, files, email addresses, locations in the same page, or anything else a URL can address. <...
...> The HTML Bidirectional Isolate element (<bdi>) tells the browser's bidirectional algorithm to treat the text it contains in isolation from its surrounding text. <bdo> The HTML Bidirectional Text Override element (<bdo>) overrides the current directionality of text, so that the text within is rendered in a different direction. <br> The HTML <br> element produces a line break in text (carriage-return). It is useful for writing a poem or an address, where the division of lines is significant. <cite> The HTML Citation element (<cite>) is used to describe a reference to a cited creative work, and must include the title of that work. <code> The HTML <code> element displays its contents styled in a fashion intended to indicate that the tex...
...And 15 more matches
Using the application cache - HTML: Hypertext Markup Language
Using this application cache feature is highly discouraged; it's in the process of being removed from the Web platform. As of Firefox 44+, when AppCache is used to provide offline support for a page, a warning message displays in the console advising developers to use Service workers instead (bug 1204581). Introduction HTML5 provides an application caching mechanism that lets web applications run offline. This Application Cache (AppCache) interface lists resources that browsers should cache to be available offline. Applications that are cached load and work correctly offline, even if users press the Refresh button. An application cache gives the following benefits: Offline browsing Users can navigate a site even when they are offline. Speed Cached resources are local, an...
...manifest file, the browser implicitly adds every page that the user visits and that has the manifest attribute set to the application cache. Some browsers (e.g., Firefox) display a notification bar the first time a user loads an application that uses the application cache. The notification bar displays a message such as: This website (example.com) is asking to store data on your computer for offline use. [Allow] [Never for This Site] [Not Now] The term "offline(-enabled) applications" sometimes refers specifically to applications that the user has allowed to use offline capabilities. Loading documents The use of an application cache modifies the normal process of loading a document: If an application cache exists, the browser loads the document and its associated resources directly fro...
...che by calling applicationCache.add()--are fetched into a temporary cache, following the appropriate HTTP caching rules. For each file fetched into this temporary cache, the browser sends a progress event to the applicationCache object. If any errors occur, the browser sends an error event, and the update halts. ...
...And 15 more matches
Paths - SVG: Scalable Vector Graphics
Web › SVG › Tutorial › Paths
A good understanding of paths is important when drawing SVGs. ...
... A good understanding of paths is important when drawing SVGs. ...
... A good understanding of paths is important when drawing SVGs. ...
...And 15 more matches
Images, Tables, and Mysterious Gaps - Archive of obsolete content
example of how browsers have traditionally behaved. Now let's see what that same simple table looks like in a modern browser when the page has a strict DOCTYPE. Notice the added space beneath the image in Figure 2. The markup of both table and cell remains unchanged-- it's the rendering mode that's different. ...
... let's see what that same simple table looks like in a modern browser when the page has a strict DOCTYPE. Notice the added space beneath the image in Figure 2. The markup of both table and cell remains unchanged-- it's the rendering mode that's different. Instead of "shrinkwrapping" the image itself, the browser is now wrapping around the line in which the image sits. The image is sitting in a line because images are, by default, inline content. That's all it takes. How Inline Content is Constructed In order to understand what just happened, let's take a look at the construction of a line box, the placement of images within a line box, and the placement of a line box within a table cell. First a basic line box containing text, shown in Figure 3. The most crucial part of Figure 3 is the...
...use images are, by default, inline content. That's all it takes. How Inline Content is Constructed In order to understand what just happened, let's take a look at the construction of a line box, the placement of images within a line box, and the placement of a line box within a table cell. First a basic line box containing text, shown in Figure 3. The most crucial part of Figure 3 is the baseline (represented by the blue line), and its placement within the line box. The baseline's exact placement is dependent on the "default" font for the line box (represented by the red box), which is determined by the value of font-family for the element that contains the line box. It isn't possible for an author to change the baseline's position directly, so wherever it ends up is where it will be. The...
...And 14 more matches
JIT Optimization Strategies
stant. It applies to property accesses on objects which are global-like in that there is only one instance of them per program. This includes global objects, object literals defined at the top-level of a script, and top-level function objects. This optimization makes the assumption that a property that has not changed after it was first assigned, is likely a constant property. It then directly inlines the value of the property into hot code that accesses it. For example, in the following code: var Constants = {}; Constants.N = 100; function testArray(array) { for (var i = 0; i < array.length; i++) { if (array[i] > Constants.N) return true; } return false; } Will have the loop compiled into the following when testArray gets hot. for (var i = 0; i < array.length; i++) { i...
...ction testArray(array) { for (var i = 0; i < array.length; i++) { if (array[i] > Constants.N) return true; } return false; } Will have the loop compiled into the following when testArray gets hot. for (var i = 0; i < array.length; i++) { if (array[i] > 100) return true; } When this optimization is successful, property access is eliminated entirely and replaced with an inline constant. GetProp_Constant Attempts to optimize reading a property that contains a uniquely-typed (or "singleton") object. With uniquely-typed objects, it is guaranteed that no other object has that same type. Unique (or "singleton") types are assigned to certain kinds of objects, like global objects, top-level functions, and object literals declared at the top-level of a script. If a property ...
...unctions, and object literals declared at the top-level of a script. If a property has always contained the same uniquely-typed object, then the engine can use the unique type to map back to a specific object, and eliminate the property access, replacing it with a constant reference to the object. When this optimization is successful, property access is eliminated entirely and replaced with an inline constant. The different success and failure conditions are documented below: GetProp_StaticName Attempts to optimize a property access on window which refers to a property on the global object. GetProp_TypedObject Optimizes accesses to properties on TypedObjects. GetProp_DefiniteSlot Optimizes access to a well-known regular property on an object. For this optimization to succeed, the proper...
...And 14 more matches
nsIScriptError
to this interface in Gecko 12.0. Prior to that release, if you wanted to associate an outer window with a script error, you had to use nsIScriptError2 instead. That subclass offered the nsIScriptError.initWithWindowID() method for that purpose; that method is now available in this interface, however. ...
...in Gecko 12.0. Prior to that release, if you wanted to associate an outer window with a script error, you had to use nsIScriptError2 instead. That subclass offered the nsIScriptError.initWithWindowID() method for that purpose; that method is now available in this interface, however. ...
...sIScriptError.initWithWindowID() method for that purpose; that method is now available in this interface, however. Method overview void init(in wstring message, in wstring sourceName, in wstring sourceLine, in PRUint32 lineNumber, in PRUint32 columnNumber, in PRUint32 flags, in string category); void initWithWindowID(in wstring message, in wstring sourceName, in wstring sourceLine, in PRUint32 lineNumber, in PRUint32 columnNumber, in PRUint32 flags, in string category, in unsigned long long innerWindowID); AUTF8String toString(); Attributes Attribute Type Description category string A string indicating the category of error that occurred See Categories for a list. Read only. columnNumber PRUint32 The column numb...
...And 14 more matches
Box-shadow generator - CSS: Cascading Style Sheets
================================== */ .col { display: block; float:left; margin: 1% 0 1% 1.6%; } .col:first-child { margin-left: 0; } /* all browsers except IE6 and lower */ /* * UI Slider */ .slidergroup { height: 20px; margin: 10px 0; font-family: "Segoe UI", Arial, Helvetica, sans-serif; -moz-user-select: none; user-select: none; } .slidergroup * { float: left; height: 100%; line-height: 100%; } /* Slider */ .ui-slider { height: 10px; width: 200px; margin: 4px 10px; display: block; border: 1px solid #999; border-radius: 3px; background: #EEE; } .ui-slider:hover { cursor: pointer; } .ui-slider-name { width: 90px; padding: 0 10px 0 0; text-align: right; text-transform: lowercase; } .ui-slider-pointer { width: 13px; height: 13px; background-color: #EEE; ...
...er-btn-set:hover { background-color: #379B4A; cursor: pointer; } .ui-slider-input > input { margin: 0 10px; padding: 0; width: 50px; text-align: center; -moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box; } /* * UI Button */ /* Checkbox */ .ui-checkbox { text-align: center; font-size: 16px; font-family: "Segoe UI", Arial, Helvetica, sans-serif; line-height: 1.5em; color: #FFF; -moz-user-select: none; -webkit-user-select: none; -ms-user-select: none; user-select: none; } .ui-checkbox > input { display: none; } .ui-checkbox > label { font-size: 12px; padding: 0.333em 1.666em 0.5em; height: 1em; line-height: 1em; background-color: #888; background-image: url("https://mdn.mozillademos.org/files/5683/disabled.png"); background-p...
...-moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box; } #stack_container .container { height: 100%; width: 100%; position: absolute; left: 100%; transition-property: left; transition-duration: 0.5s; -moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box; } #stack_container .title { text-align: center; font-weight: bold; line-height: 2em; border-bottom: 1px solid #43A6E1; color: #666; } /* * Stack of Layers for shadow */ #layer_manager { width: 17%; background-color: #FEFEFE; margin: 0 1% 0 0; -moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box; float: left; } #layer_manager .button { width: 30%; height: 25px; margin:0 0 10px; color: #333; background-color: #EEE; ...
...And 14 more matches
TextMetrics - Web APIs
The TextMetrics interface represents the dimensions of a piece of text in the canvas; a textMetrics() instance can be retrieved using the CanvasRenderingContext2D.measureText() method. Properties TextMetrics.width Read only Is a double giving the calculated width of a segment of inline text in CSS pixels. It takes into account the current font of the context. TextMetrics.actualBoundingBoxLeft Read only Is a double giving the distance from the alignment point given by the CanvasRenderingContext2D.textAlign property to the left side of the bounding rectangle of the given text, in CSS pixels. The distance is measured parallel to the baseline. TextMetrics.actualBoundingBoxRight Read only Is a double giving the distance from the alignment point given by the CanvasRenderingContext2D.tex...
...ide of the bounding rectangle of the given text, in CSS pixels. The distance is measured parallel to the baseline. TextMetrics.actualBoundingBoxRight Read only Is a double giving the distance from the alignment point given by the CanvasRenderingContext2D.textAlign property to the right side of the bounding rectangle of the given text, in CSS pixels. The distance is measured parallel to the baseline. TextMetrics.fontBoundingBoxAscent Read only Is a double giving the distance from the horizontal line indicated by the CanvasRenderingContext2D.textBaseline attribute to the top of the highest bounding rectangle of all the fonts used to render the text, in CSS pixels. ...
...ed parallel to the baseline. TextMetrics.fontBoundingBoxAscent Read only Is a double giving the distance from the horizontal line indicated by the CanvasRenderingContext2D.textBaseline attribute to the top of the highest bounding rectangle of all the fonts used to render the text, in CSS pixels. TextMetrics.fontBoundingBoxDescent Read only Is a double giving the distance from the horizontal line indicated by the CanvasRenderingContext2D.textBaseline attribute to the bottom of the bounding rectangle of all the fonts used to render the text, in CSS pixels. ...
...And 13 more matches
Color picker tool - CSS: Cascading Style Sheets
.picking-area { width: 198px; height: 198px; margin: 5px; border: 1px solid #DDD; position: relative; float: left; display: table; } .ui-color-picker .picking-area:hover { cursor: default; } /* HSV format - Hue-Saturation-Value(Brightness) */ .ui-color-picker .picking-area { background: url('https://mdn.mozillademos.org/files/5707/picker_mask_200.png') center center; background: -moz-linear-gradient(bottom, #000 0%, rgba(0, 0, 0, 0) 100%), -moz-linear-gradient(left, #FFF 0%, rgba(255, 255, 255, 0) 100%); background: -webkit-linear-gradient(bottom, #000 0%, rgba(0, 0, 0, 0) 100%), -webkit-linear-gradient(left, #FFF 0%, rgba(255, 255, 255, 0) 100%); background: -ms-linear-gradient(bottom, #000 0%, rgba(0, 0, 0, 0) 100%), -ms-linear-gradient(left, #FFF 0%, rgba(255, 255...
...(0, 0, 0, 0) 100%), -moz-linear-gradient(left, #FFF 0%, rgba(255, 255, 255, 0) 100%); background: -webkit-linear-gradient(bottom, #000 0%, rgba(0, 0, 0, 0) 100%), -webkit-linear-gradient(left, #FFF 0%, rgba(255, 255, 255, 0) 100%); background: -ms-linear-gradient(bottom, #000 0%, rgba(0, 0, 0, 0) 100%), -ms-linear-gradient(left, #FFF 0%, rgba(255, 255, 255, 0) 100%); background: -o-linear-gradient(bottom, #000 0%, rgba(0, 0, 0, 0) 100%), -o-linear-gradient(left, #FFF 0%, rgba(255, 255, 255, 0) 100%); background-color: #F00; } /* HSL format - Hue-Saturation-Lightness */ .ui-color-picker[data-mode='HSL'] .picking-area { background: -moz-linear-gradient(top, hsl(0, 0%, 100%) 0%, hsla(0, 0%, 100%, 0) 50%, hsla(0, 0%, 0%, 0) 50%, hsl(0, 0%, 0%) 100%), -moz-linear...
...FF 0%, rgba(255, 255, 255, 0) 100%); background-color: #F00; } /* HSL format - Hue-Saturation-Lightness */ .ui-color-picker[data-mode='HSL'] .picking-area { background: -moz-linear-gradient(top, hsl(0, 0%, 100%) 0%, hsla(0, 0%, 100%, 0) 50%, hsla(0, 0%, 0%, 0) 50%, hsl(0, 0%, 0%) 100%), -moz-linear-gradient(left, hsl(0, 0%, 50%) 0%, hsla(0, 0%, 50%, 0) 100%); background: -webkit-linear-gradient(top, hsl(0, 0%, 100%) 0%, hsla(0, 0%, 100%, 0) 50%, hsla(0, 0%, 0%, 0) 50%, hsl(0, 0%, 0%) 100%), -webkit-linear-gradient(left, hsl(0, 0%, 50%) 0%, hsla(0, 0%, 50%, 0) 100%); background: -ms-linear-gradient(top, hsl(0, 0%, 100%) 0%, hsla(0, 0%, 100%, 0) 50%, hsla(0, 0%, 0%, 0) 50%, hsl(0, 0%, 0%) 100%), -ms-linear-gradient(left, hsl(0, 0%, 50%) 0%, hsla(0, 0%...
...And 13 more matches
CSS grids, logical values, and writing modes - CSS: Cascading Style Sheets
ft to right and top to bottom. Logical properties and values Logical properties and values do not make an assumption about text direction. Which is why in Grid Layout we use the keyword start when aligning something to the start of the container. For me, working in English, start may well be on the left, however it doesn't have to be, and the word start infers no physical location. ...
...g to the start of the container. For me, working in English, start may well be on the left, however it doesn't have to be, and the word start infers no physical location. Block and Inline Once we begin dealing with logical, rather than physical properties, we stop seeing the world as left to right, and top to bottom. We need a new reference point, and this is where understanding the block and inline axes, that we met previously in the guide to alignment, becomes very useful. If you can start to see layout in terms of block and inline, the way things work in grid start to make a lot more sense. CSS writing modes I'm going to introduce another specification here, that I will be using in my examples: the CSS Writing Modes specification. This spec details how we can use these different writi...
...ther properties will change the way that text flows in our document, matching the different writing modes found around the world. Again, for full details of these see Jen's article. As a simple example, I have two paragraphs below. The first uses the default horizontal-tb, and the second uses vertical-rl. In the mode text still runs left to right, however the direction of the text is vertical - inline text now runs down the page, from top to bottom. .wrapper > p { border: 2px solid #ffa94d; border-radius: 5px; background-color: #ffd8a8; padding: 1em; margin: 1em; color: #d9480f; max-width: 300px; } <div class="wrapper"> <p style="writing-mode: horizontal-tb">I have writing mode set to the default <code>horizontal-tb</code></p> <p style="writing-mode: vert...
...And 13 more matches
vertical-align - CSS: Cascading Style Sheets
The vertical-align CSS property sets vertical alignment of an inline, inline-block or table-cell box. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. The vertical-align property can be used in two contexts: To vertically align an inline element's box inside its containing line box. ...
...ive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. The vertical-align property can be used in two contexts: To vertically align an inline element's box inside its containing line box. ...
...com/samples/16/ed9c61c3b6.png"/> 20%:<img style="vertical-align:20%" src="https://udn.realityripple.com/samples/16/ed9c61c3b6.png"/> -100%:<img style="vertical-align:-100%" src="https://udn.realityripple.com/samples/16/ed9c61c3b6.png"/> </p> #* { box-sizing: border-box; } img { margin-right: 0.5em; } p { height: 3em; padding: 0 .5em; font-family: monospace; text-decoration: underline overline; margin-left: auto; margin-right: auto; width: 80%; } To vertically align the content of a cell in a table: <table> <tr> <td style="vertical-align: baseline">baseline</td> <td style="vertical-align: top">top</td> <td style="vertical-align: middle">middle</td> <td style="vertical-align: bottom">bottom</td> <td> <p>There is a theory which states ...
...And 13 more matches
x - SVG: Scalable Vector Graphics
Web › SVG › Attribute › x
Value <length> | <percentage> Default value 0 Animatable Yes Note: Starting with SVG2, x is a Geometry Property meaning this attribute can also be used as a CSS property for <svg>. text For <text>, if it contain a single value, x defines the x coordinate on where the content text position must be placed. The content text position is usualy a point on the baseline of the first line of text. The exact content text position is influenced by some properties like text-anchor, or direction. If there are multiple values, x defines the x coordinate of each individual glyph from the text. If there are less values than glyphes, the remaining glyphes are placed in the continuity of the last positioned glyph. If there are more values than glyphes, extra values are i...
...s than glyphes, the remaining glyphes are placed in the continuity of the last positioned glyph. If there are more values than glyphes, extra values are ignored. ...
...es are placed in the continuity of the last positioned glyph. If there are more values than glyphes, extra values are ignored. ...
...And 13 more matches
y - SVG: Scalable Vector Graphics
Web › SVG › Attribute › y
Value <length> | <percentage> Default value 0 Animatable Yes Note: Starting with SVG2, y is a Geometry Property meaning this attribute can also be used as a CSS property for <svg>. text For <text>, if it contain a single value, y defines the y coordinate on where the content text position must be placed. The content text position is usualy a point on the baseline of the first line of text. The exact content text position is influenced by some properties like text-anchor, or direction. If there are multiple values, y defines the y coordinate of each individual glyph from the text. If there are less values than glyphes, the remaining glyphes are placed in the continuity of the last positioned glyph. If there are more values than glyphes, extra values are i...
...s than glyphes, the remaining glyphes are placed in the continuity of the last positioned glyph. If there are more values than glyphes, extra values are ignored. ...
...es are placed in the continuity of the last positioned glyph. If there are more values than glyphes, extra values are ignored. ...
...And 13 more matches
Application cache implementation overview
Loading a top level document from offline cache This happens in nsHttpChannel::OpenCacheEntry(). All top level document loading (navigation) channels are set ChooseApplicationCache flag, which happens in nsDocShell::DoURILoad(). Channels having that flag set are searching for nsIApplicationCache object prior inspecting normal HTTP cache. nsIApplicationCacheService::ChooseApplicationCache is given the URL the channel is about to load. It synchronously returns an nsIApplicationCache object representing the most recent cache version from the most recent cache group containing the entry under the URL or a matching namespace. ...
...che object prior inspecting normal HTTP cache. nsIApplicationCacheService::ChooseApplicationCache is given the URL the channel is about to load. It synchronously returns an nsIApplicationCache object representing the most recent cache version from the most recent cache group containing the entry under the URL or a matching namespace. If no nsIApplicationCache object has been found, there is no offline cache to load from and the load continues a usual way by loading from normal HTTP cache, further steps are not executed. The channel remembers the nsIApplicationCache object. nsIApplicationCache is then queried a client ID (= the manifest URL + a unique time stamp). Then, nsICacheService is asked to open nsICacheSession with STORE_OFFLINE policy and the given client ID. Entry is queried using tha...
...d continues a usual way by loading from normal HTTP cache, further steps are not executed. The channel remembers the nsIApplicationCache object. nsIApplicationCache is then queried a client ID (= the manifest URL + a unique time stamp). Then, nsICacheService is asked to open nsICacheSession with STORE_OFFLINE policy and the given client ID. Entry is queried using that session. nsHttpChannel::OnOfflineCacheEntryAvailable is then invoked. When aEntryStatus is a success code, entry has been found and we are loading it from the cache. LoadedFromApplicationCache flag is now set true on the channel. When aEntryStatus is a failure code, entry has not been found, but the URL is falling under one of the NETWORK or FALLBACK namespaces. When matching FALLBACK namespace, the associated fallback entry for ...
...And 12 more matches
SpiderMonkey Internals
alternative, depending on the compiler) to jump to the appropriate chunk of code for the current instruction. A JS-to-JS function call pushes a JavaScript stack frame without growing the C stack. But since JS-to-C-to-JS call stacks are common, the interpreter is reentrant. Some SpiderMonkey bytecode operations have many special cases, depending on the type of their arguments. Common cases are inlined in the interpreter loop, breaking any abstractions that stand in the way. So optimizations such as dense arrays and the property cache are, alas, not transparently tucked away in the jsarray.* and jsobj.* files. Both guest-star in jsinterp.cpp (to thunderous applause from Firefox users). All state associated with an interpreter instance is passed through formal parameters to the interpreter ent...
..., is in most places a thin (but source-compatible across versions) layer over the implementation. See the JSAPI User Guide. There is an additional public API for JavaScript debuggers, JSDBGAPI, but js/jsd/jsdebug.h might be a better API for debuggers. Another API, JSXDRAPI, provides serialization for JavaScript scripts. (XUL Fastload uses this.) Just-In-Time compiler SpiderMonkey contains a baseline compiler as first tier. A second tier JIT, code-named IonMonkey was enabled in Firefox 18. IonMonkey is an optimizing compiler. Self-hosting of built-in functions in JS Starting with Firefox 17, SpiderMonkey has the ability to implement built-in functions in self-hosted JS code. This code is compiled in a special compilation mode that gives it access to functionality that's not normally exposed...
...bgapi.h will provide convenience interfaces to do these things. At most one trap per bytecode can be set. When a script (JSScript) is destroyed, all traps set in its bytecode are cleared. Watchpoints, for intercepting set operations on properties and running a debugger-supplied function that receives the old value and a pointer to the new one, which it can use to modify the new value being set. Line number to PC and back mapping functions. The line-to-PC direction "rounds" toward the next bytecode generated from a line greater than or equal to the input line, and may return the PC of a for-loop update part, if given the line number of the loop body's closing brace. Any line after the last one in a script or function maps to a PC one byte beyond the last bytecode in the script. An example, fr...
...And 12 more matches
Cognitive accessibility - Accessibility
ively worse. Other permanent cognitive impairments include aphasia, speech and language, autism, ADD/ADHD, dyslexia, and dyscalculia. An example of a temporary cognitive impairment could be people affected by substances such as alcohol or drugs. Another form it can take is depression, such as when mourning the loss of a loved one, or being momentarily saddened by a tweet or video they just saw online. A third example could be sleep deprivation. It may seem like an overwhelming challenge to address the wide range of cognitive differences, especially when solutions for two different people may be conflicting. One way to handle this is to focus on cognitive skills. Cognitive skills include: attention memory processing speed time management letters and language numbers symbols and math ...
...includes: delivering content in more than one way, such as by text-to-speech or by video; providing easily-understood content, such as text written using plain-language standards; focusing attention on important content; minimizing distractions, such as unnecessary content or advertisements; providing consistent web page layout and navigation; incorporating familiar elements, such as underlined links that are blue when not visited and purple when visited; dividing processes into logical, essential steps with progress indicators; making website authentication as easy as possible without compromising security; and making forms easy to complete, such as with clear error messages and simple error recovery. WCAG Guidelines WCAG, Web Content Accessibility Guidelines, includes several g...
...nks that are blue when not visited and purple when visited; dividing processes into logical, essential steps with progress indicators; making website authentication as easy as possible without compromising security; and making forms easy to complete, such as with clear error messages and simple error recovery. WCAG Guidelines WCAG, Web Content Accessibility Guidelines, includes several guidelines to improve cognitive accessibility. These guidelines are published by the Web Accessibility Initiative (WAI) of the World Wide Web Consortium (W3C), the main international standards organization for the Internet. This group is also responsible for the Accessible Rich Internet Application (ARIA) guidelines. WCAG are guided by four principles: websites must be Perceivable, Operable, Understandabl...
...And 12 more matches
Cross-browser Flexbox mixins - CSS: Cascading Style Sheets
are not currently supported natively in browsers. Instead, you will need to use a CSS pre-processor to make the most of the following. However, CSS pre-processors simply generate valid CSS, so the techniques used below can be written in pure CSS instead, if preferred. Flexbox containers Using the display property's flex value causes an element to generate a block-level flex container box. ...
...nstead, you will need to use a CSS pre-processor to make the most of the following. However, CSS pre-processors simply generate valid CSS, so the techniques used below can be written in pure CSS instead, if preferred. Flexbox containers Using the display property's flex value causes an element to generate a block-level flex container box. The inline-flex value causes an element to generate an inline-level flex container box. ...
... make the most of the following. However, CSS pre-processors simply generate valid CSS, so the techniques used below can be written in pure CSS instead, if preferred. Flexbox containers Using the display property's flex value causes an element to generate a block-level flex container box. The inline-flex value causes an element to generate an inline-level flex container box. ...
...And 12 more matches
filter - CSS: Cascading Style Sheets
Web › CSS › filter
Values of an amount over 100% are allowed, providing brighter results. The lacuna value for interpolation is 1. filter: brightness(2) <svg style="position: absolute; top:...
...vg"> <filter id="svgBlur" x="-5%" y="-5%" width="110%" height="110%"> <feGaussianBlur in="SourceGraphic" stdDeviation="5"/> </filter> </svg> brightness() The brightness() function applies a linear multiplier to the input image, making it appear more or less bright. A value of 0% will create an image that is completely black. A value of 100% leaves the input unchanged. Other values are linear multipliers on the effect. Values of an amount over 100% are allowed, providing brighter results. The lacuna value for interpolation is 1. ...
...tely black. A value of 100% leaves the input unchanged. Other values are linear multipliers on the effect. Values of an amount over 100% are allowed, providing brighter results. The lacuna value for interpolation is 1. ...
...And 12 more matches
font - CSS: Cascading Style Sheets
Web › CSS › font
s corresponding initial value (possibly overriding values previously set using non-shorthand properties). Though not directly settable by font, the longhands font-size-adjust and font-kerning are also reset to their initial values. Constituent properties This property is a shorthand for the following CSS properties: font-family font-size font-stretch font-style font-variant font-weight line-height Syntax The font property may be specified as either a single keyword, which will select a system font, or as a shorthand for various font-related properties. If font is specified as a system keyword, it must be one of: caption, icon, menu, message-box, small-caption, status-bar. If font is specified as a shorthand for several font-related properties, then: it must include values fo...
...roperties. If font is specified as a system keyword, it must be one of: caption, icon, menu, message-box, small-caption, status-bar. If font is specified as a shorthand for several font-related properties, then: it must include values for: <font-size> <font-family> it may optionally include values for: <font-style> <font-variant> <font-weight> <font-stretch> <line-height> font-style, font-variant and font-weight must precede font-size font-variant may only specify the values defined in CSS 2.1, that is normal and small-caps font-stretch may only be a single keyword value. line-height must immediately follow font-size, preceded by "/", like this: "16px/3" font-family must be the last value specified. Values <'font-style'> See the font-style ...
...e-height must immediately follow font-size, preceded by "/", like this: "16px/3" font-family must be the last value specified. Values <'font-style'> See the font-style CSS property. <'font-variant'> See the font-variant CSS property. <'font-weight'> See the font-weight CSS property. <'font-stretch'> See the font-stretch CSS property. <'font-size'> See the font-size CSS property. <'line-height'> See the line-height CSS property. <'font-family'> See the font-family CSS property. System font values caption The system font used for captioned controls (e.g., buttons, drop-downs, etc.). icon The system font used to label icons. menu The system font used in menus (e.g., dropdown menus and menu lists). message-box The system font used in dialog boxes. small-caption The...
...And 12 more matches
text-decoration-style - CSS: Cascading Style Sheets
The text-decoration-style CSS property sets the style of the lines specified by text-decoration-line. The style applies to all lines that are set with text-decoration-line. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. If the specified decoration has a specific semantic meaning, like a line-through line meaning that some text has been deleted, authors are encouraged to denote this meaning using an HTML tag, like <del> or <s>. As browsers can disable styling in some cases, the semantic meaning won't disappear in such a situation. ...
...ub.com/mdn/interactive-examples and send us a pull request. If the specified decoration has a specific semantic meaning, like a line-through line meaning that some text has been deleted, authors are encouraged to denote this meaning using an HTML tag, like <del> or <s>. As browsers can disable styling in some cases, the semantic meaning won't disappear in such a situation. When setting multiple line-decoration properties at once, it may be more convenient to use the text-decoration shorthand property instead. Syntax /* Keyword values */ text-decoration-style: solid; text-decoration-style: double; text-decoration-style: dotted; text-decoration-style: dashed; text-decoration-style: wavy; /* Global values */ text-decoration-style: inherit; text-decoration-style: initial; text-decoration-styl...
...re convenient to use the text-decoration shorthand property instead. Syntax /* Keyword values */ text-decoration-style: solid; text-decoration-style: double; text-decoration-style: dotted; text-decoration-style: dashed; text-decoration-style: wavy; /* Global values */ text-decoration-style: inherit; text-decoration-style: initial; text-decoration-style: unset; Values solid Draws a single line. ...
...And 12 more matches
Template literals (Template strings) - JavaScript
Template literals can contain placeholders. These are indicated by the dollar sign and curly braces (${expression}). ...
... Template literals can contain placeholders. These are indicated by the dollar sign and curly braces (${expression}). ...
... Template literals can contain placeholders. These are indicated by the dollar sign and curly braces (${expression}). ...
...And 12 more matches
Gradients in SVG - SVG: Scalable Vector Graphics
<< PreviousNext >> Perhaps more exciting than just fills and strokes is the fact that you can also create and apply gradients as either fills or strokes. There are two types of gradients: linear and radial. You must give the gradient an id attribute; otherwise it can't be referenced by other elements inside the file. Gradients are defined in a defs section as opposed to on a shape itself to promote reusability. Linear Gradient Linear gradients change along a straight line. To insert one, you create a <linearGradient> node inside the definitions section of your SVG file. ...
... elements inside the file. Gradients are defined in a defs section as opposed to on a shape itself to promote reusability. Linear Gradient Linear gradients change along a straight line. To insert one, you create a <linearGradient> node inside the definitions section of your SVG file. ...
...ong a straight line. To insert one, you create a <linearGradient> node inside the definitions section of your SVG file. ...
...And 12 more matches
How CSS is structured - Learn web development
computer literacy, basic software installed, basic knowledge of working with files, HTML basics (study Introduction to HTML), and an idea of How CSS works. Objective: To learn CSS's fundamental syntax structures in detail. Applying CSS to HTML First, let's examine three methods of applying CSS to a document: with an external stylesheet, with an internal stylesheet, and with inline styles. External stylesheet An external stylesheet contains CSS in a separate file with a .css extension. This is the most common and useful method of bringing CSS to a document. You can link a single CSS file to multiple web pages, styling all of them with the same CSS stylesheet. In the Getting started with CSS, we linked an external stylesheet to our web page. You reference an external CSS ...
...ylesheet becomes a less efficient way of working. To apply uniform CSS styling to multiple pages using internal stylesheets, you must have an internal stylesheet in every web page that will use the styling. The efficiency penalty carries over to site maintenance too. With CSS in internal stylesheets, there is the risk that even one simple styling change may require edits to multiple web pages. ...
...s a less efficient way of working. To apply uniform CSS styling to multiple pages using internal stylesheets, you must have an internal stylesheet in every web page that will use the styling. The efficiency penalty carries over to site maintenance too. With CSS in internal stylesheets, there is the risk that even one simple styling change may require edits to multiple web pages. ...
...And 11 more matches
A first splash into JavaScript - Learn web development
eb browser. At the moment you'll see a simple heading, paragraph of instructions and form for entering a guess, but the form won't currently do anything. The place where we'll be adding all our code is inside the <script> element at the bottom of the HTML: <script> // Your JavaScript goes here </script> Adding variables to store our data Let's get started. ...
...theses put after it. After that we put two curly braces ({ }). Inside the curly braces goes all the code that we want to run whenever we call the function. When we want to run the code, we type the name of the function followed by the parentheses. Let's try that now. Save your code and refresh the page in your browser. Then go into the developer tools JavaScript console, and enter the following line: checkGuess(); After pressing Return/Enter, you should see an alert come up that says "I am a placeholder"; we have defined a function in our code that creates an alert whenever we call it. Note: You'll learn a lot more about functions later in the course. Operators JavaScript operators allow us to perform tests, do math, join strings together, and other such things. If you haven't alread...
...ults they return. First let's look at arithmetic operators, for example: Operator Name Example + Addition 6 + 9 - Subtraction 20 - 15 * Multiplication 3 * 7 / Division 10 / 5 You can also use the + operator to join text strings together (in programming, this is called concatenation). Try entering the following lines, one at a time: let name = 'Bingo'; name; let hello = ' says hello!'; hello; let greeting = name + hello; greeting; There are also some shortcut operators available, called augmented assignment operators. For example, if you want to simply add a new text string to an existing one and return the result, you could do this: name += ' says hello!'; This is equivalent to name = name + ' says hel...
...And 11 more matches
Storing the information you need — Variables - Learn web development
n to the real basics, looking at how to work with the most basic building blocks of JavaScript -- Variables. Prerequisites: Basic computer literacy, a basic understanding of HTML and CSS, an understanding of what JavaScript is. Objective: To gain familiarity with the basics of JavaScript variables. Tools you need Throughout this article, you'll be asked to type in lines of code to test your understanding of the content. If you are using a desktop browser, the best place to type your sample code is your browser's JavaScript console (see What are browser developer tools for more information on how to access this tool). What is a variable? A variable is a container for a value, like a number we might use in a sum, or a string that we might use as part of a sente...
...t use as part of a sentence. But one special thing about variables is that their contained values can change. Let's look at a simple example: <button>Press me</button> const button = document.querySelector('button'); button.onclick = function() { let name = prompt('What is your name?'); alert('Hello ' + name + ', nice to see you!'); } In this example pressing the button runs a couple of lines of code. The first line pops a box up on the screen that asks the reader to enter their name, and then stores the value in a variable. The second line displays a welcome message that includes their name, taken from the variable value. To understand why this is so useful, let's think about how we'd write this example without using a variable. It would end up looking something like this: let nam...
...f them being like little cardboard boxes that you can store things in. Declaring a variable To use a variable, you've first got to create it -- more accurately, we call this declaring the variable. To do this, we type the keyword var or let followed by the name you want to call your variable: let myName; let myAge; Here we're creating two variables called myName and myAge. Try typing these lines into your web browser's console. After that, try creating a variable (or two) with your own name choices. Note: In JavaScript, all code instructions should end with a semi-colon (;) -- your code may work correctly for single lines, but probably won't when you are writing multiple lines of code together. Try to get into the habit of including it. You can test whether these values now exist in...
...And 11 more matches
Chrome registration
and thus a user can install different chrome providers, and select a preferred skin and locale. This is accomplished through xpinstall and the extension manager. In order to inform the chrome registry of the available chrome, a text manifest is used: this manifest is "chrome.manifest" in the root of an extension, or theme, or XULRunner application. The plaintext chrome manifests are in a simple line-based format. Each line is parsed individually; if the line is parsable the chrome registry takes the action identified by that line, otherwise the chrome registry ignores that line (and prints a warning message in the runtime error console). locale packagename localename path/to/files skin packagename skinname path/to/files Note: The characters @ # ; : ? / are not allowed in the packagename.
...ird 2, and SeaMonkey 1.1 will not find the chrome when packagename is mixed case. If the above example had a packagename of CamelCasePackage, you would get an error message similar to "No chrome registered for chrome://camelcasepackage/path/to/files". Firefox 3, Thunderbird 3, and SeaMonkey 2 support mixed case. Bug resolved in Mozilla 1.9; see bug 132183. Manifest instructions comments # this line is a comment - you can put here whatever you want A line is a comment if it begins with the character '#'. Any following character in the same line is ignored. manifest manifest subdirectory/foo.manifest [flags] This will load a secondary manifest file. This can be useful for separating component and chrome registration instructions, or separate platform-specific registration data. binar...
... Maps a contract ID (a readable string) to the ClassID for a specific implementation. Typically a contract ID will be paired with a component entry immediately preceding. category category category entry-name value [flags] Registers an entry in the category manager. The specific format and meaning of category entries depend on the category. ...
...And 11 more matches
Introduction to the JavaScript shell
It is the JavaScript equivalent of Python's interactive prompt, the Lisp read-eval-print loop, or Ruby's irb. This article explains how to use the shell to experiment with JavaScript code and run JavaScript programs. To get the SpiderMonkey JavaScript shell, see the SpiderMonkey Build Documentation or download a compiled binary for your platform from the Nightly Builds. For a list of other JavaScript shells, see JavaScript shells. Note: Starting with SpiderMonkey 44 (Firefox 44 / Thunderbird 44 / SeaMonkey 2.41), the standard, Web-compatible JavaScript version is used by default (and not JS1.7+ anymore). ...
... used by default (and not JS1.7+ anymore). The version() shell builtin is still there for testing legacy features. Running the JavaScript shell The shell offers two modes of operation. You can use it as an interactive shell, in which you type JavaScript code at a prompt and get instant gratification, which is handy for experimenting or testing new features. You can also pass in, on the command line, a JavaScript program file to run, in which case the program is run automatically. After following the build documentation and installing the built shell using make install, you can run the shell in interactive mode using the command: js [ If you get " symbol lookup error: ./js: undefined symbol: PR_SetCurrentThreadName" e.g. from a Bash console when using a pre-compiled binary, try <path t...
...ozilla.sh ./js -- that worked for me] If you'd like to run the JavaScript code in the file foo.js, you can use this command: js foo.js To run foo.js then drop into the interactive shell, do this: js -f foo.js -i Reference Note: Because the JavaScript shell is used as a test environment for the JavaScript engine, the available options and built-in functions can change over time. Command line options There are a number of command line options you can specify to control the shell. These are summarized below. Be sure to use -h with your own jsshell to see if there is anything undocumented. -c, --compileonly Tells the shell to compile the program but not run it. This is a convenient way to quickly check for syntax errors in your program without actually running it. -e script Runs ...
...And 11 more matches
Accessibility Information for Web Authors - Accessibility
How-to's Key-navigable custom DHTML widgets in Mozilla & IE This document discusses how to use tabindex, element.focus() and onkeypress to make custom DHTML widgets such as menus or tree views keyboard accessible. ...
... How-to's Key-navigable custom DHTML widgets in Mozilla & IE This document discusses how to use tabindex, element.focus() and onkeypress to make custom DHTML widgets such as menus or tree views keyboard accessible. ...
... How-to's Key-navigable custom DHTML widgets in Mozilla & IE This document discusses how to use tabindex, element.focus() and onkeypress to make custom DHTML widgets such as menus or tree views keyboard accessible. ...
...And 11 more matches
CSP: style-src - HTTP
scheme and port number. You must include the single quotes. Some browsers specifically exclude blob and filesystem from source directives. Sites needing to allow these content types can specify them using the Data attribute. 'unsafe-eval' Allows the use of eval() and similar methods for creating code from strings. You must include the single quotes. 'unsafe-hashes' Allows enabling specific inline event handlers. If you only need to allow inline event handlers and not inline <script> elements or javascript: URLs, this is a safer method than using the unsafe-inline expression. 'unsafe-inline' Allows the use of inline resources, such as inline <script> elements, javascript: URLs, inline event handlers, and inline <style> elements. The single quotes are required. 'none' Refers to the empt...
..., this is a safer method than using the unsafe-inline expression. 'unsafe-inline' Allows the use of inline resources, such as inline <script> elements, javascript: URLs, inline event handlers, and inline <style> elements. The single quotes are required. 'none' Refers to the empty set; that is, no URLs match. The single quotes are required. 'nonce-<base64-value>' An allow-list for specific inline scripts using a cryptographic nonce (number used once). The server must generate a unique nonce value each time it transmits a policy. It is critical to provide an unguessable nonce, as bypassing a resource's policy is otherwise trivial. See unsafe inline script for an example. ...
... '<hash-algorithm>-<base64-value>' A sha256, sha384 or sha512 hash of scripts or styles. The use of this source consists of two portions separated by a dash: the encryption algorithm used to create the hash and the base64-encoded hash of the script or style. ...
...And 11 more matches
SVG Presentation Attributes - SVG: Scalable Vector Graphics
SVG presentation attributes are CSS properties that can be used as attributes on SVG elements. ...
... SVG presentation attributes are CSS properties that can be used as attributes on SVG elements. ...
... SVG presentation attributes are CSS properties that can be used as attributes on SVG elements. ...
...And 11 more matches
Building up a basic demo with Three.js - Game development
the browser. var renderer = new THREE.WebGLRenderer({antialias:true}); renderer.setSize(WIDTH, HEIGHT); renderer.setClearColor(0xDDDDDD, 1); document.body.appendChild(renderer.domElement); We are creating a new WebGL renderer, setting its size to fit the whole available space on the screen, and appending the DOM structure to the page. You might have noticed the antialias parameter in the first line -- this renders the edges of shapes more smoothly. The setClearColor() method sets our background to a light gray colour, instead of the default black one. Add this code into our second <script> element, just below the JavaScript comment. Scene A scene is the place where everything happens. When creating new objects in the demo, we add them all inside the scene to become visible on the screen.
...to a light gray colour, instead of the default black one. Add this code into our second <script> element, just below the JavaScript comment. Scene A scene is the place where everything happens. When creating new objects in the demo, we add them all inside the scene to become visible on the screen. In three.js, the scene is represented by a Scene object. ...
...instead of the default black one. Add this code into our second <script> element, just below the JavaScript comment. Scene A scene is the place where everything happens. When creating new objects in the demo, we add them all inside the scene to become visible on the screen. In three.js, the scene is represented by a Scene object. ...
...And 10 more matches
Manipulating documents - Learn web development
o start learning about DOM manipulation, let's begin with a practical example. Take a local copy of the dom-example.html page and the image that goes along with it. Add a <script></script> element just above the closing </body> tag. To manipulate an element inside the DOM, you first need to select it and store a reference to it inside a variable. Inside your script element, add the following line: const link = document.querySelector('a'); Now we have the element reference stored in a variable, we can start to manipulate it using properties and methods available to it (these are defined on interfaces like HTMLAnchorElement in the case of <a> element, its more general parent interface HTMLElement, and Node -- which represents all nodes in a DOM). First of all, let's change the text ins...
...ed in a variable, we can start to manipulate it using properties and methods available to it (these are defined on interfaces like HTMLAnchorElement in the case of <a> element, its more general parent interface HTMLElement, and Node -- which represents all nodes in a DOM). First of all, let's change the text inside the link by updating the value of the Node.textContent property. ...
...ent, and Node -- which represents all nodes in a DOM). First of all, let's change the text inside the link by updating the value of the Node.textContent property. Add the following line below the previous one: link.textContent = 'Mozilla Developer Network'; We should also change the URL the link is pointing to, so that it doesn't go to the wrong place when it is clicked on. Add the following line, again at the bottom: link.href = 'https://developer.mozilla.org'; Note that, as with many things in JavaScript, there are many ways to select an element and store a reference to it in a variable. Document.querySelector() is the recommended modern approach, which is convenient because it allows you to select elements using CSS selectors. The above querySelector() call will match the first ...
...And 10 more matches
Getting started with React - Learn web development
his article we will say hello to React. We'll discover a little bit of detail about its background and use cases, set up a basic React toolchain on our local computer, and create and play with a simple starter app -- learning a bit about how React works in the process. Prerequisites: Familiarity with the core HTML, CSS, and JavaScript languages, knowledge of the terminal/command line. React uses an HTML-in-JavaScript syntax called JSX (JavaScript and XML). Familiarity with both HTML and JavaScript will help you to learn JSX, and better identify whether bugs in your application are related to JavaScript or to the more specific domain of React. Objective: To set up a local React development environment, create a start app, and understand the basics of how i...
...called JSX (JavaScript and XML). Familiarity with both HTML and JavaScript will help you to learn JSX, and better identify whether bugs in your application are related to JavaScript or to the more specific domain of React. Objective: To set up a local React development environment, create a start app, and understand the basics of how it works Hello React As its official tagline states, React is a library for building user interfaces. React is not a framework - it's not even exclusive to the web. It's used with other libraries to render to certain environments. For instance, React Native can be used to build mobile applications; React 360 can be used to build virtual reality applications; and there are other possibilities besides. To build for the web, developers use Re...
...ng in a <header> tag, for semantic reasons? The JSX approach allows us to nest our elements within each other, just like we do with HTML: const header = ( <header> <h1>Mozilla Developer Network</h1> </header> ); Note: The parentheses in the previous snippet aren't unique to JSX, and don't have any effect on your application. They're a signal to you (and your computer) that the multiple lines of code inside are part of the same expression. You could just as well write the header expression like this: const header = <header> <h1>Mozilla Developer Network</h1> </header> However, this looks kind of awkward, because the <header> tag that starts the expression is not indented to the same position as its corresponding closing tag. Of course, your browser can't read JSX without help...
...And 10 more matches
Profiling with the Firefox Profiler
Profiler has more current documentation available at profiler.firefox.com/docs/. However the following could have some potentially useful information for Gecko-specific problems. You can check out some frequently asked questions about the Firefox Profilers. Reporting a Performance Problem has a step-by-step guide for obtaining a profile when requested by Firefox developers. Interface 1. Timeline The timeline has several rows of tracing markers (colored segments) which indicate interesting events. Hover over them to see more information. Below the tracing markers are rows corresponding with activity on a variety of threads. Tip: Threads that are annotated with "[default]" are in the parent (aka "UI", aka "browser chrome", aka "main") process and those annotated with "[tab]" are in th...
...its duration allowing for easy zooming in on interesting time ranges. As you zoom in on ranges, breadcrumbs are created allowing you to easily navigate back to previously-selected ranges or the entire profile (denoted as "Full Range"). Tip: While zooming out to a previously-selected range deletes the narrower range, the browser back button can be used to restore the narrower range. Thread Timeline(s) Thread/Process Timelines: Below the tracing markers we have a list of profiled threads. These threads may come from different processes. In this case, we have the 'GeckoMain [default]' process' main thread, a content process' main thread, and the main thread of the compositor process. Each of these timelines is aligned with wall clock time. So, for example, when a thread is blocked, like 'Gec...
...efault]' process' main thread, a content process' main thread, and the main thread of the compositor process. Each of these timelines is aligned with wall clock time. So, for example, when a thread is blocked, like 'GeckoMain [tab]', on a thread like 'GeckoMain [default]', we can see what's occurring on the latter thread that is preventing it from responding to the former. X (Time) axis: The timelines go from left to right as wall clock time increases along the X axis. Elements in the timeline are spaced at the sampling frequency with an attempt to align them with time. Factors such as sampling or stack-walking variance and system load can lead to sampling delays which manifest as gaps in the timeline. Note: because this is a sampling profiler, be cautious when examining running time that i...
...And 10 more matches
Index
Mozilla › Tech › XPCOM › Index
nt to have a more reproducible testcase. In those cases, an xpcshell script can help. You can just call the code you want to test. But then, you can't use the Venkman UI. 68 WithJSModulesAndChrome Moved to HOWTO 69 XPCShell Reference Automated testing, Developing Mozilla, JavaScript, JavaScript:Tools, Tools, XPCOM:Language Bindings, XPConnect The command-line syntax for xpcshell is: 70 XPCshell Test Manifest Expressions QA, Testing XPCShell unit tests are run by specifying them in a manifest file. You can add conditions to tests in order to control when tests get run. The conditions accept a simple boolean expression syntax, described here. 71 Monitoring HTTP activity HTTP Gecko includes the nsIHttpActivityObs...
...eem like arrays, but there are important differences: 123 mozilla::services namespace Developing Mozilla, XPCOM The services C++ namespace offers an easy and efficient alternative for obtaining a service as compared to the indirect XPCOM approach: GetService(), CallGetService(), etc methods are expensive and should be avoided when possible. 124 XPCOM ownership guidelines XPCOM ...naturally. If you create a temporary object, obviously it's up to you to destroy it. That's a sure sign of ownership. If you create an object with a longer lifespan, you will own it until you give ownership away. 125 XPCOM reference Add-ons, Extensions, Landing, Mozilla, Reference, XPCOM This reference describes the interfaces and functions provided by the...
... XPCOM Interface Reference Implemented by: @mozilla.org/toolkit/app-startup;1. To use the service: 329 nsIAppStartup_MOZILLA_2_0 Interfaces, Interfaces:Scriptable, XPCOM, XPCOM API Reference, XPCOM Interface Reference In Gecko 4.0 this Interface was merged into the nsIAppStartup interface. 330 nsIApplicationCache DOM, Interfaces, Interfaces:Scriptable, Offline_resources, XPCOM, XPCOM Interface Reference Each application cache has a unique client ID for use with nsICacheService.openSession() method, to access the cache's entries. 331 nsIApplicationCacheChannel DOM, Interfaces, Interfaces:Scriptable, Offline_resources, XPCOM, XPCOM Interface Reference A shortcut method to mark the cache item of this channel as 'foreign'. See th...
...And 10 more matches
Basic animations - Web APIs
ScreenshotLive sample An animated clock This example draws an animated clock, showing your current time. ...
... An animated clock This example draws an animated clock, showing your current time. ...
...('canvas').getContext('2d'); ctx.save(); ctx.clearRect(0, 0, 150, 150); ctx.translate(75, 75); ctx.scale(0.4, 0.4); ctx.rotate(-Math.PI / 2); ctx.strokeStyle = 'black'; ctx.fillStyle = 'white'; ctx.lineWidth = 8; ctx.lineCap = 'round'; // Hour marks ctx.save(); for (var i = 0; i < 12; i++) { ctx.beginPath(); ctx.rotate(Math.PI / 6); ctx.moveTo(100, 0); ctx.lineTo(120, 0); ctx.stroke(); } ctx.restore(); // Minute marks ctx.save(); ctx.lineWidth = 5; for (i = 0; i < 60; i++) { if (i % 5!= 0) { ctx.beginPath(); ctx.moveTo(117, 0); ctx.lineTo(120, 0); ctx.stroke(); } ctx.rotate(Math.PI / 30); } ctx.restore(); var sec = now.getSeconds(); var min = now.getMinutes(); var hr = now.getHours(); hr...
...And 10 more matches
HTMLTextAreaElement - Web APIs
The HTMLTextAreaElement interface provides special properties and methods for manipulating the layout and presentation of <textarea> elements. ...
... The HTMLTextAreaElement interface provides special properties and methods for manipulating the layout and presentation of <textarea> elements. ...
...inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monosp...
...And 10 more matches
SVGPathElement - Web APIs
The SVGPathElement interface corresponds to the <path> element. ...
... The SVGPathElement interface corresponds to the <path> element. ...
...inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 140" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monosp...
...And 10 more matches
CSS Box Alignment - CSS: Cascading Style Sheets
onsistent method of alignment across all of CSS. This document details the general concepts found in the specification. Note: The documentation for each layout method will detail how Box Alignment is applied there. Older alignment methods CSS traditionally had very limited alignment capabilities. We were able to align text using text-align, center blocks using auto margins, and in table or inline-block layouts using the vertical-align property. Alignment of text is now covered by the Inline Layout and CSS Text modules, and for the first time in Box Alignment we have full horizontal and vertical alignment capabilities. If you initially learned Flexbox then you may consider these properties to be part of the Flexbox specification, and some of the properties are indeed listed in Level 1 of ...
...t specification should be referred to as it may add additional capabilities over what is currently in Flexbox. Basic examples The following examples demonstrate how some of the Box Alignment Properties are applied in Grid and Flexbox. CSS grid layout alignment example In this example using Grid Layout, there is extra space in the grid container after laying out the fixed width tracks on the inline (main) axis. This space is distributed using justify-content. On the block (cross) axis the alignment of the items inside their grid areas is controlled with align-items. The first item overrides the align-items value set on the group by setting align-self to center. Flexbox Alignment Example In this example, three flex items are aligned on the main axis using justify-content and on the Cross...
... we are aligning it to the physical dimensions of top, right, bottom and left. Instead we describe alignment in terms of the start and end of the particular dimension we are working with. This ensures that alignment works in the same way whichever writing mode the document has. ...
...And 10 more matches
Basic concepts of flexbox - CSS: Cascading Style Sheets
When we describe flexbox as being one dimensional we are describing the fact that flexbox deals with layout in one dimension at a time -- either as a row or as a column. ...
...tion property, and the cross axis runs perpendicular to it. Everything we do with flexbox refers back to these axes, so it is worth understanding how they work from the outset. The main axis The main axis is defined by flex-direction, which has four possible values: row row-reverse column column-reverse Should you choose row or row-reverse, your main axis will run along the row in the inline direction. Choose column or column-reverse and your main axis will run from the top of the page to the bottom -- in the block direction. The cross axis The cross axis runs perpendicular to the main axis, therefore if your flex-direction (main axis) is set to row or row-reverse the cross axis runs down the columns. If your main axis is column or column-reverse then the cross axis runs al...
...r flex-direction (main axis) is set to row or row-reverse the cross axis runs down the columns. If your main axis is column or column-reverse then the cross axis runs along the rows. Understanding which axis is which is important when we start to look at aligning and justifying flex items; flexbox features properties that align and justify content along one axis or the other. ...
...And 10 more matches
Box alignment in CSS Grid Layout - CSS: Cascading Style Sheets
properties and values work in flexbox. Due to grid being two-dimensional and flexbox one-dimensional there are some small differences that you should watch out for. So we will start by looking at the two axes that we deal with when aligning things in a grid. The two axes of a grid layout When working with grid layout you have two axes available to align things against - the block axis and the inline axis. The block axis is the axis upon which blocks are laid out in block layout. If you have two paragraphs on your page they display one below the other, so it is this direction we describe as the block axis. The inline axis runs across the block axis, it is the direction in which text in regular inline flow runs. We are able to align the content inside grid areas, and the grid tracks th...
...lign-items properties control alignment on the block axis. When we use these properties, we are changing the alignment of the item within the grid area you have placed it. In the following example, I have four grid areas within my grid. ...
...rties control alignment on the block axis. When we use these properties, we are changing the alignment of the item within the grid area you have placed it. In the following example, I have four grid areas within my grid. ...
...And 10 more matches
float - CSS: Cascading Style Sheets
Web › CSS › float
The float CSS property places an element on the left or right side of its container, allowing text and inline elements to wrap around it. The element is removed from the normal flow of the page, though still remaining a part of the flow (in contrast to absolute positioning). The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. A floating element is one where the computed value of float is not none. ...
... If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. A floating element is one where the computed value of float is not none. ...
...ute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. A floating element is one where the computed value of float is not none. ...
...And 10 more matches
text-decoration - CSS: Cascading Style Sheets
The text-decoration shorthand CSS property sets the appearance of decorative lines on text. It is a shorthand for text-decoration-line, text-decoration-color, text-decoration-style, and the newer text-decoration-thickness property. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Text decorations are drawn across descendant text elements. This means that if an element specifies a text decoration, then a child element can't remove the decoration. ...
...xamples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Text decorations are drawn across descendant text elements. This means that if an element specifies a text decoration, then a child element can't remove the decoration. For example, in the markup <p>This text has <em>some emphasized words</em> in it.</p>, the style rule p { text-decoration: underline; } would cause the entire paragraph to be underlined. The style rule em { text-decoration: none; } would not cause any change; the entire paragraph would still be underlined. However, the rule em { text-decoration: overline; } would cause a second decoration to appear on "some emphasized words". Constituent properties This property is a shorthand for the following CSS properties: text-decora...
... text-decoration-color Sets the color of the decoration. ...
...And 10 more matches
CSP: script-src - HTTP
CSP version 1 Directive type Fetch directive default-src fallback Yes. If this directive is absent, the user agent will look for the default-src directive. ...
... scheme and port number. You must include the single quotes. Some browsers specifically exclude blob and filesystem from source directives. Sites needing to allow these content types can specify them using the Data attribute. 'unsafe-eval' Allows the use of eval() and similar methods for creating code from strings. You must include the single quotes. 'unsafe-hashes' Allows enabling specific inline event handlers. If you only need to allow inline event handlers and not inline <script> elements or javascript: URLs, this is a safer method than using the unsafe-inline expression. 'unsafe-inline' Allows the use of inline resources, such as inline <script> elements, javascript: URLs, inline event handlers, and inline <style> elements. The single quotes are required. 'none' Refers to the empt...
..., this is a safer method than using the unsafe-inline expression. 'unsafe-inline' Allows the use of inline resources, such as inline <script> elements, javascript: URLs, inline event handlers, and inline <style> elements. The single quotes are required. 'none' Refers to the empty set; that is, no URLs match. The single quotes are required. 'nonce-<base64-value>' An allow-list for specific inline scripts using a cryptographic nonce (number used once). The server must generate a unique nonce value each time it transmits a policy. It is critical to provide an unguessable nonce, as bypassing a resource's policy is otherwise trivial. See unsafe inline script for an example. ...
...And 10 more matches
Grammar and types - JavaScript
and uses the Unicode character set. For example, the word Fruh (which means "early" in German) could be used as a variable name. let Fruh = "foobar" But, the variable fruh is not the same as Fruh because JavaScript is case sensitive. In JavaScript, instructions are called statements and are separated by semicolons (;). A semicolon is not necessary after a statement if it is written on its own line. But if more than one statement on a line is desired, then they must be separated by semicolons. ECMAScript also has rules for automatic insertion of semicolons (ASI) to end statements. (For more information, see the detailed reference about JavaScript's lexical grammar.) It is considered best practice, however, to always write a semicolon after a statement, even when it is not strictly neede...
... reference about JavaScript's lexical grammar.) It is considered best practice, however, to always write a semicolon after a statement, even when it is not strictly needed. This practice reduces the chances of bugs getting into the code. The source text of JavaScript script gets scanned from left to right, and is converted into a sequence of input elements which are tokens, control characters, line terminators, comments, or whitespace. (Spaces, tabs, and newline characters are considered whitespace.) Comments The syntax of comments is the same as in C++ and in many other languages: // a one line comment /* this is a longer, * multi-line comment */ /* You can't, however, /* nest comments */ SyntaxError */ Comments behave like whitespace, and are discarded during script execution. ...
...s. The following is an example of a regex literal. var re = /ab+c/; String literals A string literal is zero or more characters enclosed in double (") or single (') quotation marks. A string must be delimited by quotation marks of the same type (that is, either both single quotation marks, or both double quotation marks). The following are examples of string literals: 'foo' "bar" '1234' 'one line \n another line' "John's cat" You can call any of the String object's methods on a string literal value. JavaScript automatically converts the string literal to a temporary String object, calls the method, then discards the temporary String object. You can also use the String.length property with a string literal: // Will print the number of symbols in the string including whitespace. console.
...And 10 more matches
begin - SVG: Scalable Vector Graphics
Web › SVG › Attribute › begin
t of the target element with the target element as parameter. After removal of the target element, the <discard> element is no longer useful, therefore it is also discarded after the target element's removal. If the href attribute has an invalid URL reference (e.g. the target element did not exist), the <discard> element itself is still removed after the activation. Seeking backwards in the timeline doesn't re-insert the discarded elements. So, authors are encouraged to set the playbackorder attribute to forwardonly when using the <discard> element. The <discard> element itself can be discarded prior to its activation, in which case it will never trigger the removal of its own target element. Value <begin-value-list> Default value 0s Animatable No ...
...ype="XML" attributeName="width" to="75" begin="2s" dur="6s" fill="freeze" /> </rect> <rect x="60" y="85" height="15" width="0"> <animate attributeType="XML" attributeName="width" to="50" begin="4s" dur="4s" fill="freeze" /> </rect> <!-- grid --> <text x="10" y="20" text-anchor="middle">0s</text> <line x1="10" y1="25" x2="10" y2="105" stroke="grey" stroke-width=".5" /> <text x="35" y="20" text-anchor="middle">2s</text> <line x1="35" y1="25" x2="35" y2="105" stroke="grey" stroke-width=".5" /> <text x="60" y="20" text-anchor="middle">4s</text> <line x1="60" y1="25" x2="60" y2="105" stroke="grey" stroke-width=".5" /> <text x="85" y="20" text-anchor="middle">6s</text> <line ...
...line x1="35" y1="25" x2="35" y2="105" stroke="grey" stroke-width=".5" /> <text x="60" y="20" text-anchor="middle">4s</text> <line x1="60" y1="25" x2="60" y2="105" stroke="grey" stroke-width=".5" /> <text x="85" y="20" text-anchor="middle">6s</text> <line x1="85" y1="25" x2="85" y2="105" stroke="grey" stroke-width=".5" /> <text x="110" y="20" text-anchor="middle">8s</text> <line x1="110" y1="25" x2="110" y2="105" stroke="grey" stroke-width=".5" /> <line x1="10" y1="30" x2="110" y2="30" stroke="grey" stroke-width=".5" /> <line x1="10" y1="105" x2="110" y2="105" stroke="grey" stroke-width=".5" /> </svg> begin-1-offset.svg Syncbase example <svg width="120" height="120" viewBox="0 0 120 120" xmlns="http://www.w3.org/2000/svg" version="1.1" xmlns:xli...
...And 10 more matches
Fills and Strokes - SVG: Scalable Vector Graphics
<< PreviousNext >> There are several ways to color shapes (including specifying attributes on the object) using inline CSS, an embedded CSS section, or an external CSS file. Most SVG you'll find around the web use inline CSS, but there are advantages and disadvantages associated with each type. Fill and Stroke Attributes Painting Basic coloring can be done by setting two attributes on the node: fill and stroke. Using fill sets the color inside the object and stroke sets the color of the line drawn around the object. You can use the same css color naming schemes that you use in HTML, whether that's color names (that is red), rgb values (that is rgb(255,0,0)), hex values, rgba values, etc. <rect x="10" y="10" width="100" height="100" stroke="blue" fill="purple" fill-o...
...n Firefox 3+, rgba values are also allowed, and will give the same effect. But for compatibility with other viewers, it's often best to specify the fill/stroke opacity separately. If you specify both an rgba value and a fill/stroke opacity value, both will be applied. Stroke In addition to its color properties, there are a few other attributes available to control the way a stroke is drawn on a line. ...
...st to specify the fill/stroke opacity separately. If you specify both an rgba value and a fill/stroke opacity value, both will be applied. Stroke In addition to its color properties, there are a few other attributes available to control the way a stroke is drawn on a line. <?xml version="1.0" standalone="no"?> <svg width="160" height="140" xmlns="http://www.w3.org/2000/svg" version="1.1"> <line x1="40" x2="120" y1="20" y2="20" stroke="black" stroke-width="20" stroke-linecap="butt"/> <line x1="40" x2="120" y1="60" y2="60" stroke="black" stroke-width="20" stroke-linecap="square"/> <line x1="40" x2="120" y1="100" y2="100" stroke="black" stroke-width="20" stroke-linecap="round"/> </svg> The stroke-width property defines the width of this stroke. Strokes are drawn centered around the pa...
...And 10 more matches
Chapter 5: Let's build a Firefox extension - Archive of obsolete content
xVersion>4.0.0.*</em:maxVersion> </Description> </em:targetApplication> </Description> </RDF> Create the chrome manifest Fill in the chrome.manifest file as shown in Listing 2. Listing 2: Content for chrome.manifest content helloworld content/ overlay chrome://browser/content/browser.xul chrome://helloworld/content/overlay.xul Register the content package (content instruction) Line 1, beginning content, contains the code used to register the chrome's content package. Here, helloworld is a package name, and content/ is a relative path to the folder where the source file is stored. Registering the content package makes it so that the overlay.xul file in the content folder can be accessed using the chrome URL, chrome://helloworld/content/overlay.xul. XUL cross-package overlay...
...ontains the code used to register the chrome's content package. Here, helloworld is a package name, and content/ is a relative path to the folder where the source file is stored. Registering the content package makes it so that the overlay.xul file in the content folder can be accessed using the chrome URL, chrome://helloworld/content/overlay.xul. XUL cross-package overlay (overlay instruction) Line 2, beginning overlay, contains the code used to invoke the cross-package overlay, overlaying the Firefox browser window, at chrome://browser/content/browser.xul with chrome://helloworld/content/overlay.xul. Finding overlay merge points The next step is to find the "merge points" where the overlay document will insert its content into the base document. There are a number of ways to go about thi...
... menuitem elements within this menupop element and determine where you want to add your new element. For the time being, let's locate it in the spot numbered FIXME: Figure 5: Finding merge points for overlays using the DOM Inspector Putting overlays on the browser window Now that you know the merge point for your overlay, you can create the overlay.xul file that will insert it (Listing 3). In line 4, we identify the merge point as the menupop element; in lines 5-7, we have the code that adds the new menu item. The insertbefore attribute determines where the element gets added. Test install and operational check This brings us to the point where we finally install our Hello World extension. Using the normal XPI-style installer would just be added trouble in this case, so we won't use it. ...
...And 9 more matches
Space Manager High Level Design - Archive of obsolete content
When elements are floated to the left or right in a layout, they take up space and influence where other elements can be placed. The Space Manager is responsible for keeping track of where space is taken up and where it is available. This information is used by block layout to correctly compute where other floated elements should be placed, and how much space is available to normal in-flow elements that flow around the floated bits. ...
... it with the BlockReflowState so it is passed down to child frames' reflow methods. After reflow, the Space Manager is destroyed. During reflow, the space manager stores the space taken up by floats (UpdateSpaceManager in nsBlockFrame) and provides information about the space available for other elements (GetAvailableSpace in nsBlockReflowState). Additionally, there is a need to manage impacts to lines caused by changes to floated elements. This is referred to as Propagation of Float Damage and is handled by the Block Frame, making use of the Space Manager. When a float is incrementally reflowed, the Space Manager is notified if the float's region has changed. If so, the vertical space that has been affected (including both the float's old region and the float's new region) is noted in the int...
...k Frame, making use of the Space Manager. When a float is incrementally reflowed, the Space Manager is notified if the float's region has changed. If so, the vertical space that has been affected (including both the float's old region and the float's new region) is noted in the internal nsIntervalSet as potential float damage (the method is IncludeInDamage). ...
...And 9 more matches
textbox - Archive of obsolete content
<< XUL Reference home [ Examples | Attributes | Properties | Methods | Related ] An input field where the user can enter text. It is similar to the HTML input element. Only one line of text is displayed by default. The multiline attribute can be specified to display a field with multiple rows. More information is available in the XUL tutorial. ...
... | Related ] An input field where the user can enter text. It is similar to the HTML input element. Only one line of text is displayed by default. The multiline attribute can be specified to display a field with multiple rows. More information is available in the XUL tutorial. ...
...ed ] An input field where the user can enter text. It is similar to the HTML input element. Only one line of text is displayed by default. The multiline attribute can be specified to display a field with multiple rows. More information is available in the XUL tutorial. ...
...And 9 more matches
XForms Repeat Element - Archive of obsolete content
ement. The index is equal to the index of the control set that the focused control belongs to. Actions You can use XForms Action Module elements to modify the nodeset that the repeat element is bound to. The most useful actions for altering the contents of a repeat are the insert (see the spec), delete (see the spec) and setindex (see the spec) elements. ...
...is equal to the index of the control set that the focused control belongs to. Actions You can use XForms Action Module elements to modify the nodeset that the repeat element is bound to. The most useful actions for altering the contents of a repeat are the insert (see the spec), delete (see the spec) and setindex (see the spec) elements. ...
...ntrol belongs to. Actions You can use XForms Action Module elements to modify the nodeset that the repeat element is bound to. The most useful actions for altering the contents of a repeat are the insert (see the spec), delete (see the spec) and setindex (see the spec) elements. ...
...And 9 more matches
Getting started with HTML - Learn web development
e the web pages you visit. It can be as complicated or as simple as the web developer wants it to be. HTML consists of a series of elements, which you use to enclose, wrap, or mark up different parts of content to make it appear or act in a certain way. The enclosing tags can make content into a hyperlink to connect to another page, italicize words, and so on. For example, consider the following line of text: My cat is very grumpy If we wanted the text to stand by itself, we could specify that it is a paragraph by enclosing it in a paragraph (<p>) element: <p>My cat is very grumpy</p> Note: Tags in HTML are case-insensitive. This means they can be written in uppercase or lowercase. For example, a <title> tag could be written as <title>, <TITLE>, <Title>, <TiTlE>, etc., and it will work.
...ext. The closing tag: This is the same as the opening tag, except that it includes a forward slash before the element name. This marks where the element ends. Failing to include a closing tag is a common beginner error that can produce peculiar results. The element is the opening tag, followed by content, followed by the closing tag. Active learning: creating your first HTML element Edit the line below in the Input area by wrapping it with the tags <em> and </em>. To open the element, put the opening tag <em> at the start of the line. To close the element, put the closing tag </em> at the end of the line. Doing this should give the line italic text formatting! See your changes update live in the Output area. If you make a mistake, you can clear your work using the Reset button. If you ge...
...strong element first, before closing the p. The following is an example of the wrong way to do nesting: <p>My cat is <strong>very grumpy.</p></strong> The tags have to open and close in a way that they are inside or outside one another. With the kind of overlap in the example above, the browser has to guess at your intent. This kind of guessing can result in unexpected results. Block versus inline elements There are two important categories of elements to know in HTML: block-level elements and inline elements. Block-level elements form a visible block on a page. A block-level element appears on a new line following the content that precedes it. Any content that follows a block-level element also appears on a new line. Block-level elements are usually structural elements on the page. Fo...
...And 9 more matches
Index - Learn web development
's infrastructure -- whether you need to build a multi-tiered web application from scratch or host a static website. Here's a step-by-step guide to hosting your website on Google App Engine. ...
...ML file, dragging and dropping it into the browser window, or choosing File > Open... and navigating to the HTML file. There are many ways to achieve this. 21 How do you upload your files to a web server? Beginner, FTP, GitHub, Uploading, WebMechanics, hosting, rsync, sftp If you have built a simple web page (see HTML basics for an example), you will probably want to put it online, on a web server. In this article we'll discuss how to do that, using various available options such as SFTP clients, RSync and GitHub. 22 How does the Internet work? Beginner, Tutorial, WebMechanics The Internet is the backbone of the Web, the technical infrastructure that makes the Web possible. At its most basic, the Internet is a large network of computers which communica...
...e to our front-end web developer learning pathway! 36 Getting started with the Web Beginner, CSS, Design, Guide, HTML, Index, l10n:priority, publishing, theory It's a lot of work to create a professional website, so if you're new to web development, we encourage you to start small. You won't build another Facebook right away, but it's not hard to get your own simple website online, so we'll start there. 37 CSS basics Beginner, CSS, CodingScripting, Learn, Styling, Web, l10n:priority Like HTML, CSS is not a programming language. It's not a markup language either. CSS is a style sheet language. CSS is what you use to selectively style HTML elements. For example, this CSS selects paragraph text, setting the color to red: 38 Dealing with files ...
...And 9 more matches
Build your own function - Learn web development
(panel); const msg = document.createElement('p'); msg.textContent = 'This is a message box'; panel.appendChild(msg); const closeBtn = document.createElement('button'); closeBtn.textContent = 'x'; panel.appendChild(closeBtn); closeBtn.onclick = function() { panel.parentNode.removeChild(panel); } This is quite a lot of code to go through, so we'll walk you through it bit by bit. The first line uses a DOM API function called document.querySelector() to select the <html> element and store a reference to it in a constant called html, so we can do things to it later on: const html = document.querySelector('html'); The next section uses another DOM API function called document.createElement() to create a <div> element and store a reference to it in a constant called panel. This element wi...
... message box. Briefly, the onclick handler is a property available on the button (or in fact, any element on the page) that can be set to a function to specify what code to run when the button is clicked. You'll learn a lot more about these in our later events article. We are making the onclick handler equal to an anonymous function, which contains the code to run when the button is clicked. The line inside the function uses the Node.removeChild() DOM API function to specify that we want to remove a specific child element of the HTML element -- in this case the panel <div>. closeBtn.onclick = function() { panel.parentNode.removeChild(panel); } Basically, this whole block of code is generating a block of HTML that looks like so, and inserting it into the page: <div class="msgBox"> <p>Th...
... worry too much if you don't remember exactly how every bit of it works right now! 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. Calling the function You've now got your function definition written into your <script> element just fine, but it will do nothing as it stands. ...
...And 9 more matches
Handling common JavaScript problems - Learn web development
d CSS, you can ensure better quality, less error-prone JavaScript code using a linter, which points out errors and can also flag up warnings about bad practices, etc., and be customized to be stricter or more relaxed in their error/warning reporting. The JavaScript/ECMAScript linters we'd recommend are JSHint and ESLint; these can be used in a variety of ways, some of which we'll detail below. Online The JSHint homepage provides an online linter, which allows you to enter your JavaScript code on the left and provides an output on the right, including metrics, warnings, and errors. Code editor plugins It is not very convenient to have to copy and paste your code over to a web page to check its validity several times. What you really want is a linter that will fit into your standard workfl...
... linting-related packages. You should see a package called lint at the top of the list. Install this first (using the Install button), as other linters rely on it to work. After that, install the linter-jshint plugin. After the packages have finished installing, try loading up a JavaScript file: you'll see any issues highlighted with green (for warnings) and red (for errors) circles next to the line numbers, and a separate panel at the bottom provides line numbers, error messages, and sometimes suggested values or other fixes. Other popular editors have similar linting packages available. For example, see the "Plugins for text editors and IDEs" section of the JSHint install page. Other uses There are other ways to use such linters; you can read about them on the JSHint and ESLint instal...
...tom provides line numbers, error messages, and sometimes suggested values or other fixes. Other popular editors have similar linting packages available. For example, see the "Plugins for text editors and IDEs" section of the JSHint install page. Other uses There are other ways to use such linters; you can read about them on the JSHint and ESLint install pages. It is worth mentioning command line uses -- you can install these tools as command line utilities (available via the CLI -- command line interface) using npm (Node Package Manager -- you'll have to install NodeJS first). For example, the following command installs JSHint: npm install -g jshint You can then point these tools at JavaScript files you want to lint, for example: You can also use these tools with a task runner/build ...
...And 9 more matches
MathML Demo: <mfrac> - fractions
Inline, auto, normal line sin ? ? , numerator and denominator should render script size. Inline, display style, normal line ln x y , numerator and denominator should render normal size. Inline, text style, normal line tan ? ...
... Inline, auto, normal line sin ? ? , numerator and denominator should render script size. Inline, display style, normal line ln x y , numerator and denominator should render normal size. Inline, text style, normal line tan ? ...
... Inline, auto, normal line sin ? ? , numerator and denominator should render script size. Inline, display style, normal line ln x y , numerator and denominator should render normal size. Inline, text style, normal line tan ? ...
...And 9 more matches
NSS tools : signtool
ntool always requires the use of the -d option to specify where the database files are located. -e extension Tells signtool to sign only files with the given extension; for example, use -e".class" to sign only Java class files. Note that with Netscape Signing Tool version 1.1 and later this option can appear multiple times on one command line, making it possible to specify multiple file types or classes to include. -f commandfile Specifies a text file containing Netscape Signing Tool options and arguments in keyword=value format. All options and arguments can be expressed through this file. For more information about the syntax used with this file, see "Tips and Techniques". ...
...r more details, see the description of -m that follows. The -i option provides a straightforward way to provide this information if you don't need to specify any metadata other than an installer script. -j directory Specifies a special JavaScript directory. This option causes the specified directory to be signed and tags its entries as inline JavaScript. This special type of entry does not have to appear in the JAR file itself. Instead, it is located in the HTML page containing the inline scripts. When you use signtool -v, these entries are displayed with the string NOT PRESENT. -k key ... directory Specifies the nickname (key) of the certificate you want to sign w...
... Thus, it is possible to write signtool -k MyCert -d . signdir You may have trouble if the nickname contains a single quotation mark. To avoid problems, escape the quotation mark using the escape conventions for your platform. ...
...And 9 more matches
nsIHTMLEditor
nsIDOMElement getElementOrParentByTagName(in AString aTagName, in nsIDOMNode aNode); AString getFontColorState(out boolean aMixed); AString getFontFaceState(out boolean aMixed); AString getHeadContentsAsHTML(); AString getHighlightColorState(out boolean aMixed); void getIndentState(out boolean aCanIndent, out boolean aCanOutdent); void getInlineProperty(in nsIAtom aProperty, in AString aAttribute, in AString aValue, out boolean aFirst, out boolean aAny, out boolean aAll); AString getInlinePropertyWithAttrValue(in nsIAtom aProperty, in AString aAttribute, in AString aValue, out boolean aFirst, out boolean aAny, out boolean aAll); nsISupportsArray getLinkedObjects(); void getListItemState(out boolean aMixed, out ...
... boolean isAnonymousElement(in nsIDOMElement aElement); void makeOrChangeList(in AString aListType, in boolean entireList, in AString aBulletType); boolean nodeIsBlock(in nsIDOMNode node); void pasteNoFormatting(in long aSelectionType); void rebuildDocumentFromSource(in AString aSourceString); void removeAllDefaultProperties(); void removeAllInlineProperties(); void removeDefaultProperty(in nsIAtom aProperty, in AString aAttribute, in AString aValue); void removeInlineProperty(in nsIAtom aProperty, in AString aAttribute); void removeInsertionListener(in nsIContentFilter inFilter); void removeList(in AString aListType); void replaceHeadContentsWithHTML(in AString aSourceToInsert); void se...
...Filter inFilter); void removeList(in AString aListType); void replaceHeadContentsWithHTML(in AString aSourceToInsert); void selectElement(in nsIDOMElement aElement); void setBackgroundColor(in AString aColor); void setBodyAttribute(in AString aAttr, in AString aValue); void setCaretAfterElement(in nsIDOMElement aElement); void setCSSInlineProperty(in nsIAtom aProperty, in AString aAttribute, in AString aValue); void setDocumentTitle(in AString aTitle); void setInlineProperty(in nsIAtom aProperty, in AString aAttribute, in AString aValue); void setParagraphFormat(in AString aParagraphFormat); void updateBaseURL(); Attributes Attribute Type Description isCSSEnabled ...
...And 9 more matches
Using Service Workers - Web APIs
The premise of service workers One overriding problem that web users have suffered with for years is loss of connectivity. ...
...e a good idea because it allowed you to specify assets to cache really easily. However, it made many assumptions about what you were trying to do and then broke horribly when your app didn't follow those assumptions exactly. Read Jake Archibald's (unfortunately-titled but well-written) Application Cache is a Douchebag for more details. Note: As of Firefox 44, when AppCache is used to provide offline support for a page a warning message is now displayed in the console advising developers to use Service workers instead (bug 1204581.) Service workers should finally fix these issues. Service worker syntax is more complex than that of AppCache, but the trade off is that you can use JavaScript to control your AppCache-implied behaviors with a fine degree of granularity, allowing you to handle th...
...hould finally fix these issues. Service worker syntax is more complex than that of AppCache, but the trade off is that you can use JavaScript to control your AppCache-implied behaviors with a fine degree of granularity, allowing you to handle this problem and many more. Using a Service worker you can easily set an app up to use cached assets first, thus providing a default experience even when offline, before then getting more data from the network (commonly known as Offline First). This is already available with native apps, which is one of the main reasons native apps are often chosen over web apps. Setting up to play with service workers Many service workers features are now enabled by default in newer versions of supporting browsers. If however you find that demo code is not working in y...
...And 9 more matches
WebGL best practices - Web APIs
e fragment shader. This is because per draw call, fragment shaders generally run many more times than vertex shaders. Any calculation that can be done on the vertices and then just interpolated among fragments (via varyings) is a performance boon. (The interpolation of varyings is very cheap, and is done automatically for you through the fixed functionality rasterization phase of the graphics pipeline) For example, a simple animation of a textured surface can be achieved through a time-dependent transformation of texture coordinates. (The simplest case being adding a uniform vector to the texture coordinates attribute vector) If visually acceptable, one can transform the texture coordinates in the vertex shader rather than in the fragment shader, to get better performance. One common trade-o...
...(The spec calls this "color-renderable formats") For example, if a system supports float-textures but not render-to-float, generateMipmaps will fail for fl...
...(The spec calls this "color-renderable formats") For example, if a system supports float-textures but not render-to-float, generateMipmaps will fail for float formats. Support for float texture...
...And 9 more matches
Basic Concepts of grid layout - CSS: Cascading Style Sheets
ystem to CSS. Grids can be used to lay out major page areas or small user interface elements. This article introduces the CSS Grid Layout and the new terminology that is part of the CSS Grid Layout Level 1 specification. The features shown in this overview will then be explained in greater detail in the rest of this guide. What is a grid? A grid is a set of intersecting horizontal and vertical lines defining columns and rows. Elements can be placed onto the grid within these column and row lines. CSS grid layout has the following features: Fixed and flexible track sizes You can create a grid with fixed track sizes - using pixels for example. This sets the grid to the specified pixel which fits to the layout you desire. You can also create a grid using flexible sizes with percentages or wi...
...following features: Fixed and flexible track sizes You can create a grid with fixed track sizes - using pixels for example. This sets the grid to the specified pixel which fits to the layout you desire. You can also create a grid using flexible sizes with percentages or with the new fr unit designed for this purpose. Item placement You can place items into a precise location on the grid using line numbers, names or by targeting an area of the grid. Grid also contains an algorithm to control the placement of items not given an explicit position on the grid. Creation of additional tracks to hold content You can define an explicit grid with grid layout. The Grid Layout specification is flexible enough to add additional rows and columns when needed. Features such as adding "as many columns t...
...erlap each other. This layering may then be controlled with the z-index property. Grid is a powerful specification that, when combined with other parts of CSS such as flexbox, can help you create layouts that were previously impossible to build in CSS. It all starts by creating a grid in your grid container. The Grid container We create a grid container by declaring display: grid or display: inline-grid on an element. As soon as we do this, all direct children of that element become grid items. In this example, I have a containing div with a class of wrapper and, inside are five child elements. <div class="wrapper"> <div>One</div> <div>Two</div> <div>Three</div> <div>Four</div> <div>Five</div> </div> I make the .wrapper a grid container. .wrapper { display: grid; } * {bo...
...And 9 more matches
Animatable CSS properties - CSS: Cascading Style Sheets
Certain CSS properties can be animated using CSS Animations or CSS Transitions. Animation means that their values can be made to change gradually over a given amount of time. ...
... Certain CSS properties can be animated using CSS Animations or CSS Transitions. Animation means that their values can be made to change gradually over a given amount of time. ...
... Certain CSS properties can be animated using CSS Animations or CSS Transitions. Animation means that their values can be made to change gradually over a given amount of time. ...
...And 9 more matches
justify-self - CSS: Cascading Style Sheets
appropriate axis. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. The effect of this property is dependent of the layout mode we are in: In block-level layouts, it aligns an item inside its containing block on the inline axis. For absolutely-positioned elements, it aligns an item inside its containing block on the inline axis, accounting for the offset values of top, left, bottom, and right. In table cell layouts, this property is ignored (more about alignment in block, absolute positioned and table layout) In flexbox layouts, this property is ignored (more about alignment in Flexbox) In grid layouts, it alig...
...s, it aligns an item inside its containing block on the inline axis, accounting for the offset values of top, left, bottom, and right. In table cell layouts, this property is ignored (more about alignment in block, absolute positioned and table layout) In flexbox layouts, this property is ignored (more about alignment in Flexbox) In grid layouts, it aligns an item inside its grid area on the inline axis (more about alignment in grid layouts) Syntax /* Basic keywords */ justify-self: auto; justify-self: normal; justify-self: stretch; /* Positional alignment */ justify-self: center; /* Pack item around the center */ justify-self: start; /* Pack item from the start */ justify-self: end; /* Pack item from the end */ justify-self: flex-start; /* Equivalent to 'start'. Note th...
...m the end */ justify-self: flex-start; /* Equivalent to 'start'. Note that justify-self is ignored in Flexbox layouts. */ justify-self: flex-end; /* Equivalent to 'end'. Note that justify-self is ignored in Flexbox layouts. ...
...And 9 more matches
shape-outside - CSS: Cascading Style Sheets
The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
... Values none The float area i...
... <shape-box> The float area is computed according to the shape of a float element's edges (as defined by the CSS box model). This can be margin-box, border-box, padding-box, or content-box. ...
...And 9 more matches
Text formatting - JavaScript
ons. toLowerCase, toUpperCase Return the string in all lowercase or all uppercase, respectively. normalize Returns the Unicode Normalization Form of the calling string value. repeat Returns a string consisting of the elements of the object repeated the given times. trim Trims whitespace from the beginning and end of the string. Multi-line template literals Template literals are string literals allowing embedded expressions. You can use multi-line strings and string interpolation features with them. Template literals are enclosed by the back-tick (` `) (grave accent) character instead of double or single quotes. Template literals can contain place holders. These are indicated by the Dollar sign and curly braces (${expression}). ...
...ate literals Template literals are string literals allowing embedded expressions. You can use multi-line strings and string interpolation features with them. Template literals are enclosed by the back-tick (` `) (grave accent) character instead of double or single quotes. Template literals can contain place holders. These are indicated by the Dollar sign and curly braces (${expression}). Multi-lines Any new line characters inserted in the source are part of the template literal. ...
...ls are enclosed by the back-tick (` `) (grave accent) character instead of double or single quotes. Template literals can contain place holders. These are indicated by the Dollar sign and curly braces (${expression}). Multi-lines Any new line characters inserted in the source are part of the template literal. ...
...And 9 more matches
CSS3 - Archive of obsolete content
arget, :enabled and :disabled, :checked, :indeterminate, :root, :nth-child and :nth-last-child, :nth-of-type and :nth-last-of-type, :last-child, :first-of-type and :last-of-type, :only-child and :only-of-type,:empty, and :not. Pseudo-elements are now characterized by two colons rather than one: :after becomes ::after, :before becomes ::before, :first-letter becomes ::first-letter, and :first-line becomes ::first-line. The new general sibling combinator ( h1~pre ). The next iteration of the Selectors specification is already in progress, though it still hasn't reached the First Public Working Draft stage. Media Queries Recommendation since June 19th, 2012 Extends the former media type ( print, screen, ... ) to a full language allowing queries...
... ::value, ::choices, ::repeat-item, and ::repeat-index may be postponed to the next iteration of this module . Support for icons, defined by the CSS icon property simultaneously with the new icon value of the CSS content property. At risk: due to insufficient browser support, standardization of the icon property and the icon value may be postponed to CSS4. Support for the CSS outline-offset property giving more control on the position of the outline. Support for the CSS resize property allowing Web authors to control if and how elements should be resized. Support for the CSS text-overflow property defining how text overflows, if needed. At risk: due to insufficient browser support, the 2-value syntax of this property as well as the support for <string> values ...
...iteration of this module. Several types definition, like <ident> and <custom-ident>, have been deferred to CSS Values and Units Module Level 4. CSS Flexible Box Layout Module Candidate Recommendation Add a flexbox layout to the CSS display property and several new CSS properties to control it: flex, flex-align, flex-direction, flex-flow, flex-item-align, flex-line-pack, flex-order, flex-pack, and flex-wrap. CSS Cascading and Inheritance Level 3 Candidate Recommendation Adds: The initial, unset values for properties. The CSS all property. The scoping mechanism. Clarifies: Interaction of media-dependent @import statements and style sheet loading requirements. ...
...And 8 more matches
Venkman Introduction - Archive of obsolete content
have, type /version in the Interactive Session view. For more information about the latest improvements and versions, see the Venkman Development Page. There are two ways to start the debugger: From Firefox, you can start it by selecting JavaScript Debugger from the Tools menu (Tools->Web Development menu in Mozilla 1.x and Netscape). You can also start the browser with the -venkman command line option, which launches Venkman initially instead of an application front end. (Note that Venkman displays usage data when it starts up: "Recorded local startup X, global YYY." This data comes from a counter built in to the application. For more information about this counter and the data, see Item 2.2 in the Venkman FAQ.) When you first start Venkman, the basic views are arranged as in the s...
... their use within the interface as a whole. Getting Acquainted with Venkman's User Interface Toolbar The Toolbar is located at the top of the debugger. The Toolbar contains icons for Stop, Continue, Step Over, Step Into, Step Out, Profile, and Pretty Print commands. These commands should be self explanatory, with the possible exception of Stop, which causes the debugger to stop when the next line of JavaScript is executed, and the Profile button, which can be used to measure execution times for your scripts. When you enable profiling by clicking this button, a green checkmark appears next to the button and profile data for every function is collected, and can be saved by choosing Save Profile Data As... from the Profile menu. Figure 4. Stop Button Waiting for Execution Also note ...
...ent is executed. The Pretty Print button toggles Pretty Print mode. While in Pretty Print mode, the contents of the source view will contain the decompiled source text for the selected function. This is the same text you would get from the toSource method of the Function prototype. If the source text you are debugging is poorly formatted, Pretty Print can help make it easier to read by inserting line breaks and whitespace in appropriate places. When Pretty Print is enabled you will see a green check mark on the toolbar button, and the menu item will be checked as well. The Loaded Scripts View The Loaded Scripts View is in the top left portion of the window. When a file is loaded by the browser it will appear in this view, and when unloaded it will be removed. Files are listed in alphabet...
...And 8 more matches
Reading from Files - Archive of obsolete content
s of reading bytes, strings or other values from the file. While there is only one method to create an input stream, it provides a number of options to control exactly how reading is performed. For instance, there are options to read a file as if it were text or a binary file. Using the former will cause characters in the stream to be interpreted with a particular character encoding. In addition, lines may be read by reading the file up until a linefeed character is detected. A binary stream would be used to read bytes or numbers encoded within the file. To create an input stream, first get a reference to a nsIFile, and then use nsIScriptableIO.newInputStream() to open a stream for reading from it. To learn more about file objects, see Files and Streams. var file = IO.getFile("Home", "sample.t...
...will occupy a single byte whereas characters above value 128 will occupy multiple bytes, depending on their value. However, a number of other character encodings are available; see Reading Other Character Encodings below for details about reading text in other encodings. There are several methods available to read from an input stream. The two most common for text files are the readString and readLine methods for reading a string and a line from the file respectively. var file = IO.getFile("Home", "sample.txt"); var stream = IO.newInputStream(file, "text"); var str = stream.readString(20); stream.close(); In this example, a text input stream is created for the file 'sample.txt'. The readString method is called to read a 20 character string from the file. Since the stream was just opened, the ...
...data to read. Note that the last string read may be less than ten characters long. while(stream.available()) output += stream.readString(10); The close method is used at the end to close the stream when you are finished reading from it. You should always strive to close a stream when you have finished reading or writing to it to ensure that it doesn't remain open longer than necessary. Reading Lines The readLine method may be used to read a line from the file. This method doesn't take a count of characters to read but instead keeps reading until the end of a line is reached. This method handles all the different types of end of line characters and combinations, so you do not need to worry about platform specific conventions. The line read from the file is returned by the readLine method. It...
...And 8 more matches
SeaMonkey - making custom toolbar (SM ver. 1.x) - Archive of obsolete content
where you installed SeaMonkey, then go to the chrome directory there. Note: For information about how to find the directory where you installed SeaMonkey, see: Installation directory If you cannot easily find the directory, you can use the following method to find it. From SeaMonkey's menu bar, choose Tools - Web Development - JavaScript Console. Copy the following code. It is one very long line ending in path--make sure that you get all of it: Components.classes["@mozilla.org/file/directory_service;1"].getService( Components.interfaces.nsIProperties).get("AChrom", Components.interfaces.nsIFile).path In the JavaScript Console window, paste the code in the field near the top. Presss the Return or Enter key, or the Evaluate button. The console displays the location of SeaMonkey's chrom...
...iles that are provided by extensions. Your toolbar button will be an extension. 2. Delete these two files: chrome.rdf overlays.rdf Explanation: SeaMonkey automatically rebuilds these files the next time it starts. When it rebuilds them, it will include your new extension. 3. Edit the file: installed-chrome.txt At the end of the file, add the following line. Copy and paste the line from here, to avoid typing errors: content,install,url,resource:/chrome/custombutton/ Explanation: This line registers your custom toolbar button extension, linking it into SeaMonkey. 4. Create a new directory named: custombutton Perform the following steps in this new directory, creating five files there. Explanation: Th...
...> </RDF:li> <!-- calendar --> <RDF:li> <RDF:Seq about="chrome://calendar/content/calendar.xul"> <RDF:li>chrome://custombutton/content/button.xul</RDF:li> </RDF:Seq> </RDF:li> </RDF:Seq> </RDF:RDF> Optionally customize the file by changing the displayName, description and author attributes. Change the text between double-quote characters on those three lines. Optionally remove the sections for toolbars where you do not want your button. Save the file. Explanation: This file contains details of your extension, and specifies how it modifies SeaMonkey. 6. Create a plain text file named button.xul. Copy the following content, making sure that you scroll to get all of it. Paste it into the new file: <?xml version="1.0" encoding="...
...And 8 more matches
Grids - Learn web development
to get started with page layout. Prerequisites: HTML basics (study Introduction to HTML), and an idea of how CSS works (study Introduction to CSS and Styling boxes.) Objective: To understand the fundamental concepts behind grid layout systems, and how to implement a grid layout using CSS Grid. What is grid layout? A grid is a collection of horizontal and vertical lines creating a pattern against which we can line up our design elements. They help us to create designs where elements don't jump around or change width as we move from page to page, providing greater consistency on our websites. A grid will typically have columns, rows, and then gaps between each row and column -- commonly referred to as gutters. Creating your grid in CSS Having decided on the...
...r { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); grid-auto-rows: minmax(100px, auto); grid-gap: 20px; } This works because grid is creating as many 200 pixel columns as will fit into the container, then sharing whatever space is leftover between all of the columns -- the maximum is 1fr which, as we already know, distributes space evenly between tracks. Line-based placement We now move on from creating a grid, to placing things on the grid. Our grid always has lines, which lines start at 1 and relate to the Writing Mode of the document. Therefore in English, column line 1 is on the left hand side of the grid and row line 1 at the top. In Arabic column line 1 would be on the right hand side, as Arabic is written right to left. We can place things ac...
... We now move on from creating a grid, to placing things on the grid. Our grid always has lines, which lines start at 1 and relate to the Writing Mode of the document. Therefore in English, column line 1 is on the left hand side of the grid and row line 1 at the top. In Arabic column line 1 would be on the right hand side, as Arabic is written right to left. We can place things according to these lines by specifying the start and end line. We do this using the following properties: grid-column-start grid-column-end grid-row-start grid-row-end These properties can all have a line number as the value. You can also use the shorthand properties: grid-column grid-row These let you specify the start and end lines at once, separated by a / -- a forward slash character. Download this fi...
...And 8 more matches
Introduction to CSS layout - Learn web development
end!</p> By default, the browser will display this code as follows: Note here how the HTML is displayed in the exact order in which it appears in the source code, with elements stacked up on top of one another -- the first paragraph, followed by the unordered list, followed by the second paragraph. The elements that appear one below the other are described as block elements, in contrast to inline elements, which appear one beside the other, like the individual words in a paragraph. Note: The direction in which block element contents are laid out is described as the Block Direction. The Block Direction runs vertically in a language such as English, which has a horizontal writing mode. It would run horizontally in any language with a Vertical Writing Mode, such as Japanese. The correspond...
...nts, which appear one beside the other, like the individual words in a paragraph. Note: The direction in which block element contents are laid out is described as the Block Direction. The Block Direction runs vertically in a language such as English, which has a horizontal writing mode. It would run horizontally in any language with a Vertical Writing Mode, such as Japanese. The corresponding Inline Direction is the direction in which inline contents (such as a sentence) would run. For many of the elements on your page the normal flow will create exactly the layout you need, however for more complex layouts you will need to alter this default behavior using some of the tools available to you in CSS. Starting with a well-structured HTML document is very important, as you can then work with ...
...outs you will need to alter this default behavior using some of the tools available to you in CSS. Starting with a well-structured HTML document is very important, as you can then work with the way things are laid out by default rather than fighting against it. The methods that can change how elements are laid out in CSS are as follows: The display property -- Standard values such as block, inline or inline-block can change how elements behave in normal flow, for example making a block-level element behave like an inline element (see Types of CSS boxes for more information). We also have entire layout methods that are switched on via specific display values, for example CSS Grid and Flexbox, which alter how elements inside the element they are set on are laid out. Floats -- Applying a flo...
...And 8 more matches
Normal Flow - Learn web development
h regard to normal document flow. How are elements laid out by default? First of all, individual element boxes are laid out by taking the elements' content, then adding any padding, border and margin around them -- it's that box model thing again, which we've looked at earlier. By default, a block level element's content is 100% of the width of its parent element, and as tall as its content. ...
...xes are laid out by taking the elements' content, then adding any padding, border and margin around them -- it's that box model thing again, which we've looked at earlier. By default, a block level element's content is 100% of the width of its parent element, and as tall as its content. Inline elements are as tall as their content, and as wide as their content. You can't set width or height on inline elements -- they just sit inside the content of block level elements. ...
...at box model thing again, which we've looked at earlier. By default, a block level element's content is 100% of the width of its parent element, and as tall as its content. Inline elements are as tall as their content, and as wide as their content. You can't set width or height on inline elements -- they just sit inside the content of block level elements. ...
...And 8 more matches
TypeScript support in Svelte - Learn web development
efits it can bring us. Then we'll see how to configure our project to work with TypeScript files. Finally we will go over our app and see what modifications we have to make to fully take advantage of TypeScript features. Prerequisites: At minimum, it is recommended that you are familiar with the core HTML, CSS, and JavaScript languages, and have knowledge of the terminal/command line. You'll need a terminal with node + npm installed to compile and build your app. Objective: Learn how to configure and use TypeScript when developing Svelte applications. Note that our application is fully functional and porting it to TypeScript is completely optional. There are different opinions about it, and in this chapter we will talk briefly about the pros and co...
... the Alert component call, TypeScript will infer from the default value that the ms property should be a number: And if you pass something that is not a number it will complain about it: The application template has a validate script configured that runs svelte-check against your code. This package allows you to detect errors and warnings normally displayed by a code editor from the command line, which makes it pretty useful for running it in a continuous integration (CI) pipeline. Just run npm run validate to check for unused CSS, and return A11y hints and TypeScript compile errors. In this case, if you run npm run validate (either in the VS Code console or terminal) you will get the following error: Even better, if you run it from the VS Code integrated terminal (you can open it wi...
...run npm run validate to check for unused CSS, and return A11y hints and TypeScript compile errors. In this case, if you run npm run validate (either in the VS Code console or terminal) you will get the following error: Even better, if you run it from the VS Code integrated terminal (you can open it with the Ctrl + ` keyboard shortcut), Cmd/Ctrl + clicking on the file name will take you to the line containing the error. You can also run the validate script in watch mode with npm run validate -- --watch. In this case, the script will execute whenever you change any file. If you are running this in your regular terminal, you are advised to keep it running in the background in a separate terminal window of its own so that it can keep reporting errors but won't interfere with other terminal us...
...And 8 more matches
Styling Vue components with CSS - Learn web development
Previous Overview: Client-side JavaScript frameworks Next The time has finally come to make our app look a bit nicer. In this article we'll explore the different ways of styling Vue components with CSS. Prerequisites: Familiarity with the core HTML, CSS, and JavaScript languages, knowledge of the terminal/command line. Vue components are written as a combination of JavaScript objects that manage the app's data and an HTML-based template syntax that maps to the underlying DOM structure. For installation, and to use some of the more advanced features of Vue (like Single File Components or render functions), you'll need a terminal with node + npm installed. Objective: To learn about styling Vue components. Styling Vue components with CSS Be...
...Webpack. This means we can use CSS pre-processors (like SCSS) or post-processors (like PostCSS). While this tutorial will not be using such tools, it's good to know that when including such code in the assets folder it will be processed automatically. ...
...css file: /*reset.css*/ /* RESETS */ *, *::before, *::after { box-sizing: border-box; } *:focus { outline: 3px dashed #228bec; } html { font: 62.5% / 1.15 sans-serif; } h1, h2 { margin-bottom: 0; } ul { list-style: none; padding: 0; } button { border: none; margin: 0; padding: 0; width: auto; overflow: visible; background: transparent; color: inherit; font: inherit; line-height: normal; -webkit-font-smoothing: inherit; -moz-osx-font-smoothing: inherit; -webkit-appearance: none; } button::-moz-focus-inner { border: 0; } button, input, optgroup, select, textarea { font-family: inherit; font-size: 100%; line-height: 1.15; margin: 0; } button, input { /* 1 */ overflow: visible; } input[type="text"] { border-radius: 0; } body { width: 100%; m...
...And 8 more matches
IME handling guide
or more words into a composition string. When a user converts from Hiragana characters to Chinese characters the composition string, Japanese IME separates the composition string into multiple clauses. For example, if a user types "watasinonamaehanakanodesu", it's converted to Hiragana characters, "?????????????", automatically (In the following screenshots, the composition string has a wavy underline and the only one clause is called "raw input clause"). When a user presses Convert key, Japanese IME separates the composition string as "????" (my), "????" (name is) and "?????" (Nakano). Then, converts each clause with Chinese characters: "??", "???" and "????" (In the following screenshot each clause is underlined and not connected adjacently. These clauses are called "converted clause").
... Basically, composition string and each clause style is rendered by Gecko. And the drop down menu is created by IME. Each clause is represented with selection in the editor. From chrome script, you can check it with nsISelectionController. ...
...ts are already handled in the remote process, ContentCacheInParent sending the notifications to widget. And also this handles WidgetQueryContentEvents with its cache. Supported event messages of them are: eQuerySelectedText (only with SelectionType::eNormal) eQueryTextContent eQueryTextRect eQueryCaretRect eQueryEditorRect Additionally, this does not support query content events with XP line breakers but this must not be any problem since native IME handlers query contents with native line breakers. ContentCacheInParent also manages sent WidgetCompositionEvents and WidgetSelectionEvents. After these events are handled in the remote process, TabParent receives it with a call of RecvOnEventNeedingAckHandled(). Then, it calls ContentCacheInParent::OnEventNeedingAckHandled(). Finally, C...
...And 8 more matches
Application Translation with Mercurial
A comparison of alternatives (e.g. for Linux and Mac OS) is available on Wikipedia. File and text editor For editing individual files a text editor can be a better choice than a file comparion program, e.g. because the file is new and everything has to be translated, the file is too customized to compare it to the English one, or special functionality is required (e.g. bookmarking untranslated lines). Use a text editor you are comfortable with. This example uses Notepad++. Progress tracking tool To track which strings and files already have been translated and later also to see which new strings have already been tested in the product as being a good translation for the functionality behind the translated strings and that the translated texts fit into the available, the translation progre...
... test it, improve it, upload it for review and get review (maybe not approved on first try). Other localizers will likely have done changes to the translation, either adding new texts, removing obsolete ones or improving the current texts. This can cause conflicts between the changes you created and theirs. For this reason, updating patches kann be necessary so Mercurial is still able to find the lines in the files which it has to replace or where it has to add them. Mercurial queues allow to revert changes and also pull changes and reapply your local changes. Go back to the localization directory: cd /c/Mozilla/de-mozilla-aurora Initiate Mercurial queues: hg qinit Get to know the translation style For having good chances that the translation suggestions get accepted, they should match t...
...a-aurora Initiate Mercurial queues: hg qinit Get to know the translation style For having good chances that the translation suggestions get accepted, they should match the translation style of the texts in the application already translated. In general, the labels in the applications should have the same style like the operating system, e.g. use the same order of subject, verb and objects; decline verbs or not like the operating system does. The following resources can help figuring out the translation style and translate according to them: Check your localization team's page by clicking on the team with your language code (e.g. "de" for German) for a style guide (e.g. style guide for German). Transvision offers searching for texts and text ids ("entities" or "keys"), allowing to quic...
...And 8 more matches
AsyncTestUtils extended framework
import everything you need: load("../../mailnews/resources/logHelper.js"); load("../../mailnews/resources/asyncTestUtils.js"); load("../../mailnews/resources/messageGenerator.js"); load("../../mailnews/resources/messageModifier.js"); load("../../mailnews/resources/messageInjection.js"); If the directory where you are adding the tests does not have a head_*.js file that has the two following lines, add them at the top of your test file (before the lines shown above): load("../../mailnews/resources/mailDirService.js"); load("../../mailnews/resources/mailTestUtils.js"); At the bottom of the test file, add the following: var tests =[ // list your tests here ]; function run_test() { configure_message_injection({mode: "local"}); async_run_tests(tests); } Asynchronous testing b...
...ozMill is an example of a testing framework that uses a nested event loop. In the future we will probably move the AsyncTestUtils framework to a nested event loop in a backwards-compatible fashion. How does this affect my tests? Thanks to JavaScript enhancements available on the Mozilla platform, it is possible for a function to yield control in such a way that the function stops running at the line where you use a yield statement and resumes execution on the next line when resumed. This allows you to write reasonably normal looking functions instead of having to chain together a whole bunch of functions and callbacks. Your test functions need to agree to the following contract: The Asynchronous Function Contract A function should yield false or return false when something asynchronous i...
...n apply. Configuring message injection Local Injection let inboxFolder = configure_message_injection({mode: "local"}); Set up message injection to happen locally. This is different from using a POP fake-server. We just cram them using addMessage, although we try and approximate what would happen with POP in terms of still invoking filters and such. IMAP Injection, do not bring messages offline let inboxFolder = configure_message_injection({mode: "imap", offline: false}); Use an IMAP fake-server to inject messages. We do not mark the folders as offline and therefore do not attempt to download the messages so that they are immediately available for offline use. If you later want to bring the messages offline, use the make_folder_and_contents_offline function. IMAP Injection, do bring ...
...And 8 more matches
nsISupportsArray
xpcom/ds/nsISupportsArray.idlScriptable Please add a summary to this article. ...
...nherits from: nsICollection Last changed in Gecko 1.7 Method overview boolean AppendElements(in nsISupportsArray aElements); Violates the XPCOM interface guidelines nsISupportsArray clone(); void Compact(); void DeleteElementAt(in unsigned long aIndex); void DeleteLastElement(in nsISupports aElement); nsISupports ElementAt(in unsigned long aIndex); Violates the XPCOM interface guidelines boolean EnumerateBackwards(in nsISupportsArrayEnumFunc aFunc, in voidPtr aData); Violates the XPCOM interface guidelines boolean EnumerateForwards(in nsISupportsArrayEnumFunc aFunc, in voidPtr aData); Violates the XPCOM interface guidelines boolean Equals([const] in nsISupportsArray other); Violates the XPCOM interface guidelines long GetIndexOf(in nsISupports aPossibleElement); long G...
...face guidelines boolean Equals([const] in nsISupportsArray other); Violates the XPCOM interface guidelines long GetIndexOf(in nsISupports aPossibleElement); long GetIndexOfStartingAt(in nsISupports aPossibleElement, in unsigned long aStartIndex); long GetLastIndexOf(in nsISupports aPossibleElement); long IndexOf([const] in nsISupports aPossibleElement); Violates the XPCOM interface guidelines long IndexOfStartingAt([const] in nsISupports aPossibleElement, in unsigned long aStartIndex); Violates the XPCOM interface guidelines boolean InsertElementAt(in nsISupports aElement, in unsigned long aIndex); Violates the XPCOM interface guidelines boolean InsertElementsAt(in nsISupportsArray aOther, in unsigned long aIndex); Violates the XPCOM interface guidelines long LastIndexOf([con...
...And 8 more matches
Browser Console - Firefox Developer Tools
ly, you can execute JavaScript expressions using the Browser Console. But while the Web Console executes code in the page window scope, the Browser Console executes them in the scope of the browser's chrome window. This means you can interact with all the browser's tabs using the gBrowser global, and even with the XUL used to specify the browser's user interface. NB: The Browser Console command line (to execute JavaScript expressions) is disabled by default. To enable it set the devtools.chrome.enabled preference to true in about:config, or set the "Enable browser chrome and add-on debugging toolboxes" (Firefox 40 and later) option in the developer tool settings. Opening the Browser Console You can open the Browser Console in one of two ways: from the menu: select "Browser Console" fr...
... tool settings. Opening the Browser Console You can open the Browser Console in one of two ways: from the menu: select "Browser Console" from the Web Developer submenu in the Firefox Menu (or Tools menu if you display the menu bar or are on macOS). from the keyboard: press Ctrl+Shift+J (or Cmd+Shift+J on a Mac). You can also start the Browser Console by launching Firefox from the command line and passing the -jsconsole argument: /Applications/FirefoxAurora.app/Contents/MacOS/firefox-bin -jsconsole The Browser Console looks like this: You can see that the Browser Console looks and behaves very much like the Web Console: most of the window is occupied by a pane that display messages. at the top, a toolbar enables you to filter the messages that appear. at the bottom, a command...
...and passing the -jsconsole argument: /Applications/FirefoxAurora.app/Contents/MacOS/firefox-bin -jsconsole The Browser Console looks like this: You can see that the Browser Console looks and behaves very much like the Web Console: most of the window is occupied by a pane that display messages. at the top, a toolbar enables you to filter the messages that appear. at the bottom, a command line interpreter enables you to evaluate JavaScript expressions. 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 Sho...
...And 8 more matches
Set a breakpoint - Firefox Developer Tools
when debugging JavaScript -- you basically set a point in your code where you would like execution of the code to pause. At this point you can do useful things like studying the value of different variables at that point, allowing you to work out why a problem is occurring. The source pane context menu In the source pane, you can handle setting breakpoints by bringing up the context menu over a line number. There are a few options available here: Add breakpoint: Add a standard unconditional breakpoint at this line number (see below). Add condition: Add a condition and create a conditional breakpoint (see below). Add log: Add a log point, which logs a value to your console rather than pausing execution as a breakpoint does. Continue to here: When stepping through code, this option te...
...r than pausing execution as a breakpoint does. Continue to here: When stepping through code, this option tells the debugging to continue execution through to this point. Unconditional breakpoints An unconditional breakpoint is one where the code will always pause execution when it is reached. You can set an unconditional breakpoint using the context menu (see above), or by: Clicking on the line number for the line you want to break at in the source pane. Highlighting the line you want to break at in the source pane and pressing Ctrl + B (Windows/Linux) or Cmd + B (macOS). The line number is highlighted in blue: In addition, if the line contains multiple function calls, each one will be given a small blue arrow icon to the left of it. These are called column breakpoints, and allow ...
... you want to break at in the source pane and pressing Ctrl + B (Windows/Linux) or Cmd + B (macOS). The line number is highlighted in blue: In addition, if the line contains multiple function calls, each one will be given a small blue arrow icon to the left of it. These are called column breakpoints, and allow you to set the breakpoint to happen exactly on any one of the function calls in the line (or multiple calls), by clicking on each relevant one. Conditional breakpoints A conditional breakpoint is one where the code will pause execution when it is reached, only if a certain condition is met, such a variable having a certain value at the time. ...
...And 8 more matches
All keyboard shortcuts - Firefox Developer Tools
4 Shift + F4 * Shift + F4 Open WebIDE Shift + F8 Shift + F8 * Shift + F8 Storage Inspector Shift + F9 Shift + F9 * Shift + F9 Open Debugger 3 Ctrl + Shift + Z Cmd + Opt + Z Ctrl + Shift + Z 1. Unlike the other toolbox-hosted tools, this shortcut does not also close the Web Console. Instead, it focuses on the Web Console's command line. To close the Web Console, use the global toolbox shortcut of Ctrl + Shift + I (Cmd + Opt + I on a Mac). 2. Before Firefox 55, the keyboard shortcut was Ctrl + Shift + Q (Cmd + Opt + Q on a Mac). 3. Starting in Firefox 71. Before Firefox 66, the letter in this shortcut was S. Toolbox These shortcuts work whenever the toolbox is open, no matter which tool is active. Command Wind...
...his, the selected bindings will be used for all the developer tools that use the source editor. You need to reopen the editor for the change to take effect. From Firefox 33 onwards, the key binding preference is exposed in the Editor Preferences section of the developer tools settings, and you can set it there instead of about:config. ...
... Ctrl + X Cmd + X Ctrl + X Copy Ctrl + C Cmd + C Ctrl + C Paste Ctrl + V Cmd + V Ctrl + V Undo Ctrl + Z Cmd + Z Ctrl + Z Redo Ctrl + Shift + Z / Ctrl + Y Cmd + Shift + Z / Cmd + Y Ctrl + Shift + Z / Ctrl + Y Indent Tab Tab Tab Unindent Shift + Tab Shift + Tab Shift + Tab Move line(s) up Alt + Up Alt + Up Alt + Up Move line(s) down Alt + Down Alt + Down Alt + Down Comment/uncomment line(s) Ctrl + / Cmd + / Ctrl + / Page Inspector Command Windows macOS Linux Inspect Element Ctrl + Shift + C Cmd + Shift + C Ctrl + Shift + C Node picker These shortcuts work while the node picker ...
...And 8 more matches
Architecture - Accessibility
options in list boxes and combo boxes. otherwise, use IAHyperLink::getStartIndex() to find the index in parent. ...
...t: If current char is 0 (end of string), then we are on a hard line break: get next node (typical depth first search), and set the current offset = 0 IAText::ch = getCharacterAtOffset(++offset); If ch == embedded object char (0xfffc) then get object for that offset (see A above), then set the current offset to -1, and go to step 2 if ch == 0 then we must determine whether we're on a hard line break: If the current accessible's IA2 role is SECTION, HEADING or PARAGRAPH then we are on a hard line break, so stop get the offset in the parent text for this object (see B above), and then repeat step (C)2 above done (D) To get the next word or line: Look one character ahead. If the next character does not exist, proceed to the next accessible in depth first s...
... offset in the parent text for this object (see B above), and then repeat step (C)2 above done (D) To get the next word or line: Look one character ahead. If the next character does not exist, proceed to the next accessible in depth first search order and recurse on the first character until a non-embed is found. If the current character falls within a text substring, locate the line ending of that substring or the next embed, whichever comes first: Get the current line start and end offsets. ...
...And 8 more matches
Aligning Items in a Flex Container - CSS: Cascading Style Sheets
vertical alignment, so we can at last easily center a box. In this guide, we will take a thorough look at how the alignment and justification properties work in Flexbox. To center our box we use the align-items property to align our item on the cross axis, which in this case is the block axis running vertically. We use justify-content to align the item on the main axis, which in this case the inline axis running horizontally. You can take a look at the code of this example below. Change the size of the container or nested element and the nested element always remains centered. Properties that control alignment The properties we will look at in this guide are as follows. justify-content -- controls alignment of all items on the main axis. align-items -- controls alignment of all it...
...ys remains centered. Properties that control alignment The properties we will look at in this guide are as follows. justify-content -- controls alignment of all items on the main axis. align-items -- controls alignment of all items on the cross axis. align-self -- controls alignment of an individual flex item on the cross axis. align-content -- described in the spec as for "packing flex lines"; controls space between flex lines on the cross axis. We will also discover how auto margins can be used for alignment in flexbox. Note: The alignment properties in Flexbox have been placed into their own specification -- CSS Box Alignment Level 3. It is expected that this spec will ultimately supersede the properties as defined in Flexbox Level One. The Cross Axis The align-items and al...
...ch to that height, regardless of how much content is in the item. The reason the items become the same height is that the initial value of align-items, the property that controls alignment on the cross axis, is set to stretch. We can use other values to control how the items align: align-items: flex-start align-items: flex-end align-items: center align-items: stretch align-items: baseline In the live example below, the value of align-items is stretch. Try the other values and see how all of the items align against each other in the flex container. Aligning one item with align-self The align-items property sets the align-self property on all of the flex items as a group. This means you can explicitly declare the align-self property to target a single item. The align-self pro...
...And 8 more matches
Mozilla CSS extensions - CSS: Cascading Style Sheets
ements. ...
...binding -moz-border-bottom-colors -moz-border-left-colors -moz-border-right-colors -moz-border-top-colors -moz-box-align -moz-box-direction -moz-box-flex -moz-box-ordinal-group -moz-box-orient -moz-box-pack C-I -moz-context-properties -moz-float-edge -moz-force-broken-image-icon -moz-image-region O -moz-orient -moz-osx-font-smoothing -moz-outline-radius -moz-outline-radius-bottomleft -moz-outline-radius-bottomright -moz-outline-radius-topleft -moz-outline-radius-topright overflow-clip-box overflow-clip-box-block overflow-clip-box-inline S-Z -moz-stack-sizing :-moz-system-metric(images-in-menus) :-moz-system-metric(mac-graphite-theme) :-moz-system-metric(scrollbar-end-backward) :-moz-system-metric(scrollbar-end-forward) :-moz-system-me...
...ill accepted] -moz-animation-name [Prefixed version still accepted] -moz-animation-play-state [Prefixed version still accepted] -moz-animation-timing-function [Prefixed version still accepted] -moz-appearance B -moz-backface-visibility [Prefixed version still accepted] -moz-background-clipObsolete since Gecko 2 -moz-background-originObsolete since Gecko 2 -moz-background-inline-policyObsolete since Gecko 32 [Superseded by the standard version box-decoration-break] -moz-background-sizeObsolete since Gecko 2 -moz-border-end [Superseded by the standard version border-inline-end] -moz-border-end-color [Superseded by the standard version border-inline-end-color] -moz-border-end-style [Superseded by the standard version border-inline-end-style] -moz-border-end-widt...
...And 8 more matches
Visual formatting model - CSS: Cascading Style Sheets
window, or change the orientation of a mobile device. If the viewport is smaller than the size of the document then the user agent needs to offer a way to scroll to the parts of the document that are not displayed. We most often see this as scrolling in the block dimension -- vertically in a horizontal, top-to-bottom language. However, you might design something that requires scrolling in the inline dimension too. Box generation Box generation is the part of the CSS visual formatting model that creates boxes from the document's elements. Generated boxes are of different types, which affect their visual formatting. The type of the box generated depends on the value of the CSS display property. Initially defined in CSS2, the display property is extended in the CSS Display Module Level 3. In...
...rates a box, and then another anonymous box. Something to consider about these anonymous boxes is that they inherit styles from their direct parent, but you cannot change how they look by targeting the anonymous box. In my examples, I am using a direct child selector to target the children of the container. This does not change the anonymous boxes, as they are not a child of the parent block. ...
...der about these anonymous boxes is that they inherit styles from their direct parent, but you cannot change how they look by targeting the anonymous box. In my examples, I am using a direct child selector to target the children of the container. This does not change the anonymous boxes, as they are not a child of the parent block. ...
...And 8 more matches
grid-column-start - CSS: Cascading Style Sheets
This start position defines the block-start edge of the grid area. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
... Values auto A keyword indicating that the property contributes nothing to the grid item's placement, indicating auto-placem...
...m-ident> values */ grid-column-start: 2; grid-column-start: somegridarea 4; /* span + <integer> + <custom-ident> values */ grid-column-start: span 3; grid-column-start: span somegridarea; grid-column-start: span somegridarea 5; /* Global values */ grid-column-start: inherit; grid-column-start: initial; grid-column-start: unset; This property is specified as a single <grid-line> value. A <grid-line> value can be specified as: either the auto keyword or a <custom-ident> value or an <integer> value or both <custom-ident> and <integer>, separated by a space or the keyword span together with either a <custom-ident> or an <integer> or both. Values auto A keyword indicating that the property contributes nothing to the grid item's placement, indicating auto-placement, an automatic spa...
...And 8 more matches
grid-row-start - CSS: Cascading Style Sheets
The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
... Values auto Is a keyword indicating that the property contributes nothing to the grid item's placement, indicating auto-pla...
...; /* <integer> + <custom-ident> values */ grid-row-start: 2; grid-row-start: somegridarea 4; /* span + <integer> + <custom-ident> values */ grid-row-start: span 3; grid-row-start: span somegridarea; grid-row-start: 5 somegridarea span; /* Global values */ grid-row-start: inherit; grid-row-start: initial; grid-row-start: unset; This property is specified as a single <grid-line> value. A <grid-line> value can be specified as: either the auto keyword or a <custom-ident> value or an <integer> value or both <custom-ident> and <integer>, separated by a space or the keyword span together with either a <custom-ident> or an <integer> or both. Values auto Is a keyword indicating that the property contributes nothing to the grid item's placement, indicating auto-placement, an automatic ...
...And 8 more matches
justify-items - CSS: Cascading Style Sheets
ropriate axis. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. The effect of this property is dependent of the layout mode we are in: In block-level layouts, it aligns the items inside their containing block on the inline axis. For absolutely-positioned elements, it aligns the items inside their containing block on the inline axis, accounting for the offset values of top, left, bottom, and right. In table cell layouts, this property is ignored (more about alignment in block, absolute positioned and table layout) In flexbox layouts, this property is ignored (more about alignment in Flexbox) In grid layouts, it ...
...gns the items inside their containing block on the inline axis, accounting for the offset values of top, left, bottom, and right. ...
...*/ justify-items: flex-start; /* Equivalent to 'start'. Note that justify-items is ignored in Flexbox layouts. */ justify-items: flex-end; /* Equivalent to 'end'. Note that justify-items is ignored in Flexbox layouts. ...
...And 8 more matches
Editor Embedding Guide - Archive of obsolete content
an), "state_begin"(boolean), "state_end"(boolean), "state_mixed"(boolean), "state_enabled" (boolean) DoCommand no parameters Example normal bold cmd_italics Toggles italics style on selection. GetCommandState "state_all"(boolean), "state_begin"(boolean), "state_end"(boolean), "state_mixed"(boolean), "state_enabled" (boolean) DoCommand no parameters Example normal italics cmd_underline Toggles underline on selection. GetCommandState "state_all"(boolean), "state_begin"(boolean), "state_end"(boolean), "state_mixed"(boolean), "state_enabled" (boolean) DoCommand no parameters Example normal underline cmd_tt Toggles teletype style (monospace font) on selection. GetCommandState "state_all"(boolean), "state_begin"(boolean), "state_end"(boolean), "state_mixed"(boolean),...
...ate_attribute" (cstring) DoCommand "state_attribute" (cstring or string) "Helvetica, Arial, sans-serif" "Times New Roman, Times, serif" "Courier New, Courier, monospace" Any string is acceptable. The above strings should be considered examples of base functionality and in no way imply that this command won't handle other fonts. cmd_align Sets the alignment for the lines contained in the current selection. GetCommandState "state_attribute" (cstring) DoCommand "state_attribute" (cstring) "left", "right", "center", "justify" cmd_insertHTML cmd_insertLinkNoUI cmd_insertImageNoUI cmd_insertHR cmd_charSet Sets the charset for the document. GetCommandState "state_attribute" (cstring) DoCommand "state_attribute" (cstring) Note There must be a clea...
... the command. cmd_deleteWordForward Deletes from current selection end point to the end of word. Acts as Ctrl+Delete. GetCommandState "state_enabled" (boolean) DoCommand no parameter Note GetCommandState in these cases will return whether or not it is possible to call DoCommand. This will not really give you any concrete information on the state of the command. ...
...And 7 more matches
Learn XPI Installer Scripting by Example - Archive of obsolete content
If you choose not to register the installed software or do the verifications at the front end of the installation, then at a minimum, the install scripts mus...
...If you choose not to register the installed software or do the verifications at the front end of the installation, then at a minimum, the install scripts mustinitialize, add the files to be installed, and execute. Note also that when you call met...
...nstall(); if (verify_space()) { err = add_dirs_and_files; register_files; if (err==SUCCESS) { performInstall() }; else { cancelInstall() }; } As you can see in the code listing, the verification process at the top is on lines 1 to 18; the file addition process, here part of the main installation block, is on lines 24 to 41; the registration part of the main installation block is on lines 42-58; and the execution at the end of the main block is on lines 59 to 71. If you choose not to register the installed software or do the verifications at the front end of the installation, then at a minimum, the install scripts mustinitialize, add the files to be installed, and execute. Note also that when you call methods on the Install--as you do so often in installation scripts (getFolder,...
...And 7 more matches
Manifest Files - Archive of obsolete content
the file named chrome.manifest is read automatically; if you need to read multiple manifest files, use the manifest command in that file to import additional manifests. Use manifest flags to configure the scenarios in which the secondary manifest is imported. ...
...If you aren't sure what the file path is, open that directory in a browser and copy the URL from the address field. ...
...it: Create a new directory somewhere. For example, on a Windows machine, you might use C:\testfiles Create a new ASCII1 file called test.manifest in the chrome directory. It doesn't actually matter what the file is called as long as it has the .manifest extension. ( 1. doesn't work with UTF-8 with BOM.) Add the following line to it: content tests file:///C:/testfiles/ The file path in that line should point to the directory created above. If you aren't sure what the file path is, open that directory in a browser and copy the URL from the address field. That's it! Now, all you need to do is add some XUL files into that new directory, and you will be able to load them by typing in a chrome URL of the form chrome://tests/content/<filename>. Of course, you will need to restart the browser f...
...And 7 more matches
XULRunner tips - Archive of obsolete content
Useful Chrome URLs Most of these require branding. Window URL Window Type Extension Manager chrome://mozapps/content/extens...
...Suite, etc.) The function toOpenWindowByType() needs to be defined. There is a working stub. Any better suggestion? Venkman uses "chrome://communicator/skin/" as an alias for "chrome://global/skin/" and this alias was maintained in the XULRunner toolkit until XULRunner 1.9 was released. ...
...ector 2.0.* to your XULRunner 1.9.0.* application follow these steps: Download the Dom Inspector (instead of clicking the "Add to..." button, right-click and select "Save Link As..."). ...
...And 7 more matches
Building up a basic demo with Babylon.js - Game development
second <script> element: var engine = new BABYLON.Engine(canvas); The BABYLON global object contains all the Babylon.js functions available in the engine. Creating a scene A scene is the place where all the game content is displayed. While creating new objects in the demo, we will be adding them all to the scene to make them visible on the screen. Let's create a scene by adding the following lines just below our previous code: var scene = new BABYLON.Scene(engine); scene.clearColor = new BABYLON.Color3(0.8, 0.8, 0.8); Thus, the scene is created and the second line sets the background color to light gray. Creating a rendering loop To make the scene actually visible we have to render it. Add these lines at the end of the <script> element, just before the closing </script>. var renderL...
...ngine.runRenderLoop(renderLoop); We're using the engine's runRenderLoop() method to execute the renderLoop() function repeatedly on every frame -- the loop will continue to render indefinitely until told to stop. Creating a camera Now the setup code is in place we need to think about implementing the standard scene components: camera, light and objects. Let's start with the camera -- add this line to your code below the scene creation and the line where we defined the clearColor. var camera = new BABYLON.FreeCamera("camera", new BABYLON.Vector3(0, 0, -10), scene); There are many cameras available in Babylon.js; FreeCamera is the most basic and universal one. To initialize it you need to pass it three parameters: any name you want to use for it, the coordinates where you want it to be po...
...y noticed the BABYLON.Vector3() method in use here -- this defines a 3D position on the scene. Babylon.js is bundled with a complete math library for handling vectors, colors, matrices etc. Let there be light There are various light sources available in Babylon.js. The most basic one is the PointLight, which works like a flashlight -- shining a spotlight in a given direction. Add the following line below your camera definition: var light = new BABYLON.PointLight("light", new BABYLON.Vector3(10, 10, 0), scene); The parameters are very similar to the previously defined camera: the name of the light, a position in 3D space and the scene to which the light is added. Geometry Now the scene is properly rendering we can start adding 3D shapes to it. To speed up development Babylon.js provide...
...And 7 more matches
HTML Cheatsheet - Learn web development
e quick hints as we go. That's the whole purpose of the cheatsheet, to give you some quick accurate ready to use code snippets for common usages. Remember that HTML tags must be used for their semantic, not their appearance. It's always possible to totally change the look and feel of a given tag using CSS so, when using HTML, take the time to focus on the meaning rather than the appearance. Inline elements An "element" is a single part of a webpage. Some elements are large and hold smaller elements like containers. Some elements are small and are "nested" inside larger ones. By default, "inline elements" appear next to one another in a webpage. They take up only as much width as they need in a page and fit together horizontally like words in a sentence or books shelved side-by-side in a r...
... An "element" is a single part of a webpage. Some elements are large and hold smaller elements like containers. Some elements are small and are "nested" inside larger ones. By default, "inline elements" appear next to one another in a webpage. They take up only as much width as they need in a page and fit together horizontally like words in a sentence or books shelved side-by-side in a row.All inline elements can be implemented within the <body></body> tags. ...
...ks shelved side-by-side in a row.All inline elements can be implemented within the <body></body> tags. ...
...And 7 more matches
Advanced Svelte: Reactivity, lifecycle, accessibility - Learn web development
ty issues related to updating objects and arrays. To avoid common pitfalls, we'll have to dig a little deeper into Svelte's reactivity system. We'll also look at solving some accessibility focus issues, and more besides. Prerequisites: At minimum, it is recommended that you are familiar with the core HTML, CSS, and JavaScript languages, and have knowledge of the terminal/command line. You'll need a terminal with node + npm installed to compile and build your app. Objective: Learn some advanced Svelte techniques involving solving reactivity issues, keyboard accessibility problems to do with component lifecycle, and more. We'll focus on some accessibility issues involving focus management. To do so, we'll utilize some techniques for accessing DOM nod...
...eader users. In its current state our app has a couple of keyboard accessibility problems involving focus management. Let's have a look at these issues. Exploring keyboard accessibility issues in our todo app Right now, keyboard users will find out that the focus flow of our app is not very predictable or coherent. If you click on the input at the top of our app, you'll see a thick, dashed outline around that input. This outline is your visual indicator that the browser is currently focused on this element. If you are a mouse user, you might have skipped this visual hint. But if you are working exclusively with the keyboard, knowing which control has focus is of vital importance. It tells us which control is going to receive our keystrokes. If you press the Tab key repeatedly, you'll see...
...Autofocusing our input The next feature will add to our NewTodo component will be an autofocus prop, which will allow us to specify that we want the <input> field to be focused on page load. Our first attempt is as follows -- let's try adding the autofocus prop and just call nameEl.focus() from the <script> block. ...
...And 7 more matches
Handling common HTML and CSS problems - Learn web development
ly braces, and so on. The W3C has a CSS Validator available too, for this purpose. Linters Another good option to choose is a so-called Linter application, which not only points out errors, but can also flag up warnings about bad practices in your CSS, and other points besides. Linters can generally be customized to be stricter or more relaxed in their error/warning reporting. There are many online linter applications, the best of which are probably Dirty Markup (HTML, CSS, JavaScript), and CSS Lint (CSS only). These allows you to paste your code into a window, and it will flag up any errors with crosses, which can then be hovered to get an error message informing you what the problem is. Dirty Markup also allows you to make fixes to your markup using the Clean button. However, it is not...
...top of the list. Install this first (using the Install button), as other linters rely on it to work. After that, install the linter-csslint plugin for linting CSS, and the linter-tidy plugin for linting HTML. After the packages have finished installing, try loading up an HTML file and a CSS file: you'll see any issues highlighted with green (for warnings) and red (for errors) circles next to the line numbers, and a separate panel at the bottom provides line numbers, error messages, and sometimes suggested values or other fixes. Other popular editors have similar linting packages available. For example, see: SublimeLinter for Sublime Text Notepad++ linter VSCode linters Browser developer tools The developer tools built into most browsers also feature useful tools for hunting down e...
...ou've identified a list of potential problem technologies you will be using, it is a good idea to research what browsers they are supported in, and what related techniques are useful. See Finding help below. HTML fallback behaviour Some problems can be solved by just taking advantage of the natural way in which HTML/CSS work. Unrecognised HTML elements are treated by the browser as anonymous inline elements (effectively inline elements with no semantic value, similar to <span> elements). You can still refer to them by their names, and style them with CSS, for example -- you just need to make sure they are behaving as you want them to, for example setting display: block; on all of the new semantic elements (such as <article>, <aside>, etc.), but only in old versions of IE that don't recognis...
...And 7 more matches
Setting up your own test automation environment - Learn web development
So here we've done the test as before, except that this time we've wrapped it inside a function, searchTest(). We've created new browser instances for multiple browsers, then passed each one ...
...('file:///Users/chrismills/git/learning-area/tools-testing/cross-browser-testing/accessibility/fake-div-buttons.html'); or driver.get('http://localhost:8888/fake-div-buttons.html'); But it is better to use a remote server location so the code is more flexible -- when you start using a remote server to run your tests (see later on), your code will break if you try to use local paths. Add this line to the bottom of quick_test.js now: driver.get('http://mdn.github.io/learning-area/tools-testing/cross-browser-testing/accessibility/native-keyboard-accessibility.html'); Interacting with the document Now we've got a document to test, we need to interact with it in some way, which usually involves first selecting a specific element to test something about. You can select UI elements in many wa...
...button, we could do this: button.getText().then(function(text) { console.log('Button text is \'' + text + '\''); }); Add this to quick_test.js now. Making sure you are inside your project directory, try running the test: node quick_test.js You should see the button's text label reported inside the console. let's do something a bit more useful. delete the previous code entry, then add this line at the bottom instead: button.click(); Try running your test again; the button will be clicked, and the alert() popup should appear. At least we know the button is working! You can interact with the popup too. Add the following to the bottom of the code, and try testing it again: let alert = driver.switchTo().alert(); alert.getText().then(function(text) { console.log('Alert text is \'' + t...
...And 7 more matches
Mozilla DOM Hacking Guide
Mozilla gives you the opportunity not only to use very powerful and complete DOM support, but also to work on a world-class implementation of one of the greatest Internet technologies ever created. Mozilla's DOM is coded almost entirely in C++. Seriously hacking on it requires excellent knowledge of C++ and XPCOM, Mozilla's own component model. In this document I will try to outline the main aspects of the implementation, beginning with the Class Info mechanism, which lies at the heart of the DOM, then with the description of various interfaces and classes. Since I am myself still learning how it works, don't expect this to be a complete reference quite yet. If you can contribute any time or knowledge to this document, it is greatly appreciated! Target audience: People interested in ...
...lass (see Section) defines several flags, one of which is the WANT_GETPROPERTY flag. When set, it allows us to define a GetProperty() function on nsHistorySH (the helper class for the history object), which will handle the array behavior. Indeed, it will forward the call history[1] to history.item(1), which is defined in the IDL and easily coded. The relevant code is at nsDOMClassInfo.cpp, around line 4520. These two examples demonstrate the power of the DOM combined with XPConnect and the JavaScript engine. The possibilities are endless. "What do you want to code today?" ;-) All the DOM classes are listed in an enum defined in nsIDOMClassInfo.h, nsDOMClassInfoID. There are classes for the DOM0, Core DOM, HTML, XML, XUL, XBL, range, css, events, etc... The array sClassInfoData, defined in n...
...ed in Section 1.6. static nsIClassInfo* GetClassInfoInstance(nsDOMClassInfoData* aData);: this helper method returns a non-refcounted nsIClassInfo pointer to an instance of the helper class corresponding to the Data passed in. The implementation is detailed in Section 1.6. static void ShutDown(): Releases the interface pointers. static nsIClassInfo* doCreate(nsDOMClassInfoData* aData): Inline function that returns a nsIClassInfo pointer to a new instance of the nsDOMClassInfo class. static nsresult WrapNative(...): XPConnect fu, not our problem. static nsresult ThrowJSException(JSContext *cx, nsresult aResult);: help me! static nsresult InitDOMJSClass(JSContext *cx, JSObject *obj);: help me! static JSClass sDOMJSClass;: help me! Protected section: const nsDOMClassInfoDa...
...And 7 more matches
JS::CompileOptions
const Returns a pointer to JSScript which introduces the file. bool copy(JSContext *cx, const ReadOnlyCompileOptions &rhs) Copy compile options from rhs. Returns false if it failed to duplicate owning properties. bool setFile(JSContext *cx, const char *f) Duplicate null-terminated string f for filename(). Returns false if it failed to duplicate. bool setFileAndLine(JSContext *cx, const char *f, unsigned l) Duplicate null-terminated string f for filename() and set lineno property. Returns false if it failed to duplicate. bool setSourceMapURL(JSContext *cx, const char16_t *s) Duplicate null-terminated string s for sourceMapURL. Returns false if it failed to duplicate. bool setIntroducerFilename(JSContext *cx, const char *s) Duplicat...
...ns false if it failed to duplicate. bool setSourceMapURL(JSContext *cx, const char16_t *s) Duplicate null-terminated string s for sourceMapURL. Returns false if it failed to duplicate. bool setIntroducerFilename(JSContext *cx, const char *s) Duplicate null-terminated string s for introducerFilename. Returns false if it failed to duplicate. OwningCompileOptions &setLine(unsigned l) Sets each property and returns the instance itself. OwningCompileOptions &setElement(JSObject *e) OwningCompileOptions &setElementAttributeName(JSString *p) OwningCompileOptions &setIntroductionScript(JSScript *s) OwningCompileOptions &setMutedErrors(bool mute) OwningCompileOptions &setVersion(JSVersion v) OwningCompileOptions &...
...Returns false if it failed to duplicate. Methods of JS::CompileOptions Method Description JSObject *element() const Same as JS::Ownin...
...And 7 more matches
nsIMsgFolder
lder(in AString folderName, in nsIMsgWindow msgWindow); nsIMsgFolder addSubfolder(in AString folderName); void createStorageIfMissing(in nsIUrlListener urlListener); void compact(in nsIUrlListener aListener, in nsIMsgWindow aMsgWindow); void compactAll(in nsIUrlListener aListener, innsIMsgWindow aMsgWindow,in nsISupportsArray aFolderArray, in boolean aCompactOfflineAlso,in nsISupportsArray aOfflineFolderArray); void compactAllOfflineStores(in nsIMsgWindow aMsgWindow,in nsISupportsArray aOfflineFolderArray); void emptyTrash(in nsIMsgWindow aMsgWindow, in nsIUrlListener aListener); void rename(in AString name, in nsIMsgWindow msgWindow); void renameSubFolders( in nsIMsgWindow msgWindow, in nsIMsgFolder oldFolder); A...
... thread); void setLabelForMessages(in nsISupportsArray messages, in nsMsgLabelValue label); nsIMsgDatabase getMsgDatabase(in nsIMsgWindow msgWindow); void setMsgDatabase(in nsIMsgDatabase msgDatabase); nsIMsgDatabase getDBFolderInfoAndDB(out nsIDBFolderInfo folderInfo); nsIMsgDBHdr GetMessageHeader(in nsMsgKey msgKey); boolean shouldStoreMsgOffline(in nsMsgKey msgKey); boolean hasMsgOffline(in nsMsgKey msgKey); nsIInputStream getOfflineFileStream(in nsMsgKey msgKey, out PRUint32 offset, out PRUint32 size); void DownloadMessagesForOffline(in nsISupportsArray messages, in nsIMsgWindow window); nsIMsgFolder getChildWithURI(in ACString uri, in boolean deep, in boolean caseInsensitive); void downloadA...
...gKey msgKey); boolean hasMsgOffline(in nsMsgKey msgKey); nsIInputStream getOfflineFileStream(in nsMsgKey msgKey, out PRUint32 offset, out PRUint32 size); void DownloadMessagesForOffline(in nsISupportsArray messages, in nsIMsgWindow window); nsIMsgFolder getChildWithURI(in ACString uri, in boolean deep, in boolean caseInsensitive); void downloadAllForOffline(in nsIUrlListener listener, in nsIMsgWindow window); void enableNotifications(in long notificationType, in boolean enable, in boolean dbBatching); boolean isCommandEnabled(in ACString command); boolean matchOrChangeFilterDestination(in nsIMsgFolder folder,in boolean caseInsensitive); boolean confirmFolderDeletionForFilter(in nsIMsgWindow msgWindow); vo...
...And 7 more matches
Debugger.Script - Firefox Developer Tools
tructor, this may be a synthesized filename, starting with a valid URL and followed by information tracking how the code was introduced into the system; the entire string is not a valid URL. For Function.prototype's script, this is null. If this Debugger.Script's source property is non-null, then this is equal to source.url. If the instance refers to WebAssembly code, throw a TypeError. startLine If the instance refers to a JSScript, the number of the line at which this script's code starts, within the file or document named by url. lineCount If the instance refers to a JSScript, the number of lines this script's code occupies, within the file or document named by url. source If the instance refers to a JSScript, the Debugger.Source instance representing the source code from which ...
...totype Object The functions described below may only be called with a this value referring to a Debugger.Script instance; they may not be used as methods of other kinds of objects. getAllOffsets() If the instance refers to a JSScript, return an arrayL describing the relationship between bytecode instruction offsets and source code positions in this script.L is sparse, and indexed by source line number. If a source line numberline has no code, thenL has noline property. If there is code forline, then L[line] is an array of offsets of byte code instructions that are entry points to that line. For example, suppose we have a script for the following source code: a=[] for (i=1; i < 10; i++) // It's hip to be square. a[i] = i*i; Calling getAllOffsets() on that code might yield a...
...e forline, then L[line] is an array of offsets of byte code instructions that are entry points to that line. For example, suppose we have a script for the following source code: a=[] for (i=1; i < 10; i++) // It's hip to be square. a[i] = i*i; Calling getAllOffsets() on that code might yield an array like this: [[0], [5, 20], , [10]] This array indicates that: the first line's code starts at offset 0 in the script; the for statement head has two entry points at offsets 5 and 20 (for the initialization, which is performed only once, and the loop test, which is performed at the start of each iteration); the third line has no code; and the fourth line begins at offset 10. If the instance refers to WebAssembly code, throw a TypeError. ...
...And 7 more matches
CanvasRenderingContext2D.arcTo() - Web APIs
The CanvasRenderingContext2D.arcTo() method of the Canvas 2D API adds a circular arc to the current sub-path, using the given control points and radius. The arc is automatically connected to the path's latest point with a straight line, if necessary for the specified parameters. This method is commonly used for making rounded corners. Note: Be aware that you may get unexpected results when using a relatively large radius: the arc's connecting line will go in whatever direction it must to meet the specified radius. Syntax void ctx.arcTo(x1, y1, x2, y2, radius); Parameters x1 The x-axis coordinate of the first control point. y1 The y-axis coordinate of the first control point. x2 The x-axis coordinate of the second control point. y2 The y-axis coordinate of the second control ...
...oint, and another from there to a second control point. Without arcTo(), these two segments would form a sharp corner: arcTo() creates a circular arc that fits this corner and smooths is out. In other words, the arc is tangential to both segments. ...
...hese two segments would form a sharp corner: arcTo() creates a circular arc that fits this corner and smooths is out. In other words, the arc is tangential to both segments. ...
...And 7 more matches
CanvasRenderingContext2D - Web APIs
ve an HTML <canvas> element to work with: <canvas id="my-house" width="300" height="300"></canvas> To get the canvas' 2D rendering context, call getContext() on the <canvas> element, supplying '2d' as the argument: const canvas = document.getElementById('my-house'); const ctx = canvas.getContext('2d'); With the context in hand, you can draw anything you like. This code draws a house: // Set line width ctx.lineWidth = 10; // Wall ctx.strokeRect(75, 140, 150, 110); // Door ctx.fillRect(130, 190, 40, 60); // Roof ctx.beginPath(); ctx.moveTo(50, 140); ctx.lineTo(150, 60); ctx.lineTo(250, 140); ctx.closePath(); ctx.stroke(); The resulting drawing looks like this: Reference Drawing rectangles There are three methods that immediately draw rectangles to the canvas. CanvasRenderingCo...
...ng the current stroke style. Drawing text The following methods draw text. See also the TextMetrics object for text properties. CanvasRenderingContext2D.fillText() Draws (fills) a given text at the given (x, y) position. CanvasRenderingContext2D.strokeText() Draws (strokes) a given text at the given (x, y) position. CanvasRenderingContext2D.measureText() Returns a TextMetrics object. Line styles The following methods and properties control how lines are drawn. CanvasRenderingContext2D.lineWidth Width of lines. Default 1.0. CanvasRenderingContext2D.lineCap Type of endings on the end of lines. Possible values: butt (default), round, square. CanvasRenderingContext2D.lineJoin Defines the type of corners where two lines meet. Possible values: round, bevel, miter (default). Ca...
...ntext2D.lineWidth Width of lines. Default 1.0. CanvasRenderingContext2D.lineCap Type of endings on the end of lines. Possible values: butt (default), round, square. CanvasRenderingContext2D.lineJoin Defines the type of corners where two lines meet. Possible values: round, bevel, miter (default). CanvasRenderingContext2D.miterLimit Miter limit ratio. Default 10. CanvasRenderingContext2D.getLineDash() Returns the current line dash pattern array containing an even number of non-negative numbers. CanvasRenderingContext2D.setLineDash() Sets the current line dash pattern. CanvasRenderingContext2D.lineDashOffset Specifies where to start a dash array on a line. Text styles The following properties control how text is laid out. CanvasRenderingContext2D.font Font setting. Default val...
...And 7 more matches
Using Fetch - Web APIs
It also provides a global fetch() method that provides an easy, logical way to fetch resources asynchronously across the network. This kind of functionality was previously achieved using XMLHttpRequest. Fetch provides a better alternative that can be easily used by other technologies such as Service Workers. Fetch also provides a single logical place to define other HTTP-related concepts such as CORS and extensions to HTTP. ...
... async fu...
... async function* ...
...And 7 more matches
HTMLBodyElement - Web APIs
The HTMLBodyElement interface provides special properties (beyond those inherited from the regular HTMLElement interface) for manipulating <body> elements. ...
... The HTMLBodyElement interface provides special properties (beyond those inherited from the regular HTMLElement interface) for manipulating <body> elements. ...
...inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monosp...
...And 7 more matches
HTMLVideoElement - Web APIs
properties and methods of HTMLMediaElement and HTMLElement. The list of supported media formats varies from one browser to the other. You should either provide your video in a single format that all the relevant browsers supports, or provide multiple video sources in enough different formats that all the browsers you need to support are covered. ...
...ither provide your video in a single format that all the relevant browsers supports, or provide multiple video sources in enough different formats that all the browsers you need to support are covered. ...
...inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 140" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monosp...
...And 7 more matches
SVGSVGElement - Web APIs
The SVGSVGElement interface provides access to the properties of <svg> elements, as well as methods to manipulate them. This interface contains also various miscellaneous commonly-used utility methods, such as matrix operations and the ability to control the time of redraw on visual rendering devices. ...
...o manipulate them. This interface contains also various miscellaneous commonly-used utility methods, such as matrix operations and the ability to control the time of redraw on visual rendering devices. ...
...inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 140" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monosp...
...And 7 more matches
SVGTSpanElement - Web APIs
The SVGTSpanElement interface represents a <tspan> element. ...
... The SVGTSpanElement interface represents a <tspan> element. ...
...inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monosp...
...And 7 more matches
SVGTextElement - Web APIs
The SVGTextElement interface corresponds to the <text> elements. ...
... The SVGTextElement interface corresponds to the <text> elements. ...
...inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 140" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monosp...
...And 7 more matches
WebGL constants - Web APIs
The WebGL API provides several constants that are passed into or returned by functions. All constants are of type GLenum. Standard WebGL constants are installed on the WebGLRenderingContext and WebGL2RenderingContext objects, so that you use them as gl.CONSTANT_NAME: var canvas = document.getElementById('myCanvas'); var gl = canvas.getContext('webgl'); gl.getParameter(gl.LINE_WIDTH); Some constants are also provided by WebGL extensions. A list is provided below. var debugInfo = gl.getExtension('WEBGL_debug_renderer_info'); var vendor = gl.getParameter(debugInfo.UNMASKED_VENDOR_WEBGL); The WebGL tutorial has more information, examples, and resources on how to get started with WebGL. Table of contents Standard WebGL 1 constants Standard WebGL 2 constants WebGL extension constants ...
...R_BUFFER_BIT 0x00004000 Passed to clear to clear the current color buffer. Rendering primitives Constants passed to WebGLRenderingContext.drawElements() or WebGLRenderingContext.drawArrays() to specify what kind of primitive to render. Constant name Value Description POINTS 0x0000 Passed to drawElements or drawArrays to draw single points. ...
...nt color buffer. Rendering primitives Constants passed to WebGLRenderingContext.drawElements() or WebGLRenderingContext.drawArrays() to specify what kind of primitive to render. Constant name Value Description POINTS 0x0000 Passed to drawElements or drawArrays to draw single points. LINES 0x0001 Passed to drawElements or drawArrays to draw lines. Each vertex connects to the one after it. LINE_LOOP 0x0002 Passed to drawElements or drawArrays to draw lines. Each set of two vertices is treated as a separate line segment. LINE_STRIP 0x0003 Passed to drawElements or drawArrays to draw a connected group of line segments from the first vertex to the last. TRIANGLES 0x0004 Passed to drawElements or d...
...And 7 more matches
Operable - Accessibility
This article provides practical advice on how to write your web content so that it conforms to the success criteria outlined in the Operable principle of the Web Content Accessibility Guidelines (WCAG) 2.0 and 2.1. Operable states that user interface components and navigation must be operable. Note: To read the W3C definitions for Operable and its guidelines and success criteria, see Principle 2: Operable -- User interface components and navigation must be operable. Guideline 2.1 -- Keyboard Accessible: Make all functionality available from a keyboard This guideline covers the necessity of making core website functionality available via a keyboard in addition to other means (e.g. mouse), so that users that rely on keyboard controls can access them. Success criteria Ho...
...ard accessibility back in 2.1.4 Character Key Shortcuts (A) added in 2.1 If a single character key shortcut exists, then at least one of the following is true: single character key shortcuts can be turned off, remapped or are only active when the relevant user interface component is in focus. Understanding Character Key Shortcuts Note: Also see the WCAG description for Guideline 2.1 Keyboard Accessible: Make all functionality available from a keyboard. Guideline 2.2 -- Enough Time: Provide users enough time to read and use content This guideline covers situations in which functionality may have a time limit. For example, purchases sometimes need to be completed within a time limit for security reasons. Success criteria How to conform to the criteria Pr...
...icate and continue their usage without losing any data. 2.2.6 Timeouts (AAA) added in 2.1 If there is a timeout (caused by user inactivity) warn users at the start of a process so they will not be surprised that a timeout exists (or only allow the timeout to occur after 20 hours of inactivity. ...
...And 7 more matches
Mastering Wrapping of Flex Items - CSS: Cascading Style Sheets
In this guide I will explain how this works, what it is designed for and what situations really require CSS Grid Layout rather than flexbox. Making things wrap The initial value of the flex-wrap property is nowrap. ...
...become too wide you must add the flex-wrap property with a value of wrap, or use the shorthand flex-flow with values of row wrap or column wrap. Items will then wrap in the container. In the next example I have ten items all with a flex-basis of 160px and the ability to grow and shrink. Once the first row gets to a point where there is not enough space to place another 160 pixel item, a new flex line is created for the items and so on until all of the items are placed. As the items can grow, they will expand larger than 160 px in order to fill each row completely. If there is only one item on the final line it will stretch to fill the entire line. We can see the same thing happening with columns. The container will need to have a height in order that the items will start wrapping and creat...
... need to have a height in order that the items will start wrapping and creating new columns, and items will stretch taller to fill each column completely. Wrapping and flex-direction Wrapping works as you might expect when combined with flex-direction. If flex-direction is set to row-reverse then the items will start from the end edge of the container and lay themselves out in reverse ordered lines. Note that the reversing is only happening in the inline, row direction. We start on the right then go onto the second line and again start from the right. We aren't reversing in both directions, starting from the bottom coming up the container! Single-dimensional layout explained As we have seen from the above examples if our items are allowed to grow and shrink, when there are fewer items...
...And 7 more matches
Basic concepts of Logical Properties and Values - CSS: Cascading Style Sheets
relative, counterparts -- e.g. start and end as opposed to left and right/top and bottom. An example of why these mappings might be needed is as follows. I have a Layout using CSS Grid, the grid container has a width applied and I am using the align-self and justify-self properties to align the items. These properties are flow relative -- justify-self: start aligns the item to the start on the inline dimension, align-self: start does the same on the block dimension. If I now change the writing mode of this component to vertical-rl using the writing-mode property, the alignment continues to work in the same way. The inline dimension is now running vertically and the block dimension horizontally. The grid doesn't look the same however, as the width assigned to the container is a horizontal m...
... You can try this out in the live example below. Change writing-mode from vertical-rl to horizontal-tb on .grid to see how the different properties change the layout. ...
... using. You can try this out in the live example below. Change writing-mode from vertical-rl to horizontal-tb on .grid to see how the different properties change the layout. When working with a site in a writing mode other than a horizontal, top to bottom one, or when using writing modes for creative reasons, being able to relate to the flow of the content makes a lot of sense. Block and inline dimensions A key concept of working with flow relative properties and values is the two dimensions of block and inline. As we saw above, newer CSS layout methods such as Flexbox and Grid Layout use the concepts of block and inline rather than right and left/top and bottom when aligning items. The inline dimension is the dimension along which a line of text runs in the writing mode in use. There...
...And 7 more matches
Using CSS transitions - CSS: Cascading Style Sheets
re often called implicit transitions as the states in between the start and final states are implicitly defined by the browser. CSS transitions let you decide which properties to animate (by listing them explicitly), when the animation will start (by setting a delay), how long the transition will last (by setting a duration), and how the transition will run (by defining a timing function, e.g. linearly or quick at the beginning, slow at the end). Which CSS properties can be transitioned? The Web author can define which property has to be animated and in which way. This allows the creation of complex transitions. As it doesn't make sense to animate some properties, the list of animatable properties is limited to a finite set. Note: The set of properties that can be animated is changing as...
... color; transition-duration: 2s; transition-timing-function: ease; } function updateTransition() { var el = document.querySelector("div.box"); if (el) { el.className = "box1"; } else { el = document.querySelector("div.box1"); el.className = "box"; } return el; } var intervalID = window.setInterval(updateTransition, 7000); transition-timing-function: linear <div class="parent"> <div class="box">Lorem</div> </div> .parent { width: 250px; height:125px;} .box { width: 100px; height: 100px; background-color: red; font-size: 20px; left: 0px; top: 0px; position: absolute; -webkit-transition-property: width height background-color font-size left top color; -webkit-transition-duration: 2s; -webkit-transi...
...rent"> <div class="box">Lorem</div> </div> .parent { width: 250px; height:125px;} .box { width: 100px; height: 100px; background-color: red; font-size: 20px; left: 0px; top: 0px; position: absolute; -webkit-transition-property: width height background-color font-size left top color; -webkit-transition-duration: 2s; -webkit-transition-timing-function: linear; transition-property: width height background-color font-size left top color; transition-duration: 2s; transition-timing-function: linear; } .box1{ width: 50px; height: 50px; background-color: blue; color: yellow; font-size: 18px; left: 150px; top:25px; position: absolute; -webkit-transition-property: width height background-color font-size left t...
...And 7 more matches
CSS reference - CSS: Cascading Style Sheets
Web › CSS › Reference
definitions are entirely (ASCII) text-based, whereas DOM-CSS / CSSOM (the rule management system) is object-based. At-rule syntax As the structure of at-rules varies widely, please see At-rule to find the syntax of the specific one you want. Keyword index Note: The property names in this index do not include the JavaScript names where they differ from the CSS standard names. ...
...tart-colorborder-block-start-styleborder-block-start-widthborder-block-styleborder-block-widthborder-bottomborder-bottom-colorborder-bottom-left-radiusborder-bottom-right-radiusborder-bottom-styleborder-bottom-widthborder-collapseborder-colorborder-end-end-radiusborder-end-start-radiusborder-imageborder-image-outsetborder-image-repeatborder-image-sliceborder-image-sourceborder-image-widthborder-inlineborder-inline-colorborder-inline-endborder-inline-end-colorborder-inline-end-styleborder-inline-end-widthborder-inline-startborder-inline-start-colorborder-inline-start-styleborder-inline-start-widthborder-inline-styleborder-inline-widthborder-leftborder-left-colorborder-left-styleborder-left-widthborder-radiusborder-rightborder-right-colorborder-right-styleborder-right-widthborder-spacingborder-s...
...ers()cross-fade()cubic-bezier()::cue::cue-regioncursor<custom-ident>D:defaultdeg<dimension>:dirdirection:disableddisplay<display-box><display-inside><display-internal><display-legacy><display-listitem><display-outside>dpcmdpidppxdrop-shadow()Eelement()ellipse()em:emptyempty-cells:enabledenv()exFfallback (@counter-style)filter<filter-function>:first:first-child::first-letter (:first-letter)::first-line (:first-line):first-of-typefit-content()<flex>flexflex-basisflex-directionflex-flowflex-growflex-shrinkflex-wrapfloat:focusfont@font-facefont-familyfont-family (@font-face)font-feature-settingsfont-feature-settings (@font-face)@font-feature-valuesfont-kerningfont-language-overridefont-optical-sizingfont-sizefont-size-adjustfont-stretchfont-stretch (@font-face)font-stylefont-style (@font-face)font...
...And 7 more matches
align-self - CSS: Cascading Style Sheets
normal The ...
... normal The effect of this keyword is dependen...
... normal The effect of this keyword is dependent of the layout mode we are ...
...And 7 more matches
grid-column - CSS: Cascading Style Sheets
The grid-column CSS shorthand property specifies a grid item's size and location within a grid column by contributing a line, a span, or nothing (automatic) to its grid placement, thereby specifying the inline-start and inline-end edge of its grid area. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Constituent properties This property is a shorthand for the following CSS properties: grid-column-end grid-column-start Syntax This property is specified as one or two <grid-line> values. If two <grid-line> values are given they are separated by "/". The grid-column-start longhand is set to the value bef...
... properties This property is a shorthand for the following CSS properties: grid-column-end grid-column-start Syntax This property is specified as one or two <grid-line> values. If two <grid-line> values are given they are separated by "/". The grid-column-start longhand is set to the value before the slash, and the grid-column-end longhand is set to the value after the slash. Each <grid-line> value can be specified as: either the auto keyword or a <custom-ident> value or an <integer> value or both <custom-ident> and <integer>, separated by a space or the keyword span together with either a <custom-ident> or an <integer> or both. Values auto Is a keyword indicating that the property contributes nothing to the grid item's placement, indicating auto-placement, an automatic ...
...om-ident> value or an <integer> value or both <custom-ident> and <integer>, separated by a space or the keyword span together with either a <custom-ident> or an <integer> or both. Values auto Is a keyword indicating that the property contributes nothing to the grid item's placement, indicating auto-placement, an automatic span, or a default span of 1. <custom-ident> If there is a named line with the name '<custom-ident>-start'/'<custom-ident>-end', it contributes the first such line to the grid item's placement. Note: Named grid areas automatically generate implicit named lines of this form, so specifying grid-column: foo; will choose the start/end edge of that named grid area (unless another line named foo-start/foo-end was explicitly specified before it). Otherwise, this is tre...
...And 7 more matches
dy - SVG: Scalable Vector Graphics
Web › SVG › Attribute › dy
The dy attribute indicates a shift along the y-axis on the position of an element or its content. ...
... The dy attribute indicates a shift along the y-axis on the position of an element or its content. ...
...s a shift along the y-axis on the position of an element or its content. ...
...And 7 more matches
spreadMethod - SVG: Scalable Vector Graphics
reflect This value indicates that the gradient repeats in reverse beyond its edges. repeat This value specifies that the gradient repeats in the original order beyond its edges. ...
...This value indicates that the gradient repeats in reverse beyond its edges. repeat This value specifies that the gradient repeats in the original order beyond its edges. Defining a gradient's edges By default, a gradient reaches to the edges of the shape being filled. To see the effects of this attribute, you will need to set the size of the gradient smaller than the shape. ...
...see the effects of this attribute, you will need to set the size of the gradient smaller than the shape. In the case of a linear gradient, the edges may be defined as a rectangle by the x1, x2, y1 and y2 attributes. In the case of a radial gradient, the edges may be defined as outer and inner circles by the cx, cy and r (outer) and fx, fy and fr (inner) attributes. ...
...And 7 more matches
SVG Attribute reference - SVG: Scalable Vector Graphics
Web › SVG › Attribute
SVG elements can be modified using attributes that specify details about exactly how the element should be handled or rendered. Below is a list of all of the attributes available in SVG along with links to reference documentation to help you learn which elements support them and how they work. ...
... rendered. Below is a list of all of the attributes available in SVG along with links to reference documentation to help you learn which elements support them and how they work. ...
...Reverse azimuth B baseFrequency baseline-shift baseProfile bbox begin bias by C calcMode cap-height class clip clipPathUnits clip-path clip-rule color color-interpolation color-interpolation-filters color-profile color-rendering contentScriptType contentStyleType cursor cx cy D d decelerate descent diffuseConstant direction display divisor dominant-baseline dur dx dy E edgeMode elevation enable-background end exponent externalResourcesRequired F fill fill-opacity fill-rule filter filterRes filterUnits flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight format from fr fx fy G g1 g2 glyph-name glyph-orientation-horizontal glyph-orientation-verti...
...And 7 more matches
Understanding WebAssembly text format - WebAssembly
very interesting, let's add some executable code to this module. All code in a webassembly module is grouped into functions, which have the following pseudo-code structure: ( func <signature> <locals> <body> ) The signature declares what the function takes (parameters) and returns (return values). The locals are like vars in JavaScript, but with explicit types declared. The body is just a linear list of low-level instructions. So this is similar to functions in other languages, even if it looks different because it is an S-expression. Signatures and parameters The signature is a sequence of parameter type declarations followed by a list of return type declarations. It is worth noting here that: The absence of a (result) means the function doesn't return anything. In the cu...
...ingle integer! What if we wanted to log a text string? To deal with strings and other more complex data types, WebAssembly provides memory (although we also have Reference types in newer implementation of WebAssembly). According to WebAssembly, memory is just a large array of bytes that can grow over time. WebAssembly contains instructions like i32.load and i32.store for reading and writing from linear memory. From JavaScript's point of view, it's as though memory is all inside one big (resizable) ArrayBuffer. That's literally all that asm.js has to play with (except that it isn't resizable; see the asm.js Programming model). So a string is just a sequence of bytes somewhere inside this linear memory. Let's assume that we've written a suitable string of bytes to memory; how do we pass that ...
...ide one big (resizable) ArrayBuffer. That's literally all that asm.js has to play with (except that it isn't resizable; see the asm.js Programming model). So a string is just a sequence of bytes somewhere inside this linear memory. Let's assume that we've written a suitable string of bytes to memory; how do we pass that string out to JavaScript? The key is that JavaScript can create WebAssembly linear memory instances via the WebAssembly.Memory() interface, and access an existing memory instance (currently you can only have one per module instance) using the associated instance methods. Memory instances have a buffer getter, which returns an ArrayBuffer that points at the whole linear memory. Memory instances can also grow, for example via the Memory.grow() method in JavaScript. When growth...
...And 7 more matches
The Essentials of an Extension - Archive of obsolete content
ur extension from other extensions, so it is required that you have an ID that is unique. There are two accepted standards for add-on ids. One is the email-like format in the Hello World example, which should be something like <project-name>@<yourdomain>. The other standard practice is to use a generated UUID string, which is extremely unlikely to be duplicated. Unix-based systems have a command line tool called uuidgen that generates UUIDs. There are also downloadable tools for all platforms that generate them. The enclosing brackets are just notation, and they're just common practice. As long as your id has some uniqueness to it, it's OK to use either form. <em:name>XUL School Hello World</em:name> <em:description>Welcome to XUL School!</em:description> <em:version>0.1</em:version> <em:c...
...or will do), we see that the same 3 sections are mentioned: content xulschoolhello content/ skin xulschoolhello classic/1.0 skin/ locale xulschoolhello en-US locale/ The chrome.manifest file tells Firefox where to look for chrome files. The text is spaced to look like a table, but that is not necessary. The parser ignores repeated spaces. The first word in a line tells Firefox what it is that is being declared (content, skin, locale, or others mentioned later on). The second is the package name, which we will explain shortly. Skin and locale packages have a third value to specify what locale or what skin they are extending. There can be multiple skin and locale entries relating to different skins and locales. The most common case is having one skin entry...
...he ones you can create with HTML, or at least XUL makes it easier. XUL files usually define one of two things: windows or overlays. The file you opened before, downloads.xul, has the code that defines the Downloads window. The XUL file included in the Hello World extension is an overlay. An overlay extends an existing window, adding new elements to it or replacing some of the elements in it. The line that we skipped in the chrome.manifest file states that this XUL file is an overlay for the main browser window: overlay chrome://browser/content/browser.xul chrome://xulschoolhello/content/browserOverlay.xul With this line, Firefox knows that it needs to take the contents of browserOverlay.xul and overlay it on the main browser window, browser.xul. You can declare overlays for any window ...
...And 6 more matches
File object - Archive of obsolete content
source of huge security holes, and not well tested. Getting Started In order to use the File object from your JavaScript programs, you must enable it by setting the make variable JS_HAS_FILE_OBJECT during the compilation of your Spidermonkey engine. ...
...n be added on the make command line, like so: cd mozilla/js/src make -f Makefile.ref JS_HAS_FILE_OBJECT=1 Alternatively, if you are building a larger product (such as a browser) and want to include the File object, you may need to perform minor Makefile surgery. Summary Non-Standard Server-Side Object This object lets you work files and directories on the local filesystem, and create OS pipelines. Creating a pipeline involves spawning arbitrary processes; this means that giving a script access to the File object is exactly equivalent to giving the script access to the UNIX shell or DOS command interpreter. Filesystem access is implemented with NSPR I/O Functions, and as such shares many semantics. Pipelines are implemented with the popen() system call. There is currently no support for ...
... Description Filenames are specified as strings that have an implementation defined format. Use of standard "file:" URLs is encouraged. If no argument is supplied to the constructor, the current working directory is the file object that is returned. ...
...And 6 more matches
Table Layout Regression Tests - Archive of obsolete content
those assertions. As you will probably run your normal Mozilla in parallel with the testing issue then: set MOZ_NO_REMOTE=1 at the command prompt. Start the layout debugger via mozilla -layoutdebug - P foo where foo is just another profile than your main profile. Select from the Regression-Test Menu the Add New List...entry. Select %MOZ_SRC%/layout/html/tests/block/rtest.lst. Execute the baseline test Shutdown the layoutdebugger Execute mozilla -layoutdebug - P foo >selftest.txt Execute the verify test Make a note which tests have failed grep 'failed' selftest.txt (these are false positives, quite frequently they indicate reflow problems, pages showing differently when loaded from cache) Make your changes to the source, recompile. Execute mozilla -layoutdebug - P foo >outputfile.txt...
....html body_tfoot.html body_thead.html col_span.html The regression tests compare the frame tree dumps recorded at two different times. The URL's to test are red from rtest.lstFor every file in rtest.lst Mozilla takes the root frame and dumps the whole tree via nsFrame::DumpRegression. The frame tree dumps are invoked by the nsILayoutDebugger. The frame trees are dumped to separate files in a baseline or verify directory for all URL's in rtest.lst (see: nsRegressionTester::DumpFrameModel). Their name is generated by replacing the old extension .html or .xml with .rgd. For appendCells1.html a file appendCells1.rgd will be created in the baseline or verify subdirectory. A typical beginning of a dump (*.rgd file) looks like: <frame va="15022440" type="Viewport(-1)" state="270340" parent="0"> <...
...a]enum " /> <display data="0 1 0 0 0 0 0 0 0 0 0 0 " /> <visibility data="0 1 1.000000" /> <table data="0 0 4 -1 1 " /> <tableborder data="1 Null Null 0 2 " /> <content data="0 0 0 Null " /> <quotes data="0 " /> <ui data="3 0 0 1 " /> <uireset data="7 0 4" /> <xul data="0 0 0 0 0 1 <svg data="0 1.000000 1.000000 0 1.000000" /> </stylecontext> The baseline log will look like: Type Manifest File: e:\moz_src\mozilla\obj-i586-pc-msvc\dist\bin\components\xpti.dat +++ JavaScript debugging hooks installed. ++WEBSHELL == 1 ++DOMWINDOW == 1 ++WEBSHELL == 2 ++DOMWINDOW == 2 Note: styleverifytree is disabled Note: frameverifytree is disabled Note: verifyreflow is disabled ++WEBSHELL == 3 ++DOMWINDOW == 3 Running baseline test for E:\moz_src\mozilla\layout\h...
...And 6 more matches
Properly Using CSS and JavaScript in XHTML Documents - Archive of obsolete content
nd displaying XML. Proper XHTML is an application of XML and as such requires that authors follow strict rules when authoring XHTML. In particular: Raw < and & characters are not allowed except inside of CDATA Sections (<![CDATA[ ... ]]>). Comments (<!---- ... ---->) must not contain double dashes (----). Content contained within Comments (<!---- ... ---->) can be ignored. Problems with Inline style and script Inline style and script tags can cause several different problems in XHTML when it is treated as XML rather than HTML. JavaScript Contains Characters Which Can Not Exist in XHTML JavaScript typically contains characters which can not exist in XHTML outside of CDATA Sections. <script type="text/javascript"> var i = 0; while (++i < 10) { // ... } </script> Note t...
...cript Contains Characters Which Can Not Exist in XHTML JavaScript typically contains characters which can not exist in XHTML outside of CDATA Sections. <script type="text/javascript"> var i = 0; while (++i < 10) { // ... } </script> Note that this example is not well formed XHTML since the use of raw < is only allowed as a part of markup in XHTML or XML. Use of Comments Inside Inline style and script Authors who are familiar with HTML commonly enclose the contents of inline style and script tags in comments in order to hide the contents of the tags from browsers which do not understand them. <style type="text/css"> <!-- body {background-color: blue; color: yellow;} --> </style> <script type="text/javascript"> <!-- var i = 0; var sum = 0; for (i = 0; i < 10; ++i)...
...!-- body {background-color: blue; color: yellow;} --> </style> <script type="text/javascript"> <!-- var i = 0; var sum = 0; for (i = 0; i < 10; ++i) { sum += i; } alert('sum = ' + sum); // --> </script> This example illustrates that a conformant browser can ignore content inside of comments. ...
...And 6 more matches
CSS and JavaScript accessibility best practices - Learn web development
Prerequisites: Basic computer literacy, a basic understanding of HTML, CSS, and JavaScript, and understanding of what accessibility is. ...
... so much that it no longer looks or behaves as expected. The following sections summarize the main HTML features to consider. "Standard" text content structure Headings, paragraphs, lists -- the core text content of your page: <h1>Heading</h1> <p>Paragraph</p> <ul> <li>My list</li> <li>has two items.</li> </ul> Some typical CSS might look like this: h1 { font-size: 5rem; } p, li { line-height: 1.5; font-size: 1.6rem; } You should: Select sensible font sizes, line heights, letter spacing, etc. to make your text logical, legible, and comfortable to read. Make sure your headings stand out from your body text, typically big and bold like the default styling. Your lists should look like lists. Your text color should contrast well with your background color. See HTML text f...
...nt sizes, line heights, letter spacing, etc. to make your text logical, legible, and comfortable to read. Make sure your headings stand out from your body text, typically big and bold like the default styling. Your lists should look like lists. Your text color should contrast well with your background color. See HTML text fundamentals and Styling text for more information. Emphasised text Inline markup that confers specific emphasis to the text that it wraps: <p>The water is <em>very hot</em>.</p> <p>Water droplets collecting on surfaces is called <strong>condensation</strong>.</p> You might want to add some simple coloring to your emphasised text: strong, em { color: #a60000; } You will however rarely need to style emphasis elements in any significant way. The standard convention...
...And 6 more matches
Handling different text directions - Learn web development
block flow direction. Sentences run vertically. vertical-lr: Left-to-right block flow direction. Sentences run vertically. So the writing-mode property is in reality setting the direction in which block-level elements are displayed on the page -- either from top-to-bottom, right-to-left, or left-to-right. This then dictates the direction text flows in sentences. Writing modes and block and inline layout We have already discussed block and inline layout, and the fact that some things display as block elements and others as inline elements. As we have seen described above, block and inline is tied to the writing mode of the document, and not the physical screen. Blocks are only displayed from the top to the bottom of the page if you are using a writing mode that displays text horizontally,...
...e I have two boxes that contain a heading and a paragraph. The first uses writing-mode: horizontal-tb, a writing mode that is written horizontally and from the top of the page to the bottom. The second uses writing-mode: vertical-rl; this is a writing mode that is written vertically and from right to left. When we switch the writing mode, we are changing which direction is block and which is inline. In a horizontal-tb writing mode the block direction runs from top to bottom; in a vertical-rl writing mode the block direction runs right-to-left horizontally. So the block dimension is always the direction blocks are displayed on the page in the writing mode in use. The inline dimension is always the direction a sentence flows. This figure shows the two dimensions when in a horizontal writing ...
...on is always the direction blocks are displayed on the page in the writing mode in use. The inline dimension is always the direction a sentence flows. This figure shows the two dimensions when in a horizontal writing mode. This figure shows the two dimensions in a vertical writing mode. Once you start to look at CSS layout, and in particular the newer layout methods, this idea of block and inline becomes very important. We will revisit it later on. Direction In addition to writing mode we also have text direction. As mentioned above, some languages such as Arabic are written horizontally, but right-to-left. ...
...And 6 more matches
create fancy boxes - Learn web development
to be fancy.</div> Ok, that's a very small bit of HTML, what can we tweak on that element? All of the following: Its box model properties: width, height, padding, border, etc. Its background properties: background, background-color, background-image, background-position, background-size, etc. Its pseudo-element: ::before and ::after and some aside properties like: box-shadow, transform, outline, etc. So we have a very large playground. Let the fun begin. Box model tweak The box model alone allows us to do some basic stuff, like adding simple borders, making squares, etc.. It starts to get interesting when you push the properties to the limit by having negative padding and/or- margin by having border-radius larger than the actual size of the box. Making circles <div class="fancy">...
...ges: solid color always fills the whole surface but images can be scaled and positioned. ...
... width: 100%; height: 200px; box-sizing: border-box; /* At the bottom of our background stack, let's have a misty grey solid color */ background-color: #E4E4D9; /* We stack linear gradients on top of each other to create our color strip effect. ...
...And 6 more matches
Document and website structure - Learn web development
structure of a simple website. Basic sections of a document Webpages can and will look pretty different from one another, but they all tend to share similar standard components, unless the page is displaying a fullscreen video or game, is part of some kind of art project, or is just badly structured: header: Usually a big strip across the top with a big heading, logo, and perhaps a tagline. This usually stays the same from one webpage to another. navigation bar: Links to the site's main sections; usually represented by menu buttons, links, or tabs. Like the header, this content usually remains consistent from one webpage to another -- having inconsistent navigation on your website will just lead to confused, frustrated users. Many web designers consider the navigation bar to be p...
...s not a requirement; in fact, some also argue that having the two separate is better for accessibility, as screen readers can read the two features better if they are separate. main content: A big area in the center that contains most of the unique content of a given webpage, for example, the video you want to watch, or the main story you're reading, or the map you want to view, or the news headlines, etc. This is the one part of the website that definitely will vary from page to page! sidebar: Some peripheral info, links, quotes, ads, etc. Usually, this is contextual to what is contained in the main content (for example on a news article page, the sidebar might contain the author's bio, or links to related articles) but there are also cases where you'll find some recurring elements like a...
...he example above, and then look over the listing below to see what parts make up what section of the visual. ...
...And 6 more matches
Image gallery - Learn web development
hension of JavaScript loops, functions, conditionals, and events. Starting point To get this assessment started, you should go and grab the ZIP file for the example, unzip it somewhere on your computer, and do the exercise locally to begin with. Alternatively, you could use a site like JSBin or Glitch to do your assessment. ...
...oops, functions, conditionals, and events. Starting point To get this assessment started, you should go and grab the ZIP file for the example, unzip it somewhere on your computer, and do the exercise locally to begin with. Alternatively, you could use a site like JSBin or Glitch to do your assessment. You could paste the HTML, CSS and JavaScript into one of these online editors. ...
...d, you should go and grab the ZIP file for the example, unzip it somewhere on your computer, and do the exercise locally to begin with. Alternatively, you could use a site like JSBin or Glitch to do your assessment. You could paste the HTML, CSS and JavaScript into one of these online editors. If the online editor you are using doesn't have separate JavaScript/CSS panels, feel free to put them inline <script>/<style> elements inside the HTML page. Note: If you get stuck, then ask us for help -- see the Assessment or further help section at the bottom of this page. Project brief You have been provided with some HTML, CSS and image assets and a few lines of JavaScript code; you need to write the necessary JavaScript to turn this into a working program. The HTML body looks like this: <h1>I...
...And 6 more matches
Video and Audio APIs - Learn web development
a "play" icon, so therefore the play button has a "play" icon displayed on it. Icon fonts are very cool for many reasons -- cutting down on HTTP requests because you don't need to download those icons as image files, great scalability, and the fact that you can use text properties to style them -- like color and text-shadow. ...
...ree groups: The <video> element, and the controls bar. The play/pause, stop, rewind, and fast forward buttons. The outer timer wrapper <div>, the digital timer readout <span>, and the inner <div> that gets wider as the time elapses. Next, insert the following at the bottom of your code: media.removeAttribute('controls'); controls.style.visibility = 'visible'; These two lines remove the default browser controls from the video, and make the custom controls visible. Playing and pausing the video Let's implement probably the most important control -- the play/pause button. First of all, add the following to the bottom of your code, so that the playPauseMedia() function is invoked when the play button is clicked: play.addEventListener('click', playPauseMedi...
... play button to "u", which is a "paused" icon, and invoke the HTMLMediaElement.play() method to play the media. On the second click, the button will be toggled back again -- the "play" icon will be shown again, and the video will be paused with HTMLMediaElement.pause(). Stopping the video Next, let's add functionality to handle stopping the video. Add the following addEventListener() lines below the previous one you added: stop.addEventListener('click', stopMedia); media.addEventListener('ended', stopMedia); The click event is obvious -- we want to stop the video by running our stopMedia() function when the stop button is clicked. We do however also want to stop the video when it finishes playing -- this is marked by the ended event firing, so we also set up a listener to r...
...And 6 more matches
Basic math in JavaScript — numbers and operators - Learn web development
to check that everything is in order: let myInt = 5; let myFloat = 6.667; myInt; myFloat; Number values are typed in without quote marks -- try declaring and initializing a couple more variables containing numbers before you move on. Now let's check that both our original variables are of the same datatype. There is an operator called typeof in JavaScript that does this. 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. Phew! Useful Number methods The Number object, an instance of which represents all standard numbers you'll use in your JavaScript, has a number of useful methods a...
...n detail in this article because we wanted to keep it as a simple introduction and only cover the real basic essentials for now; however, once you've read through this module a couple of times it is worth going to the object reference pages and learning more about what's available. For example, to round your number to a fixed number of decimal places, use the toFixed() method. Type the following lines into your browser's console: let lotsOfDecimal = 1.766584958675746364; lotsOfDecimal; let twoDecimalPlaces = lotsOfDecimal.toFixed(2); twoDecimalPlaces; Converting to number data types Sometimes you might end up with a number that is stored as a string type, which makes it difficult to perform calculations with it. This most commonly happens when data is entered into a form input, and the inp...
... Sometimes you might end up with a number that is stored as a string type, which makes it difficult to perform calculations with it. This most commonly happens when data is entered into a form input, and the input type is text. There is a way to solve this problem -- passing the string value into the Number() constructor to return a number version of the same value. For example, try typing these lines into your console: let myNumber = '74'; myNumber + 3; You end up with the result 743, not 77, because myNumber is actually defined as a string. You can test this by typing in the following: typeof myNumber; To fix the calculation, you can do this: Number(myNumber) + 3; Arithmetic operators Arithmetic operators are the basic operators that we use to do sums in JavaScript: Operato...
...And 6 more matches
What is JavaScript? - Learn web development
ge of style rules that we use to apply styling to our HTML content, for example setting background colors and fonts, and laying out our content in multiple columns. JavaScript is a scripting language that enables you to create dynamically updating content, control multimedia, animate images, and pretty much everything else. (Okay, not everything, but it is amazing what you can achieve with a few lines of JavaScript code.) The three layers build on top of one another nicely. Let's take a simple text label as an example. We can mark it up using HTML to give it structure and purpose: <p>Player 1: Chris</p> Then we can add some CSS into the mix to get it looking nice: p { font-family: 'helvetica neue', helvetica, sans-serif; letter-spacing: 1px; text-transform: uppercase; text-alig...
... Then we can add some CSS into the mix to get it looking nice: p { font-family: 'helvetica neue', helvetica, sans-serif; letter-spacing: 1px; text-transform: uppercase; text-align: center; border: 2px solid rgba(0,0,200,0.6); background: rgba(0,0,200,0.3); color: rgba(0,0,200,0.6); box-shadow: 1px 1px 2px rgba(0,0,200,0.4); border-radius: 10px; padding: 3px 10px; display: inline-block; cursor: pointer; } And finally, we can add some JavaScript to implement dynamic behaviour: const para = document.querySelector('p'); para.addEventListener('click', updateName); function updateName() { let name = prompt('Enter a new name'); para.textContent = 'Player 1: ' + name; } Try clicking on this last version of the text label to see what happens (note also that you ca...
...o bottom. This means that you need to be careful what order you put things in. ...
...And 6 more matches
Framework main features - Learn web development
-specific languages All of the frameworks discussed in this module are powered by JavaScript, and all allow you to use domain-specific languages (DSLs) in order to build your applications. In particular, React has popularized the use of JSX for writing its components, while Ember utilizes Handlebars. Unlike HTML, these languages know how to read data variables, and this data can be used to streamline the process of writing your UI. Angular apps often make heavy use of TypeScript. TypeScript is not concerned with the writing of user interfaces, but it is a domain-specific language, and has significant differences to vanilla JavaScript. DSLs can't be read by the browser directly; they must be transformed into JavaScript or HTML first. Transformation is an extra step in the development process...
...DSLs can't be read by the browser directly; they must be transformed into JavaScript or HTML first. Transformation is an extra step in the development process, but framework tooling generally includes the required tools to handle this step, or can be adjusted to include this step. While it is possible to build framework apps without using these domain-specific languages, embracing them will streamline your development process and make it easier to find help from the communities around those frameworks. JSX JSX, which stands for JavaScript and XML, is an extension of JavaScript that brings HTML-like syntax to a JavaScript environment. It was invented by the React team for use in React applications, but can be used to develop other applications -- like Vue apps, for instance. The following sh...
... was invented by the React team for use in React applications, but can be used to develop other applications -- like Vue apps, for instance. The following shows a simple JSX example: const subject = "World"; const header = ( <header> <h1>Hello, {subject}!</h1> </header> ); This expression represents an HTML <header> element with a <h1> element inside. The curly braces around subject on line 4 tell the application to read the value of the subject constant and insert it into our <h1>. When used with React, the JSX from the previous snippet would be compiled into this: var subject = "World"; var header = React.createElement("header", null, React.createElement("h1", null, "Hello, ", subject, "!") ); When ultimately rendered by the browser, the above snippet will produce HTML that l...
...And 6 more matches
Starting our Svelte Todo list app - Learn web development
to browse, add and delete tasks, and also to mark them as complete. This will be the basic functionality that we'll be developing in this tutorial series, plus we'll look at some more advanced concepts along the way too. Prerequisites: At minimum, it is recommended that you are familiar with the core HTML, CSS, and JavaScript languages, and have knowledge of the terminal/command line. You'll need a terminal with node + npm installed to compile and build your app. Objective: To learn how to create a Svelte component, render it inside another component, pass data into it using props, and save its state. Code along with us Git Clone the github repo (if you haven't already done it) with: git clone https://github.com/opensas/mdn-svelte-tutorial.git ...
... import Todos from './components/Todos.svelte' </script> <Todos /> In development mode, Svelte will issue a warning in the browser console when specifying a prop that doesn't exist in the component; in this case we have a name prop being specified when we instantiate the App component inside src/main.js, which isn't used inside App. The console should currently give you a message along the lines of "<App> was created with unknown prop 'name'". To get rid of this, remove the name prop from src/main.js; it should now look like so: import App from './App.svelte' const app = new App({ target: document.body }) export default app Now if you check your testing server URL you'll see our Todos.svelte component being rendered: Adding static markup For the moment we will start with ...
...st of them have already been ported to Svelte. On GitHub you can see which accessibility checks are still missing. You can check the meaning of each rule by clicking on its link. Styling our markup Let's make the todo list look a little better. ...
...And 6 more matches
Introducing a complete toolchain - Learn web development
nguages. Objective: To solidify what we've learnt so far by working through a complete toolchain case study. There really are unlimited combinations of tools and ways to use them, what you see in this article and the next is only one way that the featured tools can be used for a project. Note: It's also worth repeating that not all of these tools need to be run on the command line. Many of today's code editors (such as VS Code and Atom) have integration support for a lot of tools via plugins. Introducing our case study The toolchain that we are creating in this article will be used to build and deploy a mini site that lists data (taken from one of NASA's open APIs) concerning potentially hazardous space objects that threaten our existence on Earth! It looks like this: ...
... code revision control tool available to developers -- revision control provides many advantages, such as a way to backup your work in a remote place, and a mechanism to work in a team on the same project without fear of overwriting each other's code. It might be obvious to some, but it bears repeating: Git is not the same thing as GitHub. Git is the revision control tool, whereas GitHub is an online store for git repositories (plus a number of useful tools for working with them). Note that, although we're using GitHub in this chapter, there are several alternatives including GitLab and Bitbucket, and you could even host your own git repositories. Using revision control in your projects and including it as part of the toolchain will help manage the evolution of your code. It offers a way to ...
...ake has been introduced somewhere and you are having trouble fixing it -- something all developers need to do once in a while! Git can be downloaded and installed via the git-scm website -- download the relevant installer for your system, run it, and follow the on-screen prompts. This is all you need to do for now. You can interact with git in a number of different ways, from using the command line to issue commands, to using a git GUI app to issue the same commands by pushing buttons, or even from directly inside your code editor, as seen in the Visual Studio Code example below: Anyway, installing git is all we need to do for now. Let's move on. Code tidying tools We'll be using Prettier, which we first met in Chapter 2, to tidy our code in this project. If you followed the directions...
...And 6 more matches
Localizing with Mercurial
ing and configuring Mercurial, instructions on receiving an Hg account commit priviledges, as well as a few tasks you can complete without account priviledges. Installing Mercurial Follow the instructions below to install Mercurial on your system. Once you've installed Mercurial, we'll walk through the steps to configure it. Mercurial on Linux You can easily install Mercurial from the command line by issuing one of the following commands. Choose the appropriate command for your distribution and make sure to run as root. # Debian/ubuntu $ apt-get install mercurial # Fedora $ yum install mercurial # Gentoo $ emerge mercurial # Arch Linux $ pacman -S mercurial # OpenSolaris $ pkg install SUNWmercurial If you prefer a graphical interface, you can download and install MercurialEclipse he...
...Terminal window and enter hg --version. If you see a message about the version of Mercurial (e.g. Mercurial Distributed SCM (version 1.3.1)), you have installed Mercurial successfully! More details For more details on installing Hg on Linux systems, refer to the instructions on Mercurial's Download page. ...
...Use the add_path.exe utility found in C:\mozilla-build\hg to do this. PS C:\Users\your_id> cd C:\mozilla-build\hg PS C:\mozilla-build\hg> .\add_path.exe /result . ...
...And 6 more matches
MathML Torture Test
</mfrac> </mrow> </mfrac> </mrow> </mfrac> </mrow> </math> </td></tr> <tr> <td>8</td> <td><img src="https://udn.realityripple.com/samples/4e/5132919863.png" width="54" height="50" alt="TeXbook, 17.5-17.6" /></td> <td> <math display="block"> <mrow> <mo>(</mo> <mfrac linethickness="0px"> <mi>n</mi> <mrow> <mi>k</mi> <mo>/</mo> <mn>2</mn> </mrow> </mfrac> <mo>)</mo> </mrow> </math> </td></tr> <tr> <td>9</td> <td><img src="https://udn.realityripple.com/samples/52/183910d0f1.png" width="237" height="50" alt="TeXbook, 17.7" /></td> <td> ...
...<mo>/</mo> <mn>2</mn> </mrow> </mfrac> <mo>)</mo> </mrow> </math> </td></tr> <tr> <td>9</td> <td><img src="https://udn.realityripple.com/samples/52/183910d0f1.png" width="237" height="50" alt="TeXbook, 17.7" /></td> <td> <math display="block"> <mrow> <mrow> <mo>(</mo> <mfrac linethickness="0px"> <mi>p</mi> <mn>2</mn> </mfrac> <mo>)</mo> </mrow> <msup> <mi>x</mi> <mn>2</mn> </msup> <msup> <mi>y</mi> <mrow> <mi>p</mi> <mo>-</mo> <mn>2</mn> </mrow> </msup> <mo>-</m...
...> </msup> </mrow> </mfrac> </mrow> </math> </td></tr> <tr> <td>10</td> <td><img src="https://udn.realityripple.com/samples/e4/0fe420309f.png" width="116" height="63" alt="TeXbook, 17.7-17.8" /></td> <td> <math display="block"> <mrow> <munder> <mo>&sum;</mo> <mrow> <mfrac linethickness="0px"> <mrow> <mn>0</mn> <mo>&leq;</mo> <mi>i</mi> <mo>&leq;</mo> <mi>m</mi> </mrow> <mrow> <mn>0</mn> <mo>&lt;</mo> <mi>j</mi> <mo>&lt;</mo> <mi>n</mi> ...
...And 6 more matches
How to embed the JavaScript engine
JS::RootedObject global(cx, JS_NewGlobalObject(cx, &global_class, nullptr)); if (!global) return 1; JS::RootedValue rval(cx); { // Scope for JSAutoCompartment JSAutoCompartment ac(cx, global); JS_InitStandardClasses(cx, global); const char *script = "'hello'+'world, it is '+new Date()"; const char *filename = "noname"; int lineno = 1; bool ok = JS_EvaluateScript(cx, global, script, strlen(script), filename, lineno, rval.address()); if (!ok) return 1; } JSString *str = rval.toString(); printf("%s\n", JS_EncodeString(cx, str)); } JS_DestroyContext(cx); JS_DestroyRuntime(rt); JS_ShutDown(); return 0; } SpiderMonkey 31 // following code might be needed in ...
...al(cx, JS_NewGlobalObject(cx, &global_class, nullptr, JS::FireOnNewGlobalHook)); if (!global) return 1; JS::RootedValue rval(cx); { // Scope for JSAutoCompartment JSAutoCompartment ac(cx, global); JS_InitStandardClasses(cx, global); const char *script = "'hello'+'world, it is '+new Date()"; const char *filename = "noname"; int lineno = 1; bool ok = JS_EvaluateScript(cx, global, script, strlen(script), filename, lineno, &rval); if (!ok) return 1; } JSString *str = rval.toString(); printf("%s\n", JS_EncodeString(cx, str)); } JS_DestroyContext(cx); JS_DestroyRuntime(rt); JS_ShutDown(); return 0; } SpiderMonkey 38 // following code might be needed in some case...
...al(cx, JS_NewGlobalObject(cx, &global_class, nullptr, JS::FireOnNewGlobalHook)); if (!global) return 1; JS::RootedValue rval(cx); { // Scope for JSAutoCompartment JSAutoCompartment ac(cx, global); JS_InitStandardClasses(cx, global); const char *script = "'hello'+'world, it is '+new Date()"; const char *filename = "noname"; int lineno = 1; JS::CompileOptions opts(cx); opts.setFileAndLine(filename, lineno); bool ok = JS::Evaluate(cx, global, opts, script, strlen(script), &rval); if (!ok) return 1; } JSString *str = rval.toString(); printf("%s\n", JS_EncodeString(cx, str)); } JS_DestroyContext(cx); JS_DestroyRuntime(rt); JS_ShutDown(); return 0; ...
...And 6 more matches
JSAPI Cookbook
ow other error types, such as SyntaxError or TypeError, use JS_ReportErrorNumber instead. JavaScript also supports throwing any value at all, not just Error objects. Use JS_SetPendingException to throw an arbitrary JS::Value from C/C++. ...
... SyntaxError or TypeError, use JS_ReportErrorNumber instead. JavaScript also supports throwing any value at all, not just Error objects. Use JS_SetPendingException to throw an arbitrary JS::Value from C/C++. ...
...upports throwing any value at all, not just Error objects. Use JS_SetPendingException to throw an arbitrary JS::Value from C/C++. // JavaScript throw exc; /* JSAPI */ JS_SetPendingException(cx, exc); return false; When JS_ReportError creates a new Error object, it sets the fileName and lineNumber properties to the line of JavaScript code currently at the top of the stack. This is usually the line of code that called your native function, so it's usually what you want. ...
...And 6 more matches
Shell global objects
Note: this list overlaps with "Built-in functions" in Introduction to the JavaScript shell and is probably not complete. See js/src/shell/js.cpp (around shell_functions) for more. This page lists variables and functions available on SpiderMonkey 53. There may be some difference between each versions. You can get the list of functions by help() function in js shell. Variables scriptArgs An array that contains arguments passed to js shell. scriptPath A string that is a path of script. ...
... arguments. Filename is relative to the calling script. evaluate(code[, options]) Evaluate code as though it were the contents of a file. ...
...s relative to the calling script. evaluate(code[, options]) Evaluate code as though it were the contents of a file. ...
...And 6 more matches
CSS Grid Inspector: Examine grid layouts - Firefox Developer Tools
tures. In the HTML pane In the HTML Pane, elements laid out using a grid have a "grid" marker beside them. In the CSS pane In the CSS pane's Rules view, any instance of a display: grid declaration gets a grid icon included within it: . Clicking the icon toggles the display of a grid overlay on the page, which appears over the element, laid out like a grid to show the position of its grid lines and tracks: The overlay is still shown when you select other elements, so you can edit related CSS properties and see how the grid is affected. The Layout view Grid section When grids are included on a page, the CSS pane's Layout view includes a "Grid" section containing a number of options for viewing those Grids. You can find out more about those in the section below. Note: The Layout v...
...spector. The above and below screenshots should give you further hints on how to get to this. Grid options The Grid section of the Layout view looks like this: You'll see a number of options contained within: Overlay Grid: Contains a checkbox for each grid present on the page, along with various options. Allows overlay views to be toggled on and off. ...
...below screenshots should give you further hints on how to get to this. Grid options The Grid section of the Layout view looks like this: You'll see a number of options contained within: Overlay Grid: Contains a checkbox for each grid present on the page, along with various options. Allows overlay views to be toggled on and off. ...
...And 6 more matches
Using the CSS Painting API - Web APIs
ing API. While you can't play with the worklet's script, you can alter the background-size and background-position to change the size and location of the background image. PaintSize In the example above, we created a 20x200 unit box, painted 15 units from the top of the element it is the same regardless of the size of the element. If the text is small, the yellow box looks like a huge underline. If the text is huge, the box might look like an bar above the first three letters. It would be better if the background image was relative to the size of the element -- we can use the element's paintSize property to ensure the background image is proportional to the size of the element's box model size. In the above image, the background proportional to the size of the element. The 3rd exampl...
....js'); While you can't play with the worklet's script, you can alter the custom property values to change the colors and width of the background image. Adding complexity The above examples might not seem very exciting, as you could recreate them in a few different ways with existing CSS properties, e.g. by positioning some decorative generated content with ::before, or including background: linear-gradient(yellow, yellow) 0 15px / 200px 20px no-repeat; What makes the CSS Painting API so interesting and powerful is that you can create complex images, passing variables, that automatically resize. Let's take a look at a more complex paint example. registerPaint('headerHighlight', class { static get inputProperties() { return ['--highColour']; } static get contextOptions() { return {al...
... } static get contextOptions() { return {alpha: true}; } paint(ctx, size, props) { /* set where to start the highlight & dimensions */ const x = 0; const y = size.height * 0.3; const blockWidth = size.width * 0.33; const highlightHeight = size.height * 0.85; const color = props.get('--highColour'); ctx.fillStyle = color; ctx.beginPath(); ctx.moveTo( x, y ); ctx.lineTo( blockWidth, y ); ctx.lineTo( blockWidth + highlightHeight, highlightHeight ); ctx.lineTo( x, highlightHeight ); ctx.lineTo( x, y ); ctx.closePath(); ctx.fill(); /* create the dashes */ for (let i = 0; i < 4; i++) { let start = i * 2; ctx.beginPath(); ctx.moveTo( (blockWidth) + (start * 10) + 10, y ); ctx.lineTo( (blockWidth) + (start * 10) + 20, y ); ctx.lineTo( (...
...And 6 more matches
HTMLIFrameElement - Web APIs
The HTMLIFrameElement interface provides special properties and methods (beyond those of the HTMLElement interface it also has available to it by inheritance) for manipulating the layout and presentation of inline frame elements. ...
... The HTMLIFrameElement interface provides special properties and methods (beyond those of the HTMLElement interface it also has available to it by inheritance) for manipulating the layout and presentation of inline frame elements. ...
...meElement interface provides special properties and methods (beyond those of the HTMLElement interface it also has available to it by inheritance) for manipulating the layout and presentation of inline frame elements. ...
...And 6 more matches
SVGCircleElement - Web APIs
The SVGCircleElement interface is an interface for the <circle> element. ...
... The SVGCircleElement interface is an interface for the <circle> element. ...
...inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 700 140" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monosp...
...And 6 more matches
SVGEllipseElement - Web APIs
The SVGEllipseElement interface provides access to the properties of <ellipse> elements. ...
... The SVGEllipseElement interface provides access to the properties of <ellipse> elements. ...
...inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 140" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monosp...
...And 6 more matches
SVGPolygonElement - Web APIs
The SVGPolygonElement interface provides access to the properties of <polygon> elements, as well as methods to manipulate them. ...
... The SVGPolygonElement interface provides access to the properties of <polygon> elements, as well as methods to manipulate them. ...
...inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 140" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monosp...
...And 6 more matches
SVGRectElement - Web APIs
The SVGRectElement interface provides access to the properties of <rect> elements, as well as methods to manipulate them. ...
... The SVGRectElement interface provides access to the properties of <rect> elements, as well as methods to manipulate them. ...
...inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 140" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monosp...
...And 6 more matches
SVGTextPathElement - Web APIs
The SVGTextPathElement interface corresponds to the <textPath> element. ...
... The SVGTextPathElement interface corresponds to the <textPath> element. ...
...inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 140" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monosp...
...And 6 more matches
SVGTextPositioningElement - Web APIs
The SVGTextPositioningElement interface is implemented by elements that support attributes that position individual text glyphs. It is inherited by SVGTextElement, SVGTSpanElement, SVGTRefElement and SVGAltGlyphElement. ...
...e SVGTextPositioningElement interface is implemented by elements that support attributes that position individual text glyphs. It is inherited by SVGTextElement, SVGTSpanElement, SVGTRefElement and SVGAltGlyphElement. ...
...inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monosp...
...And 6 more matches
Writing a WebSocket server in C# - Web APIs
tem.Net.Sockets.TcpClient AcceptTcpClient() Waits for a Tcp connection, accepts it and returns it as a TcpClient object. Here's a barebones server implementation: using System.Net.Sockets; using System.Net; using System; class Server { public static void Main() { TcpListener server = new TcpListener(IPAddress.Parse("127.0.0.1"), 80); server.Start(); Console.WriteLine("Server has started on 127.0.0.1:80.{0}Waiting for a connection...", Environment.NewLine); TcpClient client = server.AcceptTcpClient(); Console.WriteLine("A client connected."); } } TcpClient Methods: System.Net.Sockets.NetworkStream GetStream() Gets the stream which is the communication channel. Both sides of the channel have reading and writing capability. Proper...
...o until NetworkStream.DataAvailable is true. NetworkStream Methods: Write(Byte[] buffer, int offset, int size) Writes bytes from buffer, offset and size determine length of message. Read(Byte[] buffer, int offset, int size) Reads bytes to buffer. offset and size determine the length of the message. Let us extend our example. ...
... Concatenate it with "258EAFA5-E914-47DA-95CA-C5AB0DC85B11" (a special GUID specified by RFC 6455) Compute SHA-1 and Base64 hash of the new value Write the hash back as the value of "Sec-WebSocket-Accept" response header in an HTTP response if (new System.Text.RegularExpressions.Regex("^GET").IsMatch(data)) { const string eol = "\r\n"; // HTTP/1.1 defines the sequence CR LF as the end-of-line marker Byte[] response = Encoding.UTF8.GetBytes("HTTP/1.1 101 Switching Protocols" + eol + "Connection: Upgrade" + eol + "Upgrade: websocket" + eol + "Sec-WebSocket-Accept: " + Convert.ToBase64String( System.Security.Cryptography.SHA1.Create().ComputeHash( Encoding.UTF8.GetBytes( new System.Text.RegularExpressions.Regex(...
...And 6 more matches
Web Animations API Concepts - Web APIs
, allowing them to to remain consistent and play well together. It also provides a point of reference all browsers can adhere to with the currently available specs. The Two Models: Timing and Animation The Web Animations API runs on top of two models, one that handles time--Timing--and one that handles visual change over time--Animation. ...
... Web Animations API runs on top of two models, one that handles time--Timing--and one that handles visual change over time--Animation. The Timing Model keeps track of how far along a set timeline we've come. The Animation Model determines what the animated object should look like at any given time. Timing The Timing Model is the backbone of working with the WAAPI. Each document has a master timeline, Document.timeline, which stretches from the moment the page is loaded to infinity -- or until the window is closed. Spread along that timeline according to their durations are our animations. Each animation is anchored to a point in the timeline by its startTime, representing the moment along the document's timeline when the animation starts playing. All the animation's playback relies on this ...
...cument.timeline, which stretches from the moment the page is loaded to infinity -- or until the window is closed. Spread along that timeline according to their durations are our animations. Each animation is anchored to a point in the timeline by its startTime, representing the moment along the document's timeline when the animation starts playing. All the animation's playback relies on this timeline: seeking the animation moves the animation's position along the timeline; slowing down or speeding up the playback rate condenses or expands its spread across the timeline; repeating the animation lines up additional iterations of it along the timeline. In the future, we might have timelines based on gestures or scroll position or even parent and child timelines. The Web Animations API opens up s...
...And 6 more matches
Using XMLHttpRequest - Web APIs
for Asynchronous Data Exchange were XML Handling responses There are several types of response attributes defined by the living standard specification for the XMLHttpRequest() constructor. These tell the client making the XMLHttpRequest important information about the status of the response. Some cases where dealing with non-text response types may involve some manipulation and analysis are outlined in the following sections. Analyzing and manipulating the responseXML property If you use XMLHttpRequest to get the content of a remote XML document, the responseXML property will be a DOM object containing a parsed XML document. This could prove difficult to manipulate and analyze. There are four primary ways of analyzing this XML document: Using XPath to address (or point to) parts of it.
... could prove difficult to manipulate and analyze. There are four primary ways of analyzing this XML document: Using XPath to address (or point to) parts of it. Manually Parsing and serializing XML to strings or objects. Using XMLSerializer to serialize DOM trees to strings or to files. RegExp can be used if you always know the content of the XML document beforehand. You might want to remove line breaks, if you use RegExp to scan with regard to line breaks. However, this method is a "last resort" since if the XML code changes slightly, the method will likely fail. Note: XMLHttpRequest can now interpret HTML for you using the responseXML property. Read the article about HTML in XMLHttpRequest to learn how to do this. Processing a responseText property containing an HTML document If y...
... are three primary ways to analyze and parse this raw HTML string: Use the XMLHttpRequest.responseXML property as covered in the article HTML in XMLHttpRequest. Inject the content into the body of a document fragment via fragment.body.innerHTML and traverse the DOM of the fragment. RegExp can be used if you always know the content of the HTML responseText beforehand. You might want to remove line breaks, if you use RegExp to scan with regard to linebreaks. However, this method is a "last resort" since if the HTML code changes slightly, the method will likely fail. Handling binary data Although XMLHttpRequest is most commonly used to send and receive textual data, it can be used to send and receive binary content. There are several well tested methods for coercing the response of an XML...
...And 6 more matches
ARIA: textbox role - Accessibility
The textbox role is used to identify an element that allows the input of free-form text. Whenever possible, rather than using this role, use an <input> element with type="text", for single-line input, or a <textarea> element for multi-line input. Description When an element has the textbox role, the browser sends an accessible textbox event to assistive technologies, which can then notify the user about it. The default is a single line input, in which Return or Enter submits the form; in this case, it is preferable to use an HTML <input> with type="text". To create a multi-line text box which supports line breaks, as in an HTML <textarea>, set aria-multiline="true". Including the HTML contenteditable attribute ensures the text node is editable. <!-- Simple text input field --> <div id="tx...
...multi-line text box which supports line breaks, as in an HTML <textarea>, set aria-multiline="true". Including the HTML contenteditable attribute ensures the text node is editable. <!-- Simple text input field --> <div id="txtboxLabel">Enter your five-digit zipcode</div> <div role="textbox" contenteditable="true" aria-placeholder="5-digit zipcode" aria-labelledby="txtboxLabel"></div> <!-- Multi-line text area --> <div id="txtboxMultilineLabel">Enter the tags for the article</div> <div role="textbox" contenteditable="true" aria-multiline="true" aria-labelledby="txtboxMultilineLabel" aria-required="true"></div> Semantic elements are more concise and require no JavaScript to support textbox features. <label for="txtbox">Enter your five-digit zipcode</label> <input type="text" placeholde...
...Enter the tags for the article</div> <div role="textbox" contenteditable="true" aria-multiline="true" aria-labelledby="txtboxMultilineLabel" aria-required="true"></div> Semantic elements are more concise and require no JavaScript to support textbox features. <label for="txtbox">Enter your five-digit zipcode</label> <input type="text" placeholder="5-digit zipcode" id="txtbox"/> <!-- Multi-line text area --> <label for="txtboxMultiline">Enter the tags for the article</label> <textarea id="txtboxMultiline" required></textarea> Where a text field is read-only, indicated this by setting aria-readonly="true" on the element. Associated ARIA properties aria-activedescendent attribute Taking as it's value the ID of is either a descendant of the element with DOM focus or is a logica...
...And 6 more matches
Accessibility documentation index - Accessibility
sible annotations inside web documents. Typical use cases include edit suggestions (i.e. an addition and/or deletion in an editable document), and comments (e.g. an editorial comment related to a part of a document under review). 6 ARIA guides ARIA Accessible Rich Internet Applications (ARIA) defines ways to make the Web more accessible to people with disabilities. A few guidelines to follow that ensure better accessibility, like using drag and drop for placement of the widgets. 7 ARIA live regions ARIA, Accessibility, ariaLive Using JavaScript, it is possible to dynamically change parts of a page without requiring the entire page to reload -- for instance, to update a list of search results on the fly, or to display a discreet alert or notification wh...
...s such as menus, tree views, rich text fields, and tab panels. These widgets are typically composed of <div> and <span> elements that do not, by nature, offer the same keyboard functionality that their desktop counterparts do. This document describes techniques to make JavaScript widgets accessible with the keyboard. ...
...iques to make JavaScript widgets accessible with the keyboard. 94 Mobile accessibility checklist Accessibility, Firefox OS, Guidelines, Mobile, checklist This document provides a concise checklist of accessibility requirements for mobile app developers. It is intended to continuously evolve as more patterns arise. 95 Understanding the Web Content Accessibility Guidelines WCAG, Web Content Accessibility Guidelines This set of articles provides quick explanations to help you understand the steps that need to be taken to conform to the recommendations outlined in the W3C Web Content Accessibility Guidelines 2.0 or 2.1 (or just WCAG, for the purposes of this writing). 96 Keyboard Accessibility, keyboard If an element can be focused usi...
...And 6 more matches
Perceivable - Accessibility
This article provides practical advice on how to write your web content so that it conforms to the success criteria outlined in the Perceivable principle of the Web Content Accessibility Guidelines (WCAG) 2.0 and 2.1. Perceivable states that users must be able to perceive it in some way, using one or more of their senses. Note: To read the W3C definitions for Perceivable and its guidelines and success criteria, see Principle 1: Perceivable - Information and user interface components must be presentable to users in ways they can perceive. Guideline 1.1 -- Providing text alternatives for non-text content The key here is that text can be converted to other forms that people with disabilities can use. For example, it can be spoken by a screenreader, converted to large print, or repre...
...de an image via an <img> element, give it a blank alt (alt=""). Otherwise, screenreaders may try to read out the filepath, etc. If you are including background video or audio that autoplays, make it as unobtrusive as possible. Don't make it look/sound like content, and provide a control to turn it off. Ideally, don't include it at all. Note: Also see the WCAG description for Guideline 1.1: Text alternatives. Guideline 1.2 -- Providing text alternatives for time-based media Time-based media refers to multimedia with a duration, such as audio and video. Note that if the audio/video serves as an alternative to existing text content, you don't need to provide another text alternative. Success criteria How to conform to the criteria Practical resource 1.
...on. 1.2.9 Provide a transcript for live audio (AAA) For any live audio content being broadcast, a descriptive text should be provided, for example a script of the play or musical you are listening to. This is for the benefit of hearing-impaired viewers who cannot hear the content. See Audio transcripts for transcript information. Note: Also see the WCAG description for Guideline 1.2: Time-based Media: Provide alternatives for time-based media. Guideline 1.3 -- Create content that can be presented in different ways This guideline refers to the ability of content to be consumed by users in multiple ways, accomodating their differing needs. Success criteria How to conform to the criteria Practical resource 1.3.1 Info and relationships (A) ...
...And 6 more matches
Introduction to formatting contexts - CSS: Cascading Style Sheets
The basics of how they behave and how you can make use of these behaviors are also introduced. Everything on a page is part of a formatting context, or an area which has been defined to lay out content in a particular way. A block formatting context (BFC) will lay child elements out according to block layout rules, a flex formatting context will lay its children out as flex items, etc. Each formatting context has specific rules about how layout behaves when in that context. ...
...as flex items, etc. Each formatting context has specific rules about how layout behaves when in that context. Block formatting contexts The outermost element in a document that uses block layout rules establishes the first, or initial block formatting context. This means that every element inside the <html> element's block is laid out according to normal flow following the rules for block and inline layout. Elements participating in a BFC use the rules outlined by the CSS Box Model, which defines how an element's margins, borders, and padding interact with other blocks in the same context. Creating a new block formatting context The <html> element is not the only element capable of creating a block formatting context. Any block-level element can be made to create a BFC by the application o...
...atting context The <html> element is not the only element capable of creating a block formatting context. Any block-level element can be made to create a BFC by the application of certain CSS properties. ...
...And 6 more matches
Subgrid - CSS: Cascading Style Sheets
d container, only the direct children become grid items and can then be placed on the grid that you have created. The children of these items display in normal flow. You can "nest" grids by making a grid item a grid container. These grids however are independent of the parent grid and of each other, meaning that they do not take their track sizing from the parent grid. This makes it difficult to line nested grid items up with the main grid. If you set the value subgrid on grid-template-columns, grid-template-rows or both, instead of creating a new track listing the nested grid uses the tracks defined on the parent. For example, if you use grid-template-columns: subgrid and the nested grid spans three column tracks of the parent, the nested grid will have three column tracks of the same size...
...s, grid-template-rows or both, instead of creating a new track listing the nested grid uses the tracks defined on the parent. For example, if you use grid-template-columns: subgrid and the nested grid spans three column tracks of the parent, the nested grid will have three column tracks of the same size as the parent grid. Gaps are inherited but can also be overridden with a different gap value. Line names can be passed from the parent into the subgrid, and the subgrid can also declare its own line names. Subgrid for columns In the example below I have a grid layout with nine 1fr column tracks and four rows that are a minimum of 100px tall. I place .item from column line 2 to 7, and row 2 to 4. I then make this grid item into a grid, giving it column tracks that are a subgrid and defining ...
...item into a grid, giving it column tracks that are a subgrid and defining rows as normal. As the item spans five column tracks, this means that the subgrid has five column tracks. I can then place .subitem on this grid. The rows in this example are not a subgrid and so behave as a nested grid does normally. The grid area on the parent expands to be large enough for this nested grid. Note that line numbering restarts inside the subgrid -- column line 1, when inside the subgrid, is the first line of the subgrid. The subgridded element doesn't inherit the line numbers of the parent grid. This means that you can safely lay out a component that may be placed in different positions on the main grid, knowing that the line numbers on the component will always be the same. Subgrid for rows The ne...
...And 6 more matches
Logical properties for floating and positioning - CSS: Cascading Style Sheets
he positioning properties used with positioned layout. This guide takes a look at how to use these. Mapped properties and values The table below details the properties and values discussed in this guide along with their physical mappings. They assume a horizontal writing-mode, with a left-to-right direction. ...
...ed layout. This guide takes a look at how to use these. Mapped properties and values The table below details the properties and values discussed in this guide along with their physical mappings. They assume a horizontal writing-mode, with a left-to-right direction. ...
...o use these. Mapped properties and values The table below details the properties and values discussed in this guide along with their physical mappings. They assume a horizontal writing-mode, with a left-to-right direction. ...
...And 6 more matches
Logical properties for sizing - CSS: Cascading Style Sheets
left and right). ...
...in a design you may well use both physical and logical sizing. You might want some features to always relate to the physical dimensions whatever the writing mode. Mappings for dimensions The table below provides mappings between logical and physical properties. ...
...ing. You might want some features to always relate to the physical dimensions whatever the writing mode. Mappings for dimensions The table below provides mappings between logical and physical properties. These mappings assume that you are in a horizontal-tb writing mode, such as English or Arabic, in which case width would be mapped to inline-size. If you were in a vertical writing mode then inline-size would be mapped to height. ...
...And 6 more matches
CSS Logical Properties and Values - CSS: Cascading Style Sheets
Values is a module of CSS introducing logical properties and values that provide the ability to control layout through logical, rather than physical, direction and dimension mappings. The module also defines logical properties and values for properties previously defined in CSS 2.1. Logical properties define direction-relative equivalents of their corresponding physical properties. Block vs. inline Logical properties and values use the abstract terms block and inline to describe the direction in which they flow. The physical meaning of these terms depends on the writing mode. Block dimension The dimension perpendicular to the flow of text within a line, i.e., the vertical dimension in horizontal writing modes, and the horizontal dimension in vertical writing modes. For standard English...
...abstract terms block and inline to describe the direction in which they flow. The physical meaning of these terms depends on the writing mode. Block dimension The dimension perpendicular to the flow of text within a line, i.e., the vertical dimension in horizontal writing modes, and the horizontal dimension in vertical writing modes. For standard English text, it is the vertical dimension. Inline dimension The dimension parallel to the flow of text within a line, i.e., the horizontal dimension in horizontal writing modes, and the vertical dimension in vertical writing modes. For standard English text, it is the horizontal dimension. ...
...al dimension in vertical writing modes. For standard English text, it is the vertical dimension. Inline dimension The dimension parallel to the flow of text within a line, i.e., the horizontal dimension in horizontal writing modes, and the vertical dimension in vertical writing modes. For standard English text, it is the horizontal dimension. ...
...And 6 more matches
CSS Text Decoration - CSS: Cascading Style Sheets
CSS Text Decoration is a module of CSS that defines features relating to text decoration, such as underlines, text shadows, and emphasis marks. Reference Properties letter-spacing text-align text-decoration text-decoration-color text-decoration-line text-decoration-offset text-decoration-skip-ink text-decoration-style text-decoration-thickness text-emphasis text-emphasis-color text-emphasis-position text-emphasis-style text-indent text-rendering text-shadow text-transform white-space word-spacing Guides None. ...
...text-align text-decoration text-decoration-color text-decoration-line text-decoration-offset text-decoration-skip-ink text-decoration-style text-decoration-thickness text-emphasis text-emphasis-color text-emphasis-position text-emphasis-style text-indent text-rendering text-shadow text-transform white-space word-spacing Guides None. ...
...r text-decoration-line text-decoration-offset text-decoration-skip-ink text-decoration-style text-decoration-thickness text-emphasis text-emphasis-color text-emphasis-position text-emphasis-style text-indent text-rendering text-shadow text-transform white-space word-spacing Guides None. ...
...And 6 more matches
Cubic Bezier Generator - CSS: Cascading Style Sheets
result...
...erseX(x) { return (x - rulers) / scaling; } function lX(x) { //Used when drawing vertical lines to prevent subpixel blur var result = cX(x); return Math.round(result) == result ? result + 0.5 : result; } function cY(y) { return (1 - y) * scaling + margin; } function reverseY(y) { return (margin - y) / scaling + 1; } function lY(y) { // Used when drawing horizontal lines to prevent subpixel blur var result = cY(y); return Math.round(result) == result ? result + 0.5 : result; } function drawBezierCurve(x1, y1, x2, y2) { // get the canvas element using the DOM var canvas = document.getElementById('bezier'); // Make sure we don't execute when canvas isn't supported if (canvas.getContext) { // use getContext to use the canvas for ...
... canvas isn't supported if (canvas.getContext) { // use getContext to use the canvas for drawing var ctx = canvas.getContext('2d'); // Clear canvas ctx.clearRect(0, 0, canvas.width, canvas.height); // Draw the rulers ctx.beginPath(); ctx.strokeStyle = "black"; // Draw the Y axis ctx.moveTo(cX(0), cY(0)); ctx.lineTo(cX(1), cY(0)); ctx.textAlign = "right"; for (var i = 0.1; i <= 1; i = i + 0.1) { ctx.moveTo(-basic_scale_size + cX(0), lY(i)); if ((i == 0.5) || (i > 0.9)) { ctx.moveTo(-2 * basic_scale_size + cX(0), lY(i)); ctx.fillText(Math.round(i * 10) / 10, -3 * basic_scale_size + cX(0), cY(i) + 4); // Limitation the c...
...And 6 more matches
align-content - CSS: Cascading Style Sheets
cross-axis or a grid's block axis. The interactive example below use Grid Layout to demonstrate some of the values of this property. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. This property has no effect on single line flex containers (i.e. ones with flex-wrap: nowrap). Syntax /* Basic positional alignment */ /* align-content does not take left and right values */ align-content: center; /* Pack items around the center */ align-content: start; /* Pack items from the start */ align-content: end; /* Pack items from the end */ align-content: flex-start; /* Pack flex items from the start */ align-c...
...t does not take left and right values */ align-content: center; /* Pack items around the center */ align-content: start; /* Pack items from the start */ align-content: end; /* Pack items from the end */ align-content: flex-start; /* Pack flex items from the start */ align-content: flex-end; /* Pack flex items from the end */ /* Normal alignment */ align-content: normal; /* Baseline alignment */ align-content: baseline; align-content: first baseline; align-content: last baseline; /* Distributed alignment */ align-content: space-between; /* Distribute items evenly The first item is flush with the start, the last is flush with the end */ align-content: space-around; /* Distribute items evenly ...
...t container depending on the flex container's cross-end side. This only applies to flex layout items. For items that are not children of a flex container, this value is treated like end. center The items are packed flush to each other in the center of the alignment container along the cross axis. normal The items are packed in their default position as if no align-content value was set. baseline first baseline last baseline Specifies participation in first- or last-baseline alignment: aligns the alignment baseline of the box's first or last baseline set with the corresponding baseline in the shared first or last baseline set of all the boxes in its baseline-sharing group. The fallback alignment for first baseline is start, the one for last baseline is end. space-between The items...
...And 6 more matches
align-items - CSS: Cascading Style Sheets
ms: normal; align-items: stretch; /* Positional alignment */ /* align-items does not take left and right values */ align-items: center; /* Pack items around the center */ align-items: start; /* Pack items from the start */ align-items: end; /* Pack items from the end */ align-items: flex-start; /* Pack flex items from the start */ align-items: flex-end; /* Pack flex items from the end */ /* Baseline alignment */ align-items: baseline; align-items: first baseline; align-items: last baseline; /* Overflow alignment (for positional alignment only) */ align-items: safe center; align-items: unsafe center; /* Global values */ align-items: inherit; align-items: initial; align-items: unset; Values normal The effect of this keyword is dependent of the layout mode we are in: In absolutely-po...
... For flex items, the keyword behaves as stretch. For grid items, this keyword leads to a behavior similar to the one of stretch, except for boxes with an aspect ratio or an intrinsic sizes where it behaves like start. The property doesn't apply to block-level boxes, and to table cells. flex-start The cross-start margin edges of the flex items are flushed with the cross-start edge of the line. flex-end The cross-end margin edges of the flex items are flushed with the cross-end edge of the line. center The flex items' margin boxes are centered within the line on the cross-axis. If the cross-size of an item is larger than the flex container, it will overflow equally in both directions. start The items are packed flush to each other toward the start edge of the alignment container ...
... axis. end The items are packed flush to each other toward the end edge of the alignment container in the appropriate axis. self-start The items are packed flush to the edge of the alignment container of the start side of the item, in the appropriate axis. self-end The items are packed flush to the edge of the alignment container of the end side of the item, in the appropriate axis. ...
...And 6 more matches
background-image - CSS: Cascading Style Sheets
rmal circumstances, web developers should always specify a background-color. If the images cannot be loaded--for instance, when the network is down--the background color will be used as a fallback. Syntax Each background image is specified either as the keyword none or as an <image> value. To specify multiple background images, supply multiple values, separated by a comma: background-image: linear-gradient(to bottom, rgba(255,255,0,0.5), rgba(0,0,255,0.5)), url('https://mdn.mozillademos.org/files/7693/catfront.png'); Values none Is a keyword denoting the absence of images. <image> Is an <image> denoting the image to display. There can be several of them, separated by commas, as multiple backgrounds are supported. Accessibility concerns Browsers do not provide any special info...
...ot provide any special information on background images to assistive technology. This is important primarily for screen readers, as a screen reader will not announce its presence and therefore convey nothing to its users. If the image contains information critical to understanding the page's overall purpose, it is better to describe it semantically in the document. ...
...y nothing to its users. If the image contains information critical to understanding the page's overall purpose, it is better to describe it semantically in the document. MDN Understanding WCAG, Guideline 1.1 explanations Understanding Success Criterion 1.1.1 | W3C Understanding WCAG 2.0 Formal definition Initial valuenoneApplies toall elements. ...
...And 6 more matches
border - CSS: Cascading Style Sheets
Web › CSS › border
r: outset #f33; /* width | style | color */ border: medium dashed green; /* Global values */ border: inherit; border: initial; border: unset; The border property may be specified using one, two, or three of the values listed below. The order of the values does not matter. Note: The border will be invisible if its style is not defined. This is because the style defaults to none. Values <line-width> Sets the thickness of the border. Defaults to medium if absent. See border-width. <line-style> Sets the style of the border. Defaults to none if absent. See border-style. <color> Sets the color of the border. Defaults to currentcolor if absent. See border-color. Description As with all shorthand properties, any omitted sub-values will be set to their initial value. Importantly, bor...
...cially useful when you want all four borders to be the same. To make them different from each other, however, you can use the longhand border-width, border-style, and border-color properties, which accept different values for each side. Alternatively, you can target one border at a time with the physical (e.g., border-top ) and logical (e.g., border-block-start) border properties. Borders vs. outlines Borders and outlines are very similar. However, outlines differ from borders in the following ways: Outlines never take up space, as they are drawn outside of an element's content. According to the spec, outlines don't have to be rectangular, although they usually are. Formal definition Initial valueas each of the properties of the shorthand:border-width: as each of the properties of the...
...) | rgb( <number>{3} [ / <alpha-value>...
...And 6 more matches
grid-area - CSS: Cascading Style Sheets
Web › CSS › grid-area
The grid-area CSS shorthand property specifies a grid item's size and location within a grid by contributing a line, a span, or nothing (automatic) to its grid placement, thereby specifying the edges of its grid area. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. If four <grid-line> values are specified, grid-row-start is set to the first value, grid-column-start is set to the second value, grid-row-end is set to the third value, and grid-column-end is set to the fourth value. When grid-column-end is omitted, if grid-column-start is a <custom-ident>, grid-column-end is set to that <custom-ident>; otherwise...
...m-ident> ] values */ grid-area: span 3; grid-area: span 3 / span some-grid-area; grid-area: 2 span / another-grid-area span; /* Global values */ grid-area: inherit; grid-area: initial; grid-area: unset; Values auto Is a keyword indicating that the property contributes nothing to the grid item's placement, indicating auto-placement or a default span of 1. <custom-ident> If there is a named line with the name '<custom-ident>-start'/'<custom-ident>-end', it contributes the first such line to the grid item's placement. Note: Named grid areas automatically generate implicit named lines of this form, so specifying grid-area: foo; will choose the start/end edge of that named grid area (unless another line named foo-start/foo-end was explicitly specified before it). Otherwise, this is treat...
... Named grid areas automatically generate implicit named lines of this form, so specifying grid-area: foo; will choose the start/end edge of that named grid area (unless another line named foo-start/foo-end was explicitly specified before it). Otherwise, this is treated as if the integer 1 had been specified along with the <custom-ident>. <integer> && <custom-ident>? Contributes the nth grid line to the grid item's placement. If a negative integer is given, it instead counts in reverse, starting from the end edge of the explicit grid. If a name is given as a <custom-ident>, only lines with that name are counted. If not enough lines with that name exist, all implicit grid lines are assumed to have that name for the purpose of finding this position. An <integer> value of 0 is invalid. ...
...And 6 more matches
grid-column-end - CSS: Cascading Style Sheets
The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...nd: span 3; grid-column-end: span somegridarea; grid-column-end: 5 somegridarea span; /* Global values */ grid-column-end: inherit; grid-column-end: initial; grid-column-end: unset; Values auto Is a keyword indicating that the property contributes nothing to the grid item's placement, indicating auto-placement, an automatic span, or a default span of 1. <custom-ident> If there is a named line with the name '<custom-ident>-end', it contributes the first such line to the grid item's placement. Note: Named grid areas automatically generate implicit named lines of this form, so specifying grid-column-end: foo; will choose the end edge of that named grid area (unless another line named foo-end was explicitly specified before it). Otherwise, this is treated as if the integer 1 had been s...
...nt. Note: Named grid areas automatically generate implicit named lines of this form, so specifying grid-column-end: foo; will choose the end edge of that named grid area (unless another line named foo-end was explicitly specified before it). Otherwise, this is treated as if the integer 1 had been specified along with the <custom-ident>. <integer> && <custom-ident>? Contributes the nth grid line to the grid item's placement. If a negative integer is given, it instead counts in reverse, starting from the end edge of the explicit grid. If a name is given as a <custom-ident>, only lines with that name are counted. If not enough lines with that name exist, all implicit grid lines are assumed to have that name for the purpose of finding this position. An <integer> value of 0 is invalid. ...
...And 6 more matches
grid-row-end - CSS: Cascading Style Sheets
The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...s */ grid-row-end: span 3; grid-row-end: span somegridarea; grid-row-end: 5 somegridarea span; /* Global values */ grid-row-end: inherit; grid-row-end: initial; grid-row-end: unset; Values auto Is a keyword indicating that the property contributes nothing to the grid item's placement, indicating auto-placement, an automatic span, or a default span of 1. <custom-ident> If there is a named line with the name '<custom-ident>-end', it contributes the first such line to the grid item's placement. Note: Named grid areas automatically generate implicit named lines of this form, so specifying grid-row-end: foo; will choose the end edge of that named grid area (unless another line named foo-end was explicitly specified before it). Otherwise, this is treated as if the integer 1 had been spec...
...rate implicit named lines of this form, so specifying grid-row-end: foo; will choose the end edge of that named grid area (unless another line named foo-end was explicitly specified before it). Otherwise, this is treated as if the integer 1 had been specified along with the <custom-ident>. The <custom-ident> cannot take the span value. <integer> && <custom-ident>? Contributes the nth grid line to the grid item's placement. If a negative integer is given, it instead counts in reverse, starting from the end edge of the explicit grid. If a name is given as a <custom-ident>, only lines with that name are counted. If not enough lines with that name exist, all implicit grid lines are assumed to have that name for the purpose of finding this position. An <integer> value of 0 is invalid. ...
...And 6 more matches
grid-row - CSS: Cascading Style Sheets
Web › CSS › grid-row
The grid-row CSS shorthand property specifies a grid item's size and location within the grid row by contributing a line, a span, or nothing (automatic) to its grid placement, thereby specifying the inline-start and inline-end edge of its grid area. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. If two <grid-line> values are specified, the grid-row-start longhand is set to the value before the slash, and the grid-row-end longhand is set to the value after the slash. Constituent properties This property is a shorthand for the following CSS properties: grid-row-end grid-row-start Syntax /* Keyword val...
... span 3 / 6; grid-row: span somegridarea / span someothergridarea; grid-row: 5 somegridarea span / 2 span; /* Global values */ grid-row: inherit; grid-row: initial; grid-row: unset; Values auto Is a keyword indicating that the property contributes nothing to the grid item's placement, indicating auto-placement, an automatic span, or a default span of 1. <custom-ident> If there is a named line with the name '<custom-ident>-start'/'<custom-ident>-end', it contributes the first such line to the grid item's placement. Note: Named grid areas automatically generate implicit named lines of this form, so specifying grid-row: foo; will choose the start/end edge of that named grid area (unless another line named foo-start/foo-end was explicitly specified before it). Otherwise, this is treate...
...: Named grid areas automatically generate implicit named lines of this form, so specifying grid-row: foo; will choose the start/end edge of that named grid area (unless another line named foo-start/foo-end was explicitly specified before it). Otherwise, this is treated as if the integer 1 had been specified along with the <custom-ident>. <integer> && <custom-ident>? Contributes the nth grid line to the grid item's placement. If a negative integer is given, it instead counts in reverse, starting from the end edge of the explicit grid. If a name is given as a <custom-ident>, only lines with that name are counted. If not enough lines with that name exist, all implicit grid lines are assumed to have that name for the purpose of finding this position. An <integer> value of 0 is invalid. ...
...And 6 more matches
grid-template-columns - CSS: Cascading Style Sheets
The grid-template-columns CSS property defines the line names and track sizing functions of the grid columns. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...unctions of the grid columns. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...ce for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...And 6 more matches
place-self - CSS: Cascading Style Sheets
the align-self and justify-self properties) in a relevant layout system such as Grid or Flexbox. If the second value is not present, the first value is also used for it. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
... normal The effect of this keyword is dependent of the layout mode we are in: In absolutely-positioned layouts, the ...
... normal The effect of this keyword is dependent of the layout mode we are in: In absolutely-positioned layouts, the keyword behaves like start on repl...
...And 6 more matches
text-decoration-color - CSS: Cascading Style Sheets
The text-decoration-color CSS property sets the color of decorations added to text by text-decoration-line. The color applies to decorations, such as underlines, overlines, strikethroughs, and wavy lines like those used to mark misspellings, in the scope of the property's value. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. CSS does not provide a direct mechanism for specifying a unique color for each line type. ...
... The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. CSS does not provide a direct mechanism for specifying a unique color for each line type. This effect can nevertheless be achieved by nesting elements, applying a different line type to each element (with the text-decoration-line property), and specifying the line color (with text-decoration-color) on a per-element basis. Syntax /* <color> values */ text-decoration-color: currentcolor; text-decoration-color: red; text-decoration-color: #00ff00; text-decoration-color: rgba(255, 128, 128, 0.5); text-decoration-color: transparent; /* Global values */ text-decoration-colo...
...ion-color) on a per-element basis. Syntax /* <color> values */ text-decoration-color: currentcolor; text-decoration-color: red; text-decoration-color: #00ff00; text-decoration-color: rgba(255, 128, 128, 0.5); text-decoration-color: transparent; /* Global values */ text-decoration-color: inherit; text-decoration-color: initial; text-decoration-color: unset; Values <color> The color of the line decoration. Accessibility concerns It is important to ensure that the contrast ratio between the color of the text, the background the text is placed over, and the text decoration line is high enough that people experiencing low vision conditions will be able to read the content of the page. Color contrast ratio is determined by comparing the luminosity of the text and background color values.
...And 6 more matches
<hgroup> - HTML: Hypertext Markup Language
Web › HTML › Element › hgroup
ment Attributes This element only includes the global attributes. Usage notes The <hgroup> element has been removed from the HTML5 (W3C) specification, but it still is in the WHATWG version of HTML. It is partially implemented in most browsers, though, so is unlikely to go away. However, given that a key purpose of the <hgroup> element is to affect how headings are displayed by the outline algorithm defined in the HTML specification--but the HTML outline algorithm is not implemented in any browsers--then the <hgroup> semantics are in practice only theoretical. So the HTML5 (W3C) specification provides advice on how to mark up Subheadings, subtitles, alternative titles and taglines without using <hgroup>. The <hgroup> element allows the primary heading for a document section to b...
... subtitles, alternative titles and taglines without using <hgroup>. The <hgroup> element allows the primary heading for a document section to be grouped with any secondary headings--such as subheadings or alternative titles--to form a multi-level heading. In other words, the <hgroup> element prevents any of its secondary <h1>-<h6> children from creating separate sections of their own in the outline--as those <h1>-<h6> elements otherwise normally would if they were not children of any <hgroup>. ...
...ocument section to be grouped with any secondary headings--such as subheadings or alternative titles--to form a multi-level heading. In other words, the <hgroup> element prevents any of its secondary <h1>-<h6> children from creating separate sections of their own in the outline--as those <h1>-<h6> elements otherwise normally would if they were not children of any <hgroup>. ...
...And 6 more matches
HTTP Index - HTTP
Web › HTTP › Index
HTTP methods or headers. 5 Choosing between www and non-www URLs Guide, HTTP, URL A recurring question among website owners is whether to choose non-www or www URLs. This page provides some advice on what's best. 6 Data URLs Base64, Guide, HTTP, Intermediate, URL Data URLs, URLs prefixed with the data: scheme, allow content creators to embed small files inline in documents. 7 Evolution of HTTP Guide, HTTP, NeedsUpdate, NeedsUpdate(HTTP/3) HTTP (HyperText Transfer Protocol) is the underlying protocol of the World Wide Web. HTTP has evolved from an early protocol to exchange files in a semi-trusted laboratory environment, to the modern maze of the Internet, now carrying images, videos in high resolution and 3D. 8 Identifyi...
...als. 31 Reason: Did not find method in CORS header 'Access-Control-Allow-Methods' CORS, CORSMethodNotFound, Cross-Origin, Error, HTTP, HTTPS, Messages, Reasons, Security, console, troubleshooting The HTTP method being used by the CORS request is not included in the list of methods specified by the response's Access-Control-Allow-Methods header. This header specifies a comma-delineated list of the HTTP methods which may be used when using CORS to access the URL specified in the request; if the request is using any other method, this error occurs. 32 Reason: Multiple CORS header 'Access-Control-Allow-Origin' not allowed CORS, CORSMultipleAllowOriginNotAllowed, Cross-Origin, Error, HTTP, HTTPS, Messages, Reasons, Security, console, troubleshooting More th...
... header 'Access-Control-Allow-Headers' from CORS preflight channel CORS, CORSMissingAllowHeaderFromPreflight, Cross-Origin, Error, HTTP, HTTPS, Messages, Reasons, Security, console, troubleshooting The Access-Control-Allow-Headers header is sent by the server to let the client know which headers it supports for CORS requests. The value of Access-Control-Allow-Headers should be a comma-delineated list of header names, such as "X-Custom-Information" or any of the standard but non-basic header names (which are always allowed). 37 Feature Policy Feature Policy, Feature-Policy, HTTP, Reference, Security, header Feature Policy allows web developers to selectively enable, disable, and modify the behavior of certain features and APIs in the browser. It is similar to Cont...
...And 6 more matches
HTTP Messages - HTTP
Web › HTTP › Messages
In HTTP/1.1, and earlier versions of the protocol, these messages were openly sent across the connection. ...
... Web server, perform this action. They provide HTTP messages through config files (for proxies or servers), APIs (for browsers), or other interfaces. The HTTP/2 binary framing mechanism has been designed to not require any alteration of the APIs or config files applied: it is broadly transparent to the user. HTTP requests, and responses, share similar structure and are composed of: A start-line describing the requests to be implemented, or its status of whether successful or a failure. This start-line is always a single line. An optional set of HTTP headers specifying the request, or describing the body included in the message. A blank line indicating all meta-information for the request has been sent. An optional body containing data associated with the request (like content of an H...
... a single line. An optional set of HTTP headers specifying the request, or describing the body included in the message. A blank line indicating all meta-information for the request has been sent. An optional body containing data associated with the request (like content of an HTML form), or the document associated with a response. The presence of the body and its size is specified by the start-line and HTTP headers. The start-line and HTTP headers of the HTTP message are collectively known as the head of the requests, whereas its payload is known as the body. HTTP Requests Start line HTTP requests are messages sent by the client to initiate an action on the server. ...
...And 6 more matches
MathML attribute reference - MathML
Specifies the style how the fraction should be displayed. Deprecated. Use U+2044 (fraction slash) instead. Unimplemented charalign <mstack> Specifies the horizontal alignment of digits. close <mfenced> A string for the closing delimiter. columnalign <mtable>, <mtd>, <mtr>, <mlabeledtr> Specifies the horizontal alignment of table cells. columnlines <mtable> Specifies table column borders. columnspacing <mtable> Specifies the space between table columns. columnspan <mtd> A non-negative integer value that indicates over how many table columns the cell extends. Unimplemented columnwidth <mtable> Specifies the width of table columns. Unimplemented crossout <mscarry> Specifies wh...
...e> Specifies table column borders. columnspacing <mtable> Specifies the space between table columns. columnspan <mtd> A non-negative integer value that indicates over how many table columns the cell extends. Unimplemented columnwidth <mtable> Specifies the width of table columns. Unimplemented crossout <mscarry> Specifies what kind of line is drawn to cross out carries. Unimplemented decimalpoint <mstyle> If the decimalpoint value is used to specify the alignment, this attribute is specifying the character for the alignment point within <mstack> and <mtable> columns. denomalign <mfrac> The alignment of the denominator under the fraction. depth <mpadded> Sets or increments the depth. Se...
...s. denomalign <mfrac> The alignment of the denominator under the fraction. depth <mpadded> Sets or increments the depth. See length. dir <math>, <mi>, <mo>, <mrow>, <ms>, <mtext> The text direction. Possible values are either ltr (left to right) or rtl (right to left). display <math> Specifies the rendering mode. The values block and inline are allowed. displaystyle <mstyle>, <mtable> A Boolean value specifying whether more vertical space is used for displayed equations or, if set to false, a more compact layout is used to display formulas. Unimplemented edge <malignmark> Unimplemented equalcolumns <mtable> A Boolean value indicating whether to force all columns to have the same total he...
...And 6 more matches
dx - SVG: Scalable Vector Graphics
Web › SVG › Attribute › dx
The dx attribute indicates a shift along the x-axis on the position of an element or its content. ...
... The dx attribute indicates a shift along the x-axis on the position of an element or its content. ...
...s a shift along the x-axis on the position of an element or its content. ...
...And 6 more matches
y1 - SVG: Scalable Vector Graphics
Web › SVG › Attribute › y1
The y1 attribute is used to specify the first y-coordinate for drawing an SVG element that requires more than one coordinate. Elements that only need one coordinate use the y attribute instead. Two elements are using this attribute: <line>, and <linearGradient> html,body,svg { height:100% } <svg viewBox="0 0 10 10" xmlns="http://www.w3.org/2000/svg"> <line x1="1" x2="9" y1="1" y2="5" stroke="red" /> <line x1="1" x2="9" y1="5" y2="5" stroke="green" /> <line x1="1" x2="9" y1="9" y2="5" stroke="blue" /> </svg> line For <line>, y1 defines the y coordinate of the starting point of the line. Value <length> | <percentage> Default value 0 Animatable Yes Example html,body,svg { height:100% } <svg viewBox="0 0 10 10" xmlns="http://www.w3.
...="1" x2="9" y1="5" y2="5" stroke="green" /> <line x1="1" x2="9" y1="9" y2="5" stroke="blue" /> </svg> line For <line>, y1 defines the y coordinate of the starting point of the line. Value <length> | <percentage> Default value 0 Animatable Yes Example html,body,svg { height:100% } <svg viewBox="0 0 10 10" xmlns="http://www.w3.org/2000/svg"> <line x1="1" x2="9" y1="1" y2="5" stroke="red" /> <line x1="1" x2="9" y1="5" y2="5" stroke="green" /> <line x1="1" x2="9" y1="9" y2="5" stroke="blue" /> </svg> linearGradient For <linearGradient>, y1 defines the y coordinate of the starting point of the gradient vector used to map the gradient stop values. The exact behavior of this attribute is influenced by the gradientUnits attributs ...
...this attribute is influenced by the gradientUnits attributs Value <length> | <percentage> Default value 0% Animatable Yes Example html,body,svg { height:100% } <svg viewBox="0 0 20 10" xmlns="http://www.w3.org/2000/svg"> <!-- By default the gradient vector start at the top left corner of the bounding box of the shape it is applied to. ...
...And 6 more matches
y2 - SVG: Scalable Vector Graphics
Web › SVG › Attribute › y2
The y2 attribute is used to specify the second y-coordinate for drawing an SVG element that requires more than one coordinate. Elements that only need one coordinate use the y attribute instead. Two elements are using this attribute: <line>, and <linearGradient> html,body,svg { height:100% } <svg viewBox="0 0 10 10" xmlns="http://www.w3.org/2000/svg"> <line x1="1" x2="9" y1="5" y2="1" stroke="red" /> <line x1="1" x2="9" y1="5" y2="5" stroke="green" /> <line x1="1" x2="9" y1="5" y2="9" stroke="blue" /> </svg> line For <line>, y2 defines the y coordinate of the ending point of the line. Value <length> | <percentage> Default value 0 Animatable Yes Example html,body,svg { height:100% } <svg viewBox="0 0 10 10" xmlns="http://www.w...
...1="1" x2="9" y1="5" y2="5" stroke="green" /> <line x1="1" x2="9" y1="5" y2="9" stroke="blue" /> </svg> line For <line>, y2 defines the y coordinate of the ending point of the line. Value <length> | <percentage> Default value 0 Animatable Yes Example html,body,svg { height:100% } <svg viewBox="0 0 10 10" xmlns="http://www.w3.org/2000/svg"> <line x1="1" x2="9" y1="5" y2="1" stroke="red" /> <line x1="1" x2="9" y1="5" y2="5" stroke="green" /> <line x1="1" x2="9" y1="5" y2="9" stroke="blue" /> </svg> linearGradient For <linearGradient>, y2 defines the y coordinate of the ending point of the gradient vector used to map the gradient stop values. The exact behavior of this attribute is influenced by the gradientUnits attributs ...
... this attribute is influenced by the gradientUnits attributs Value <length> | <percentage> Default value 0% Animatable Yes Example html,body,svg { height:100% } <svg viewBox="0 0 20 10" xmlns="http://www.w3.org/2000/svg"> <!-- By default the gradient vector end at the top right corner of the bounding box of the shape it is applied to. ...
...And 6 more matches
SVG 1.1 Support in Firefox - SVG: Scalable Vector Graphics
Style Module style Implemented. Shape Module path Implemented. SVGPathElement Interface Unimplemented attributes: normalizedPathSegList, animatedNormalizedPathSegList rect Implemented. circle Implemented. ...
... path Implemented. SVGPathElement Interface Unimplemented attributes: normalizedPathSegList, animatedNormalizedPathSegList rect Implemented. circle Implemented. line Implemented. ellipse Implemented. polyline Implemented. polygon Implemented. ...
...ed. circle Implemented. line Implemented. ellipse Implemented. polyline Implemented. polygon Implemented. Text Module text Implemented. ...
...And 6 more matches
Setting Up a Development Environment - Archive of obsolete content
sential for effective add-on development (or any kind of development, really): a source code editor, a source control system, and a build system. In regards to code editing, there's no official Mozilla IDE. On the other hand, extensions use the same (or similar) languages that are used for web development, so most text editors and IDEs are up to the task. Most XUL tools and plugins you'll find online are merely templates that generate the folder structure for the project, and that's not much help. We recommend Komodo Edit. It's free, open source, and cross-platform. It's based on the Mozilla XULRunner platform, so it has support for some of the particularities in Firefox extension development. Komodo Edit has automatic completion for XUL tags and attributes, and it supports Mozilla's CSS ext...
...s a default tool in most UNIX-based systems. It can be installed on Mac OS X as part of the XCode Tools package, and on Windows with cygwin. In cygwin installations you'll have to explicitly check the make and zip utilities from the long list of packages to download and install. Also make sure that make is in the executable system path. After setting up make, you should be able to open a command line window, run "make -ver", and get the installed version of make as output. We recommend you set up make in your system, since our examples come with all the necessary files to build and install the resulting XPI using this tool. It will save you some packaging time. Or you can create an equivalent system using batch, Ant or whatever you prefer. Ultimately you can just compress the contents of the...
...ction. The only notable additions is a file named Makefile under src. This is the file that make uses to build the XPI. You should take some time to read it and understand it, or at least identify the parts that you should change to get a project of your own going. This GNU Make Manual is a very good reference to get to know make and Makefiles. In most cases you'll only need to change the first lines in Makefile. These define the extension name, the extension id (as specified in install.rdf) and the name of the profile directory where the extension will be installed during development and testing. More about this further ahead. Let's try and build the XPI from the command line first. Open the command line program in your system and navigate to the src directory in your project. Run the foll...
...And 5 more matches
Migrate apps from Internet Explorer to Mozilla - Archive of obsolete content
era or Safari, to work without any changes. Useragent sniffing makes sense in very limited cases where you really do want to know the exact browser in use, such as when you need to work around a bug in a specific version of a specific browser. For all other purposes you should check for the feature you need rather than the browsers you think will support that feature. ...
...s the node immediately preceding the current one. removeAttribute( aName ) Removes the specified attribute from the current node. setAttribute( aName, aValue ) Sets the value of the specified attribute with the specified value. Internet Explorer has a nonstandard quirk, where many of these APIs will skip white space text nodes that are generated, for example, by new line characters. Mozilla will not skip these, so sometimes you need to distinguish these nodes. Every node has a nodeType property specifying the node type. For example, an element node has type 1, while a text node has type 3 and a comment node is type 8. The best way to only process element nodes is to iterate over all child nodes and only process those with a nodeType of 1: HTML: <div id="foo"> ...
...s hide. One concrete example is window.open, which opens a new window: <script> function doOpenWindow(){ var myWindow = window.open("about:blank"); myWindow.location.href = "http://www.ibm.com"; } </script> The problem with the code is that window.open is asynchronous -- it does not block the JavaScript execution until the window has finished loading. Therefore, you may execute the line after the window.open line before the new window has finished. You can deal with this by having an onload handler in the new window and then call back into the opener window (using window.opener). Differences in JavaScript-generating HTML JavaScript can, through document.write, generate HTML on the fly from a string. The main issue here is when JavaScript, embedded inside an HTML document (thus...
...And 5 more matches
BundleLibrary - Archive of obsolete content
on and welcome any contributions from the developer community. ...
...er community. ...
...uted Bundles Gmail w/Gtalk: gmail.webapp (NOTE: work with latest version of Prism!) 32 online todo lists: Zip file with web apps for 32 online todo lists Anywhere.FM: anywhere.fm@prism.app.webapp a service that lets you upload your entire music library to their servers and listen from anywhere through a slick flash interface. ...
...And 5 more matches
Skinning XUL Files by Hand - Archive of obsolete content
s to elements of a type, to specifically identified elements, and to classes of elements creates the potential for redundancies or conflicts in the style information. To avoid this, the makers of the CSS specification have created some rules of precedence that look at how many different rules have been defined for an element, where the style definitions appear (i.e., externally in a CSS file or inline), where the elements themselves appear, and other esoteric variables. If you create a style in your custom stylesheet for a button with a particular id, for example, some of the more basic style information for buttons in the global skin may take precedence over your new style and cause it not to be applied. Make sure you are aware of the way that the global skin defines the skin and which elemen...
...ly reskinned. To keep your XUL looking consistent and to avoid breaking skins altogether (when your styles have some dependency on a part of the global skin that changes, such as an image), use the style rules in the global skin by importing it into your stylesheet with the following instruction: @import url("chrome://global/skin/"); Refer to the document Writing Skinnable XUL and CSS for guidelines on how to make your skins friendly to the global skin, to XUL, and to Mozilla. Stylesheet Syntax To familiarize yourself with the global skin, open up the text file called global.css in the chrome/classic.jar!/skin/classic/global directory of the Mozilla application. In a cascading stylesheet, the style definitions have the following basic form: element { style-attribute1: value; style-at...
...ightblue; font-size: 10pt; } In addition to these basic element style rules, CSS also provides for the application of style information to classes of elements, and element IDs. ...
...And 5 more matches
Player paddle and controls - Game development
l notice if you reload your index.html at this point, the paddle is currently not exactly in the middle. Why? Because the anchor from which the position is calculated always starts from the top left edge of the object. We can change that to have the anchor in the middle of the paddle's width and at the bottom of it's height, so it's easier to position it against the bottom edge. ...
...to have the anchor in the middle of the paddle's width and at the bottom of it's height, so it's easier to position it against the bottom edge. Add the following line below the previous new one: paddle.anchor.set(0.5,1); The paddle is now positioned right where we want it to be. Now, to make it collide with the ball we have to enable physics for the paddle. Continue by adding the following new line, again at the bottom of the create() function: game.physics.enable(paddle, Phaser.Physics.ARCADE); Now the magic can start to happen -- the framework can take care of checking the collision detection on every frame. To enable collision detection between the paddle and ball, add the collide() method to the update() function as shown: function update() { game.physics.arcade.collide(ball, pa...
... are interested in -- the ball -- and the second is the other one, the paddle. This works, but not quite as we expected it to -- when the ball hits the paddle, the paddle falls off the screen! All we want is the ball bouncing off the paddle and the paddle staying in the same place. We can set the body of the paddle to be immovable, so it won't move when the ball hits it. ...
...And 5 more matches
Advanced styling effects - Learn web development
dow.html (see the source code too). A simple box shadow Let's look at a simple example to get things started. First, some HTML: <article class="simple"> <p><strong>Warning</strong>: The thermostat on the cosmic transcender has reached a critical level.</p> </article> Now the CSS: p { margin: 0; } article { max-width: 500px; padding: 10px; background-color: red; background-image: linear-gradient(to bottom, rgba(0,0,0,0), rgba(0,0,0,0.25)); } .simple { box-shadow: 5px 5px 5px rgba(0,0,0,0.7); } This gives us the following result: You'll see that we've got four items in the box-shadow property value: The first length value is the horizontal offset -- the distance to the right the shadow is offset from the original box (or left, if the value is negative). The second le...
...alues. ...
...ight sources. Other box shadow features Unlike text-shadow, box-shadow has an inset keyword available -- putting this at the start of a shadow declaration causes it to become an inner shadow, rather than an outer shadow. Let's have a look and see what we mean. ...
...And 5 more matches
Test your skills: The Box Model - Learn web development
If you get stuck, then ask us for help -- see the Assessment or further help section at the bottom of this page. The Box Model One With the two boxes below, one is using the standard box model, the other the alternate box model. ...
...the alternate box model. Change the width of the second box by adding rules to the .alternate class, so that it matches the visual width of the first box. Your final result will look like the image below. Try updating the live code below to recreate the finished example: For assessment or further work purposes, download the starting point for this task to work in your own editor or in an online editor. The Box Model Two In this task, add to the box: A 5px, black, dotted border. A top margin of 20px. A right margin of 1em. A bottom margin of 40px. A left margin of 2em. Padding on all sides of 1em. Try updating the live code below to recreate the example as displayed in the image: For assessment or further work purposes, download the starting point for this task to work...
...n this task, add to the box: A 5px, black, dotted border. A top margin of 20px. A right margin of 1em. A bottom margin of 40px. A left margin of 2em. Padding on all sides of 1em. ...
...And 5 more matches
Styling lists - Learn web development
These are inherited by everything on the page. Rules 2 and 3 set relative font sizes for the headings, different list types (the children of the list elements inherit these), and paragraphs. This means that each para...
...These are inherited by everything on the page. Rules 2 and 3 set relative font sizes for the headings, different list types (the children of the list elements inherit these), and paragraphs. This means that each paragraph and list will have the same font size and top and bottom s...
...o.) The CSS used for the text styling and spacing is as follows: /* General styles */ html { font-family: Helvetica, Arial, sans-serif; font-size: 10px; } h2 { font-size: 2rem; } ul,ol,dl,p { font-size: 1.5rem; } li, p { line-height: 1.5; } /* Description list styles */ dd, dt { line-height: 1.5; } dt { font-weight: bold; } The first rule sets a sitewide font and a baseline font size of 10px. These are inherited by everything on the page. ...
...And 5 more matches
How can we design for all types of users? - Learn web development
and people using their phones on the street. The W3C defines a good color mix with an algorithm that calculates luminosity ratio between foreground and background. The calculation may seem pretty complicated, but we can rely on tools to do the job for us. Let's download and install the Paciello Group's Colour Contrast Analyser. Note: Alternatively you can find a number of contrast checkers online, such as WebAIM's Color Contrast Checker. We suggest a local checker because it comes packaged with an on-screen color picker to find out a color value. For instance, let's test the colors on this page and see how we fare in the Colour Contrast Analyser: The luminosity contrast ratio between text and background is 8.30:1, which exceeds the minimum standard (4.5:1) and should enable many visu...
...; Let older browsers display fonts with their own internal engine. Browser's engines will ignore any property or value in the CSS if they can't cope with them, so that your website is still usable if not true to your designer's vision. Older browsers are on the way out anyway. Note: Your mileage may vary. If you have to cater to older browsers, you'll have to use ems and do a bit more math. Line width There is a longstanding debate about line length on the web, but here's the story. Back when we had newspapers, printers realized that the reader's eyes would have trouble going from one line to the next if the lines were too long. The solution? Columns. Of course the problem doesn't go away when we switch to the Web. The reader's eyes act like a shuttle going from line to line. To make i...
... To achieve this, you can specify a size for your text's container. ...
...And 5 more matches
CSS basics - Learn web development
t? How do I decorate my webpage with background images and colors? What is CSS? Like HTML, CSS is not a programming language. It's not a markup language either. CSS is a style sheet language. CSS is what you use to selectively style HTML elements. ...
...You should see something like this: If your paragraph text is red, congratulations! Your CSS is working. ...
...ween the <head> and </head> tags). It looks something like this: <link href="https://fonts.googleapis.com/css?family=Open+Sans" rel="stylesheet"> This code links your page to a style sheet that loads the Open Sans font family with your webpage. Next, delete the existing rule you have in your style.css file. It was a good test, but let's not continue with lots of red text. Add the following lines (shown below), replacing the font-family assignment with your font-family selection from What will your website look like?. The property font-family refers to the font(s) you want to use for text. This rule defines a global base font and font size for the whole page. Since <html> is the parent element of the whole page, all elements inside it inherit the same font-size and font-family. html { ...
...And 5 more matches
Cooperative asynchronous JavaScript: Timeouts and intervals - Learn web development
('Hello, Mr. Universe!'); }, 2000) // With a function defined separately function sayHi() { alert('Hello Mr. Universe!'); } let myGreeting = setTimeout(sayHi, 2000); That can be useful if you have a function that needs to be called both from a timeout and in response to an event, for example. But it can also just help keep your code tidy, especially if the timeout callback is more than a few lines of code. setTimeout() returns an identifier value that can be used to refer to the timeout later, such as when you want to stop it. See Clearing timeouts (below) to learn how to do that. Passing parameters to a setTimeout() function Any parameters that you want to pass to the function being run inside the setTimeout() must be passed to it as additional parameters at the end of the list. For ...
...n whatever way you prefer). This sets a red background on the page, sets the <body> height to 100% of the <html> height, and centers the <div> inside the <body>, horizontally and vertically. html { background-color: white; height: 100%; } body { height: inherit; background-color: red; margin: 0; display: flex; justify-content: center; align-items: center; } div { display: inline-block; font-size: 10rem; } Insert a <script> element just above the closing </body> tag. Insert the following JavaScript inside your <script> element. Here, you're storing a reference to the <div> inside a constant, setting a rotateCount variable to 0, setting an uninitialized variable that will later be used to contain a reference to the requestAnimationFrame() call, and setting a ...
...hich will later be used to store the start time of the requestAnimationFrame(). const spinner = document.querySelector('div'); let rotateCount = 0; let startTime = null; let rAF; Below the previous code, insert a draw() function that will be used to contain our animation code, which includes the timestamp parameter: function draw(timestamp) { } Inside draw(), add the following lines. They will define the start time if it is not defined already (this will only happen on the first loop iteration), and set the rotateCount to a value to rotate the spinner by (the current timestamp, take the starting timestamp, divided by three so it doesn't go too fast): if (!startTime) { startTime = timestamp; } rotateCount = (timestamp - startTime) / 3; Below the previous ...
...And 5 more matches
Client-Server Overview - Learn web development
hat 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 format of HTTP messages is defined in a "web standard" (RFC7230). You don't need to know this level of detail, but at least now you know where this all came from! The request Each line of the request contains information about it. The first part is called the header, and contains useful information about the request, in the same way that an HTML head contains useful information about an HTML document (but not the actual content itself, which is in the body): GET https://developer.mozilla.org/search?q=client+server+overview&topic=apps&topic=html&topic=css&topic=js&topic=api&top...
... ...
...tion=False; _gat=1; _ga=GA1.2.1688886003.1471911953; ffo=true The first and second lines contain most of the information we talked about above: The type of request (GET). The target resource URL (/search). The URL parameters (q=client%2Bserver%2Boverview&topic=apps&topic=html&topic=css&topic=js&topic=api&topic=webdev). The target/host website (developer.mozilla.org). The end of the first line also includes a short string identifying the specific protocol version (HTTP/1.1). The final line contains information about the client-side cookies -- you can see in this case the cookie includes an id for managing sessions (Cookie: sessionid=6ynxs23n521lu21b1t136rhbv7ezngie; ...). The remaining lines contain information about the browser used and the sort of responses it can handle. For exam...
...And 5 more matches
Ember interactivity: Events, classes and state - Learn web development
todo items. Along the way, we'll look at using events in Ember, creating component classes to contain JavaScript code to control interactive features, and setting up a service to keep track of the data state of our app. Prerequisites: At minimum, it is recommended that you are familiar with the core HTML, CSS, and JavaScript languages, and have knowledge of the terminal/command line. A deeper understanding of modern JavaScript features (such as classes, modules, etc), will be extremely beneficial, as Ember makes heavy use of them. Objective: To learn how to create component classes and use events to control interactivity, and keep track of app state using a service. Adding Interactivity Now we've got a refactored componentized version of our todo...
... We want to be able to capture the text typed into the input. We do this so that our JavaScript code knows what we typed in, and we can save our todo and pass that text along to the todo list component to display. We can capture the keydown event via the on modifier, which is just Ember syntactic sugar around addEventListener and removeEventListener (see this explanation if needed). Add the new line shown below to your header.hbs file: <input class='new-todo' aria-label='What needs to be done?' placeholder='What needs to be done?' autofocus {{on 'keydown' this.onKeyDown}} > This new attribute is inside double curly braces, which tells you it is part of Ember's dynamic templating syntax. The first argument passed to on is the type of event to respond to (keydown), and the last arg...
...ass: import Service from '@ember/service'; export default class TodoDataService extends Service { } First of all, we want to define what a todo is. We know that we want to track both the text of a todo, and whether or not it is is completed. Add the following import statement below the existing one: import { tracked } from '@glimmer/tracking'; Now add the following class below the previous line you added: class Todo { @tracked text = ''; @tracked isCompleted = false; constructor(text) { this.text = text; } } This class represents a todo -- it contains a @tracked text property containing the text of the todo, and a @tracked isCompleted property that specifies whether the todo has been completed or not. When instantiated, a Todo object will have an initial text value equal ...
...And 5 more matches
Beginning our React todo list - Learn web development
on and interactivity, which we'll add later. Note: If you need to check your code against our version, you can find a finished version of the sample React app code in our todo-react repository. For a running live version, see https://mdn.github.io/todo-react-build/. Prerequisites: Familiarity with the core HTML, CSS, and JavaScript languages, knowledge of the terminal/command line. Objective: To introduce our todo list case study, and get the basic App structure and styling in place. Our app's user stories In software development, a user story is an actionable goal from the perspective of the user. Defining user stories before we begin our work will help us focus our work. Our app should fulfill the following stories: As a user, I can read a lis...
...-- this is actually JavaScript, not HTML! The aria-pressed attribute used in our earlier code snippet has a value of true because aria-pressed is not a true boolean attribute in the way checked is. ...
... not HTML! The aria-pressed attribute used in our earlier code snippet has a value of true because aria-pressed is not a true boolean attribute in the way checked is. ...
...And 5 more matches
Getting started with Svelte - Learn web development
rameworks and tools we've seen so far. Then we will learn how to setup our development environment, create a sample app, understand the structure of the project, and see how to run it locally and build it for production. Prerequisites: At minimum, it is recommended that you are familiar with the core HTML, CSS, and JavaScript languages, and have knowledge of the terminal/command line. Svelte is a compiler that generates minimal and highly optimized JavaScript code from our sources; you'll need a terminal with node + npm installed to compile and build your app. Objective: To setup a local Svelte development environment, create and build a starter app, and understand the basics of how it works. Svelte: A new approach to building rich user interfaces ...
...elopment knowledge: Svelte has a shallow learning curve. Web developers with basic HTML, CSS, and JavaScript knowledge can easily grasp Svelte specifics in a short time and start building web applications. Moreover, with the help of Sapper (a framework based on Svelte), you can also develop applications with advanced features like server-side rendering, code splitting, file-based routing and offline support. And then there's also Svelte Native, which lets you build native mobile applications. How does Svelte work? Being a compiler, Svelte can extend HTML, CSS, and JavaScript, generating optimal JavaScript code without any runtime overhead. To achieve this, Svelte extends vanilla web technologies in the following ways: It extends HTML by allowing JavaScript expressions in markup and prov...
...sics for more information on npm and yarn. If you're using Windows, you will need to install some software to give you parity with Unix/macOS terminal in order to use the terminal commands mentioned in this tutorial. Gitbash (which comes as part of the git for Windows toolset) or Windows Subsystem for Linux (WSL) are both suitable. Cmder is another very good and complete alternative. See Command line crash course for more information on these, and on terminal commands in general. Also see the following for more information: "What is npm" on nodejs.org "Introducing npx" on the npm blog "The easiest way to get started with Svelte" on the svelte blog Creating your first Svelte app The easiest way to create a starter app template is to just download the starter template application. You ...
...And 5 more matches
Accessibility API cross-reference
ways that differ from any of the other interactive ARIA roles, and may be only a part of the main document. APPLICATION FRAME n/a application See <Div> and <NonStruct> A region that contains mostly site-oriented content, rather than page-specific content. ...
...not be mapped to the accessibility API. none, presentation <Private> or perhaps <Artifact> A section whose content is parenthetic or ancillary to the main content of the resource. note A selectable item in a select list. option A tree with expandable & collapseable elements OUTLINE TREE TREE tree A tree item OUTLINEITEM n/a n/a treeitem A tab in a tab panel UI (but is this the actual 'tab' that sticks out, or the panel associated with it?) PAGETAB PAGE_TAB PAGE_TAB tab The container of the page tab controls. PAGETABLIST PAGE_TAB_LIST PAGE_TAB_LIST tabl...
...nt unit in a document or application. section (abstract role) <section> <Sect> A structure that labels or summarizes the topic of its related section. sectionhead (abstract role) A form widget that allows the user to make selections from a set of choices. ...
...And 5 more matches
HTTP logging
g approach won't work, for instance if your bug occurs during startup, or you're running on mobile, etc. In that case you can set environment variables *before* you launch Firefox. Note that this approach winds up logging the whole browser history, so files can get rather large (they compress well :) Setting environment variables differs by operating system. Don't let the scary-looking command line stuff frighten you off; it's not hard at all! Windows If Firefox is already running, exit out of it. Open a command prompt. On Windows XP, you can find the "Run..." command in the Start menu's "All Programs" submenu. On all newer versions of Windows, you can hold down the Windows key and press "R". Type CMD and press enter, a new Command Prompt window with a black background will appear. C...
...s not hard at all! Windows If Firefox is already running, exit out of it. Open a command prompt. On Windows XP, you can find the "Run..." command in the Start menu's "All Programs" submenu. On all newer versions of Windows, you can hold down the Windows key and press "R". Type CMD and press enter, a new Command Prompt window with a black background will appear. Copy and paste the following lines one at a time into the Command Prompt window. Press the enter key after each one.: For 64-bit Windows: set MOZ_LOG=timestamp,rotate:200,nsHttp:5,cache2:5,nsSocketTransport:5,nsHostResolver:5,cookie:5 set MOZ_LOG_FILE=%TEMP%\log.txt "c:\Program Files\Mozilla Firefox\firefox.exe" For 32-bit Windows: set MOZ_LOG=timestamp,rotate:200,nsHttp:5,cache2:5,nsSocketTransport:5,nsHostResolver:5,c...
...pe "%TEMP%" directly into the Windows Explorer location bar to get there quickly. Linux This section offers information on how to capture HTTP logs for Firefox running on Linux. Quit out of Firefox if it's running. Open a new shell. The commands listed here assume a bash-compatible shell. Copy and paste the following commands into the shell one at a time. Make sure to hit enter after each line. export MOZ_LOG=timestamp,rotate:200,nsHttp:5,cache2:5,nsSocketTransport:5,nsHostResolver:5,cookie:5 export MOZ_LOG_FILE=/tmp/log.txt cd /path/to/firefox ./firefox Reproduce the problem you're debugging. When the problem has been reproduced, exit Firefox and look for the generated log files, which you can find at /tmp/log.txt. Mac OS X These instructions show how to log HTTP traffic in ...
...And 5 more matches
CSS <display-xul> component
See this Firefox Site Compatib...
...See this Firefox Site Compatib...
...See this Firefox Site Compatib...
...And 5 more matches
How to implement a custom autocomplete search component
* @return...
... * @return {string} the final value of the result at the given index */ getFinalC...
...To do so put the following declaration in your chrome.manifest file: component {x753d830-ba1e-11e0-962b-0800200c9a66} components/basic_autocomplete.js contract @mozilla.org/autocomplete/search;1?name=basic-autocomplete {x753d830-ba...
...And 5 more matches
SVN for Localizers
r. You use it to copy files from the server to your computer and to push changed or localized files back onto the server. Installing SVN client: Linux users can download the SVN client from http://subversion.apache.org/packages.html or install packages provided within their distribution (for example, in Debian, sudo apt-get install subversion). Mac OS X users can find SVN inside the Command Line Tools (available on the Apple Developer website), or use tools like Homebrew or Fink. Windows users can install the SVN client directly from the Cygwin setup file. If you already installed Cygwin but it didn't include the SVN package, run the Cygwin installer again and be sure to check the box beside Subversion package. This option is found in the Devel category. A possible alternative is to ins...
... or use tools like Homebrew or Fink. Windows users can install the SVN client directly from the Cygwin setup file. If you already installed Cygwin but it didn't include the SVN package, run the Cygwin installer again and be sure to check the box beside Subversion package. This option is found in the Devel category. A possible alternative is to install TortoiseSVN (graphical interface and command line client). Note: If you do not already have access to SVN, visit this wiki page on how to get set up with an SVN account before proceeding. Mozilla's SVN repositories Mozilla's SVN server is publicly available at https://svn.mozilla.org. Despite there being several directories at the root of the SVN server, only the projects and mozillamessaging.com directories apply to web localizers. For thi...
...SVN repositories Mozilla's SVN server is publicly available at https://svn.mozilla.org. Despite there being several directories at the root of the SVN server, only the projects and mozillamessaging.com directories apply to web localizers. For this tutorial we'll use the mozilla.com project. Here's the layout you will find within the projects/mozilla.com directory: Navigating from the command-line with your SVN client, you'll find three directories within projects/mozilla.com. The trunk directory is what you are most insterested in. Trunk refers to a set of files and directories that are in the testing stage (i.e., staging). All file modifications belong in trunk because they are seen most frequently. Inside mozilla.com/trunk/locales, there are separate directories for each locale that is...
...And 5 more matches
powermetrics
It is most useful for getting CPU, GPU and wakeup measurements in a precise and easily scriptable fashion (unlike Activity Monitor and top) especially in combination with rapl via the mach power command. This document describes the version of powermetrics that comes with Mac OS 10.10. The one that comes with 10.9 is less powerful. Note: The power profiling overview is worth reading at this point if you haven't already. It may make parts of this document easier to understand. Quick start powermetrics provides a vast number of measurements. ...
... -n 1 tells it to take one sample and then stop. -i 5000 tells it to use a sample length of 5 seconds (5000 ms). Change this number to get shorter or longer samples. ...
... Safari. The grouping of parent and child processes (in coalitions) is obvious. The meaning of the columns is as follows. Name: Coalition/process name. Process names within coalitions are indented. ID: Coalition/process ID number. CPU ms/s: CPU time used by the coalition/process, per second, during the sample period. The sum of t...
...And 5 more matches
UI Tour - Firefox Developer Tools
pped by the debugger. All child files acquired the eye icon, and the folder menu option changes to Unignore files in this directory. Ignore files outside this directory causes all files other than those within the selected directory to be skipped by the debugger. All such files acquire the eye icon, and the menu option for that folder changes to Unignore files outside this directory. Outline View The Outline view shows a tree for navigating the currently open file. Use it to jump directly to a function, class or method definition. Source pane This shows the JavaScript file currently loaded. When the source pane is focused you can search for a string in the file using Ctrl + F (Cmd + F on a Mac). Breakpoints have a blue arrow overlaid on the line number. Conditional breakpoints h...
...pen file. Use it to jump directly to a function, class or method definition. Source pane This shows the JavaScript file currently loaded. When the source pane is focused you can search for a string in the file using Ctrl + F (Cmd + F on a Mac). Breakpoints have a blue arrow overlaid on the line number. Conditional breakpoints have an orange arrow. If you're stopped at a breakpoint, the entire line gets a green overlay. ...
...e pane This shows the JavaScript file currently loaded. When the source pane is focused you can search for a string in the file using Ctrl + F (Cmd + F on a Mac). Breakpoints have a blue arrow overlaid on the line number. Conditional breakpoints have an orange arrow. If you're stopped at a breakpoint, the entire line gets a green overlay. ...
...And 5 more matches
Examine and edit CSS - Firefox Developer Tools
icon that gives more information when clicked. Filter rules containing this property: next to overridden declarations is an icon you can click to filter the rules list to show only those rules that include that property. See overridden declarations. Enable/disable: if you hover over a declaration, a checkbox appears next to it: you can use this to toggle the declaration on or off. Filename and line number: on the right-hand side is a link to the rule. See link to CSS file. If the element has a display: grid declaration, then it gets a grid icon next to it, like this: . Click that icon to display the grid overlaid on the page, including grid lines and tracks. See Examine grid layouts for more on this. To view user-agent styles (i.e., browser-default CSS rules), enable "Inspector > Show Br...
...It represents the CSS properties assigned to the element via its style attribute. This also gets the target icon: , giving you a convenient way to highlight the currently selected element in the page. ...
...like this: `color`, the search is restricted to exact matches: Expanding shorthand properties Shorthand properties can be expanded to display their related longhand properties by clicking the arrow besides them. ...
...And 5 more matches
Background Tasks API - Web APIs
llback is undefined, we create it here. The function begins by recording the time at which our implementation was called. We'll be using that to compute the value returned by our shim for timeRemaining(). Then we call setTimeout(), passing into it a function which runs the callback passed into our implementation of requestIdleCallback(). The callback is passed an object which conforms to IdleDeadline, with didTimeout set to false and a timeRemaining() method which is implemented to give the callback 50 milliseconds of time to begin with. Each time timeRemaining() is called, it subtracts the elapsed time from the original 50 milliseconds to determine the amount of time left. As a result, while our shim doesn't constrain itself to the amount of idle time left in the current event loop pass lik...
...eCallback = window.cancelIdleCallback || function(id) { clearTimeout(id); } If cancelIdleCallback() isn't defined, this creates one which simply passes the specified callback ID through to clearTimeout(). Now your code will work even on browsers that don't support the Background Tasks API, albeit not as efficiently. Interfaces The Background Tasks API adds only one new interface: IdleDeadline An object of this type is passed to the idle callback to provide an estimate of how long the idle period is expected to last, as well as whether or not the callback is running because its timeout period has expired. The Window interface is also augmented by this API to offer the new requestIdleCallback() and cancelIdleCallback() methods. Example In this example, we'll take a look at how you ...
...lightblue; border-bottom: 1px solid black; border-radius: 6px 6px 0 0; } #log { font: 12px "Courier", monospace; padding: 6px; overflow: auto; overflow-y: scroll; width: 388px; height: 460px; } .container { width: 400px; padding: 6px; border-radius: 6px; border: 1px solid black; box-shadow: 4px 4px 2px black; display: block; overflow: auto; } .label { display: inline-block; } .counter { text-align: right; padding-top: 4px; float: right; } .button { padding-top: 2px; padding-bottom: 4px; width: 100px; display: inline-block; float: left; border: 1px solid black; cursor: pointer; text-align: center; margin-top: 0; color: white; background-color: darkgreen; } #progress { width: 100%; padding-top: 6px; } JavaScript content Now...
...And 5 more matches
Document.execCommand() - Web APIs
When an HTML document has been switched to designMode, its document object exposes an execCommand method to run commands that manipulate the current editable region, such as form inputs or contentEditable elements. Most commands affect the document's selection (bold, italics, etc.), while others insert new elements (adding a link), or affect an entire line (indenting). When using contentEditable, execCommand() affects the currently active editable element. Syntax document.execCommand(aCommandName, aShowDefaultUI, aValueArgument) Return value A Boolean that is false if the command is unsupported or disabled. Note: Only returns true if part of a user interaction. Don't try using the return value to verify browser support before calling a command. Parameters aCommandName A DOMStr...
...arator Changes the paragraph separator used when new paragraphs are created in editable text regions. See Differences in markup generation for more details. delete Deletes the current selection. enableAbsolutePositionEditor Enables or disables the grabber that allows absolutely-positioned elements to be moved around. The grabber is disabled by default since Firefox 64 (bug 1490641). enableInlineTableEditing Enables or disables the table row/column insertion and deletion controls. The controls are disabled by default since Firefox 64 (bug 1490641). enableObjectResizing Enables or disables the resize handles on images, tables, and absolutely-positioned elements and other resizable objects. The handles are disabled by default since Firefox 64 (bug 1490641). fontName Changes the font na...
...equires a font name string (like "Arial") as a value argument. fontSize Changes the font size for the selection or at the insertion point. This requires an integer from 1-7 as a value argument. foreColor Changes a font color for the selection or at the insertion point. This requires a hexadecimal color value string as a value argument. formatBlock Adds an HTML block-level element around the line containing the current selection, replacing the block element containing the line if one exists (in Firefox, <blockquote> is the exception -- it will wrap any containing block element). Requires a tag-name string as a value argument. Virtually all block-level elements can be used. (Internet Explorer and Edge support only heading tags H1-H6, ADDRESS, and PRE, which must be wrapped in angle bracket...
...And 5 more matches
HTMLAudioElement - Web APIs
The HTMLAudioElement interface provides access to the properties of <audio> elements, as well as methods to manipulate them. It's based on, and inherits properties and methods from, the HTMLMediaElement interface. ...
... The HTMLAudioElement interface provides access to the properties of <audio> elements, as well as methods to manipulate them. It's based on, and inherits properties and methods from, the HTMLMediaElement interface. ...
...inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monosp...
...And 5 more matches
HTMLBRElement - Web APIs
The HTMLBRElement interface represents a HTML line break element (<br>). It inherits from HTMLElement. ...
... The HTMLBRElement interface represents a HTML line break element (<br>). It inherits from HTMLElement. ...
... The HTMLBRElement interface represents a HTML line break element (<br>). It inherits from HTMLElement. ...
...And 5 more matches
HTMLInputElement - Web APIs
The HTMLInputElement interface provides special properties and methods for manipulating the options, layout, and presentation of <input> elements. ...
... The HTMLInputElement interface provides special properties and methods for manipulating the options, layout, and presentation of <input> elements. ...
...inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monosp...
...And 5 more matches
HTMLMediaElement - Web APIs
The HTMLMediaElement interface adds to HTMLElement the properties and methods needed to support basic media-related capabilities that are common to audio and video. The HTMLVideoElement and HTMLAudioElement elements both inherit this interface. ...
...ace adds to HTMLElement the properties and methods needed to support basic media-related capabilities that are common to audio and video. The HTMLVideoElement and HTMLAudioElement elements both inherit this interface. ...
...inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 180" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monosp...
...And 5 more matches
HTMLOListElement - Web APIs
The HTMLOListElement interface provides special properties (beyond those defined on the regular HTMLElement interface it also has available to it by inheritance) for manipulating ordered list elements. ...
... The HTMLOListElement interface provides special properties (beyond those defined on the regular HTMLElement interface it also has available to it by inheritance) for manipulating ordered list elements. ...
...inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monosp...
...And 5 more matches
HTMLTableCellElement - Web APIs
The HTMLTableCellElement interface provides special properties and methods (beyond the regular HTMLElement interface it also has available to it by inheritance) for manipulating the layout and presentation of table cells, either header or data cells, in an HTML document. ...
...operties and methods (beyond the regular HTMLElement interface it also has available to it by inheritance) for manipulating the layout and presentation of table cells, either header or data cells, in an HTML document. ...
...inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monosp...
...And 5 more matches
HTMLTableRowElement - Web APIs
The HTMLTableRowElement interface provides special properties and methods (beyond the HTMLElement interface it also has available to it by inheritance) for manipulating the layout and presentation of rows in an HTML table. ...
...TMLTableRowElement interface provides special properties and methods (beyond the HTMLElement interface it also has available to it by inheritance) for manipulating the layout and presentation of rows in an HTML table. ...
...inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monosp...
...And 5 more matches
HTMLTableSectionElement - Web APIs
The HTMLTableSectionElement interface provides special properties and methods (beyond the HTMLElement interface it also has available to it by inheritance) for manipulating the layout and presentation of sections, that is headers, footers and bodies, in an HTML table. ...
...ial properties and methods (beyond the HTMLElement interface it also has available to it by inheritance) for manipulating the layout and presentation of sections, that is headers, footers and bodies, in an HTML table. ...
...inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monosp...
...And 5 more matches
HTMLUListElement - Web APIs
The HTMLUListElement interface provides special properties (beyond those defined on the regular HTMLElement interface it also has available to it by inheritance) for manipulating unordered list elements. ...
... The HTMLUListElement interface provides special properties (beyond those defined on the regular HTMLElement interface it also has available to it by inheritance) for manipulating unordered list elements. ...
...inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monosp...
...And 5 more matches
Recording a media element - Web APIs
return Promise.all([ stopped, recorded ]) .then(() => data); } startRecording() takes two input parameters: a MediaStream to record from and the length in milliseconds of the recording to make. We always record no more than the specified number of milliseconds of media, although if the media stops before that time is reached, MediaRecorder automatically stops recording as well. Line 2 Creates the MediaRecorder that will handle recording the input stream. Line 3 Creates an empty array, data, which will be used to hold the Blobs of media data provided to our ondataavailable event handler. Line 5 Sets up the handler for the dataavailable event. The received event's data property is a Blob that contains the media data. The event handler simply pushes the Blob onto the data ...
...tes the MediaRecorder that will handle recording the input stream. Line 3 Creates an empty array, data, which will be used to hold the Blobs of media data provided to our ondataavailable event handler. Line 5 Sets up the handler for the dataavailable event. The received event's data property is a Blob that contains the media data. The event handler simply pushes the Blob onto the data array. Lines 6-7 Starts the recording process by calling recorder.start(), and outputs a message to the log with the updated state of the recorder and the number of seconds it will be recording. Lines 9-12 Creates a new Promise, named stopped, which is resolved when the MediaRecorder's onstop event handler is called, and is rejected if its onerror event handler is called. The rejection handler receives as...
...g recorder.start(), and outputs a message to the log with the updated state of the recorder and the number of seconds it will be recording. Lines 9-12 Creates a new Promise, named stopped, which is resolved when the MediaRecorder's onstop event handler is called, and is rejected if its onerror event handler is called. The rejection handler receives as input the name of the error that occurred. Lines 14-16 Creates a new Promise, named recorded, which is resolved when the specified number of milliseconds have elapsed. Upon resolution, it stops the MediaRecorder if it's recording. Lines 18-22 These lines create a new Promise which is fulfilled when both of the two Promises (stopped and recorded) have resolved. Once that resolves, the array data is returned by startRecording() to its caller.
...And 5 more matches
Using Pointer Events - Web APIs
nPath(); ctx.arc(touches[i].pageX, touches[i].pageY, 4, 0, 2 * Math.PI, false); // a circle at the start ctx.arc(evt.clientX, evt.clientY, 4, 0, 2 * Math.PI, false); // a circle at the start ctx.fillStyle = color; ctx.fill(); } After storing some of the event's processing in the ongoingTouches for later processing, the start point is drawn as a small circle. We're using a 4-pixel wide line, so a 4 pixel radius circle will show up neatly. Drawing as the pointers move Each time one or more pointers moves, a pointermove event is delivered, resulting in our handleMove() function being called. Its responsibility in this example is to update the cached touch information and to draw a line from the previous position to the current position of each touch. function handleMove(evt) { va...
...ByTagName("canvas")[0]; var ctx = el.getContext("2d"); var color = colorForTouch(evt); var idx = ongoingTouchIndexById(evt.pointerId); log("continuing touch: idx = " + idx); if (idx >= 0) { ctx.beginPath(); log("ctx.moveTo(" + ongoingTouches[idx].pageX + ", " + ongoingTouches[idx].pageY + ");"); ctx.moveTo(ongoingTouches[idx].pageX, ongoingTouches[idx].pageY); log("ctx.lineTo(" + evt.clientX + ", " + evt.clientY + ");"); ctx.lineTo(evt.clientX, evt.clientY); ctx.lineWidth = 4; ctx.strokeStyle = color; ctx.stroke(); ongoingTouches.splice(idx, 1, copyTouch(evt)); // swap in the new touch record log("."); } else { log("can't figure out which touch to continue: idx = " + idx); } } This function looks in our cached touch information ar...
...Width = 4; ctx.strokeStyle = color; ctx.stroke(); ongoingTouches.splice(idx, 1, copyTouch(evt)); // swap in the new touch record log("."); } else { log("can't figure out which touch to continue: idx = " + idx); } } This function looks in our cached touch information array for the previous information about each touch to determine the starting point for each touch's new line segment to be drawn. This is done by looking at each touch's PointerEvent.pointerId property. This property is a unique integer for each pointer event, and remains consistent for each event during the duration of each finger's contact with the surface. This lets us get the coordinates of the previous position of each touch and use the appropriate context methods to draw a line segment joining th...
...And 5 more matches
ReadableStreamDefaultReader.read() - Web APIs
of the form { value: undefined, done: true }. If the stream becomes errored, the promise will be rejected with the relevant error. Exceptions TypeError The source object is not a ReadableStreamDefaultReader, or the stream has no owner. Examples Example 1 - simple example This example shows the basic API usage, but doesn't try to deal with complications like stream chunks not ending on line boundaries for example. In this example stream is a previously-created custom ReadableStream. It is read using a ReadableStreamDefaultReader created using getReader(). (see our Simple random stream example for the full code). Each chunk is read sequentially and output to the UI as an array of UTF-8 bytes, until the stream has finished being read, at which point we return out of the recursive fun...
... charsReceived += value.length; const chunk = value; let listItem = document.createElement('li'); listItem.textContent = 'Received ' + charsReceived + ' characters so far. Current chunk = ' + chunk; list2.appendChild(listItem); result += chunk; // Read some more, and call this function again return reader.read().then(processText); }); } 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. It deals with stream chunks not ending on line boundaries and converting from Uint8Array to strings. async function* makeTextFileLineIterator(fileURL) { const utf8Decoder = new TextDecoder("utf-8"); let response = await fetch(fileURL); let reader = response.body.getReader(); let {value: c...
... Living Standard Initial definition. ...
...And 5 more matches
SVGAnimateElement - Web APIs
The SVGAnimateElement interface corresponds to the <animate> element. ...
... The SVGAnimateElement interface corresponds to the <animate> element. ...
...inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 140" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monosp...
...And 5 more matches
SVGAnimateMotionElement - Web APIs
The SVGAnimateMotionElement interface corresponds to the <animateMotion> element. ...
... The SVGAnimateMotionElement interface corresponds to the <animateMotion> element. ...
...inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 140" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monosp...
...And 5 more matches
SVGAnimateTransformElement - Web APIs
The SVGAnimateTransformElement interface corresponds to the <animateTransform> element. ...
... The SVGAnimateTransformElement interface corresponds to the <animateTransform> element. ...
...inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 140" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monosp...
...And 5 more matches
SVGAnimationElement - Web APIs
The SVGAnimationElement interface is the base interface for all of the animation element interfaces: SVGAnimateElement, SVGSetElement, SVGAnimateColorElement, SVGAnimateMotionElement and SVGAnimateTransformElement. ...
...ionElement interface is the base interface for all of the animation element interfaces: SVGAnimateElement, SVGSetElement, SVGAnimateColorElement, SVGAnimateMotionElement and SVGAnimateTransformElement. ...
...inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 140" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monosp...
...And 5 more matches
SVGComponentTransferFunctionElement - Web APIs
The SVGComponentTransferFunctionElement interface defines a base interface used by the component transfer function interfaces. ...
... The SVGComponentTransferFunctionElement interface defines a base interface used by the component transfer function interfaces. ...
...inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 140" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monosp...
...And 5 more matches
SVGDefsElement - Web APIs
The SVGDefsElement interface corresponds to the <defs> element. ...
... The SVGDefsElement interface corresponds to the <defs> element. ...
...inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 140" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monosp...
...And 5 more matches
SVGFEFuncAElement - Web APIs
The SVGFEFuncAElement interface corresponds to the <feFuncA> element. ...
... The SVGFEFuncAElement interface corresponds to the <feFuncA> element. ...
...inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 140" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monosp...
...And 5 more matches
SVGFEFuncBElement - Web APIs
The SVGFEFuncBElement interface corresponds to the <feFuncB> element. ...
... The SVGFEFuncBElement interface corresponds to the <feFuncB> element. ...
...inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 140" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monosp...
...And 5 more matches
SVGFEFuncGElement - Web APIs
The SVGFEFuncGElement interface corresponds to the <feFuncG> element. ...
... The SVGFEFuncGElement interface corresponds to the <feFuncG> element. ...
...inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 140" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monosp...
...And 5 more matches
SVGFEFuncRElement - Web APIs
The SVGFEFuncRElement interface corresponds to the <feFuncR> element. ...
... The SVGFEFuncRElement interface corresponds to the <feFuncR> element. ...
...inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 140" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monosp...
...And 5 more matches
SVGForeignObjectElement - Web APIs
The SVGForeignObjectElement interface provides access to the properties of <foreignObject> elements, as well as methods to manipulate them. ...
... The SVGForeignObjectElement interface provides access to the properties of <foreignObject> elements, as well as methods to manipulate them. ...
...inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 140" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monosp...
...And 5 more matches
SVGGElement - Web APIs
The SVGGElement interface corresponds to the <g> element. ...
... The SVGGElement interface corresponds to the <g> element. ...
...inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 140" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monosp...
...And 5 more matches
SVGGeometryElement - Web APIs
The SVGGeometryElement interface represents SVG elements whose rendering is defined by geometry with an equivalent path, and which can be filled and stroked. This includes paths and the basic shapes. ...
... The SVGGeometryElement interface represents SVG elements whose rendering is defined by geometry with an equivalent path, and which can be filled and stroked. This includes paths and the basic shapes. ...
...inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 140" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monosp...
...And 5 more matches
SVGImageElement - Web APIs
The SVGImageElement interface corresponds to the <image> element. ...
... The SVGImageElement interface corresponds to the <image> element. ...
...inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 140" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monosp...
...And 5 more matches
SVGRadialGradientElement - Web APIs
The SVGRadialGradientElement interface corresponds to the <RadialGradient> element. ...
... The SVGRadialGradientElement interface corresponds to the <RadialGradient> element. ...
...inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 140" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monosp...
...And 5 more matches
SVGSetElement - Web APIs
The SVGSetElement interface corresponds to the <set> element. ...
... The SVGSetElement interface corresponds to the <set> element. ...
...inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 140" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monosp...
...And 5 more matches
SVGSwitchElement - Web APIs
The SVGSwitchElement interface corresponds to the <switch> element. ...
... The SVGSwitchElement interface corresponds to the <switch> element. ...
...inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 140" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monosp...
...And 5 more matches
SVGTextContentElement - Web APIs
The SVGTextContentElement interface is implemented by elements that support rendering child text content. It is inherited by various text-related interfaces, such as SVGTextElement, SVGTSpanElement, SVGTRefElement, SVGAltGlyphElement and SVGTextPathElement. ...
...mplemented by elements that support rendering child text content. It is inherited by various text-related interfaces, such as SVGTextElement, SVGTSpanElement, SVGTRefElement, SVGAltGlyphElement and SVGTextPathElement. ...
...inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monosp...
...And 5 more matches
SVGUseElement - Web APIs
SVG use DOM interface The SVGUseElement interface corresponds to the <use> element. ...
... SVG use DOM interface The SVGUseElement interface corresponds to the <use> element. ...
...inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 140" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monosp...
...And 5 more matches
Touch events - Web APIs
the touch event (this also prevents a mouse event from also being delivered). Then we get the context and pull the list of changed touch points out of the event's TouchEvent.changedTouches property. After that, we iterate over all the Touch objects in the list, pushing them onto an array of active touchpoints and drawing the start point for the draw as a small circle; we're using a 4-pixel wide line, so a 4-pixel radius circle will show up neatly. Drawing as the touches move Each time one or more fingers move, a touchmove event is delivered, resulting in our handleMove() function being called. Its responsibility in this example is to update the cached touch information and to draw a line from the previous position to the current position of each touch. function handleMove(evt) { evt.pre...
...h; i++) { var color = colorForTouch(touches[i]); var idx = ongoingTouchIndexById(touches[i].identifier); if (idx >= 0) { console.log("continuing touch "+idx); ctx.beginPath(); console.log("ctx.moveTo(" + ongoingTouches[idx].pageX + ", " + ongoingTouches[idx].pageY + ");"); ctx.moveTo(ongoingTouches[idx].pageX, ongoingTouches[idx].pageY); console.log("ctx.lineTo(" + touches[i].pageX + ", " + touches[i].pageY + ");"); ctx.lineTo(touches[i].pageX, touches[i].pageY); ctx.lineWidth = 4; ctx.strokeStyle = color; ctx.stroke(); ongoingTouches.splice(idx, 1, copyTouch(touches[i])); // swap in the new touch record console.log("."); } else { console.log("can't figure out which touch to continue"); } } } Thi...
... ongoingTouches.splice(idx, 1, copyTouch(touches[i])); // swap in the new touch record console.log("."); } else { console.log("can't figure out which touch to continue"); } } } This iterates over the changed touches as well, but it looks in our cached touch information array for the previous information about each touch to determine the starting point for each touch's new line segment to be drawn. This is done by looking at each touch's Touch.identifier property. This property is a unique integer for each touch and remains consistent for each event during the duration of each finger's contact with the surface. This lets us get the coordinates of the previous position of each touch and use the appropriate context methods to draw a line segment joining the two positions...
...And 5 more matches
Starting up and shutting down a WebXR session - Web APIs
more specifics about securing WebXR actitvities and usage, see the article Permissions and security for WebXR. Confirming the session type you need is available Before trying to create a new WebXR session, it's often wise to first check to see if the user's hardware and software support the presentation mode you wish to use. This can also be used to determine whether to use an immersive or an inline presentation, for example. To find out if a given mode is supported, simply call the XRSystem method isSessionSupported(). This returns a promise which resolves to true if the given type of session is available for use or false otherwise. const immersiveOK = await navigator.xr.isSessionSupported("immersive-vr"); if (immersiveOK) { // Create and use an immersive VR session } else { // Create...
...ntation, for example. To find out if a given mode is supported, simply call the XRSystem method isSessionSupported(). This returns a promise which resolves to true if the given type of session is available for use or false otherwise. const immersiveOK = await navigator.xr.isSessionSupported("immersive-vr"); if (immersiveOK) { // Create and use an immersive VR session } else { // Create an inline session instead, or tell the user about the // incompatibility if inline is required } Creating and starting the session A WebXR session is represented by an XRSession object. To obtain an XRSession, you call your XRSystem's requestSession() method, which returns a promise that resolves with an XRSession if it's able to establish one successfully. Fundamentally, that looks like this: xr.req...
... There are three options: immersive-vr A fully-immersive virtual reality session using a headset or similar device that fully replaces the world around the user with the images you present. immersive-ar An augmented reality session in which images are added to the real world using a headset or similar apparatus. This option is not yet widely supported, as the AR specification is in flux. inline An on-screen presentation of the XR imagery within the context of the document window. If the session couldn't be created for some reason--such as feature policy disallowing its use or the user declining to grant permission to use the headset--the promise gets rejected. So a more complete function that starts up and returns a WebXR session could look like this: async function createImmersiveS...
...And 5 more matches
Web APIs
Web › API
ming APIFullscreen APIGGamepad API Geolocation APIHHTML Drag and Drop APIHigh Resolution TimeHistory APIIImage Capture APIIndexedDBIntersection Observer APILLong Tasks API MMedia Capabilities API Media Capture and StreamsMedia Session APIMedia Source Extensions MediaStream RecordingNNavigation TimingNetwork Information API PPage Visibility APIPayment Request APIPerformance APIPerformance Timeline APIPermissions APIPointer EventsPointer Lock APIProximity Events Push API RResize Observer APIResource Timing APISServer Sent EventsService Workers APIStorageStorage Access APIStreams TTouch EventsUURL APIVVibration APIVisual Viewport WWeb AnimationsWeb Audio APIWeb Authentication APIWeb Crypto APIWeb NotificationsWeb Storage APIWeb Workers APIWebGLWebRTCWebVTTWebXR Device APIWebsockets API ...
...ces This is a list of all the interfaces (that is, types of objects) that are available. ...
...UserData DataTransfer DataTransferItem DataTransferItemList DedicatedWorkerGlobalScope DelayNode DeprecationReportBody DeviceLightEvent DeviceMotionEvent DeviceMotionEventAcceleration DeviceMotionEventRotationRate DeviceOrientationEvent DeviceProximityEvent DirectoryEntrySync DirectoryReaderSync DisplayMediaStreamConstraints Document DocumentFragment DocumentOrShadowRoot DocumentTimeline DocumentTouch DocumentType DoubleRange DragEvent DynamicsCompressorNode E EXT_blend_minmax EXT_color_buffer_float EXT_color_buffer_half_float EXT_disjoint_timer_query EXT_float_blend EXT_frag_depth EXT_sRGB EXT_shader_texture_lod EXT_texture_compression_bptc EXT_texture_compression_rgtc EXT_texture_filter_anisotropic EcKeyGenParams EcKeyImportParams EcdhKeyDeriveParams EcdsaParams EffectTiming...
...And 5 more matches
background - CSS: Cascading Style Sheets
ot provide any special information on background images to assistive technology. This is important primarily for screen readers, as a screen reader will not announce its presence and therefore convey nothing to its users. If the image contains information critical to understanding the page's overall purpose, it is better to describe it semantically in the document. ...
...ion 1.1.1 | W3C Understanding WCAG 2.0 Formal definition Initial valueas each of the properties of the shorthand:background-image: nonebackground-position: 0% 0%background-size: auto autobackground-repeat: repeatbackground-origin: padding-boxbackground-clip: border-boxbackground-attachment: scrollbackground-color: transparentApplies toall elements. ...
...image-set()> | <element()> | <paint()> | <cross-fade()> | <gradient><length-percentage> = <length> | <percentage>where <image()> = image( <image-tags>? [ <image-src>? , <color>? ]! ...
...And 5 more matches
content - CSS: Cascading Style Sheets
Web › CSS › content
The content CSS property replaces an element with a generated value. Objects inserted using the content property are anonymous replaced elements. ...
...nt is not included in the DOM. Because of this, it will not be represented in the accessibility tree and certain assistive technology/browser combinations will not announce it. If the content conveys information that is critical to understanding the page's purpose, it is better to include it in the main document. Accessibility support for CSS generated content - Tink Explanation of WCAG, Guideline 1.3 - MDN Understanding Success Criterion 1.3.1 | W3C Understanding WCAG 2.0 Formal definition Initial valuenormalApplies to::before and ::after pseudo-elementsInheritednoComputed valueOn elements, always computes to normal. On ::before and ::after, if normal is specified, computes to none. Otherwise, for URI values, the absolute URI; for attr() values, the resulting string; for other keyword...
...se-quote<target> = <target-counter()> | <target-counters()> | <target-text()><leader()> = leader( <leader-type> )where <image()> = image( <image-tags>? [ <image-src>? , <color>? ]! ...
...And 5 more matches
cross-fade() - CSS: Cascading Style Sheets
ercentages are added together and subtracted from 100%. The result, if greater than 0, is then divided equally between all images with omitted percentages. In the last example, the sum of both percentages is not 100%, and therefore both images include their respective opacities. If no percentages are declared and three images are included, each image will be 33.33% opaque. ...
...t announce its presence and therefore convey nothing to its users. If the image contains information critical to understanding the page's overall purpose, it is better to describe it semantically in the document. When using background images, make sure the contrast in color is great enough that any text is legible over the image as well as if the images is missing. ...
... <rgb()> | <rgba()> | <hsl()> | <hsla()> | <hex-color> | <named-color> | currentcolor | <deprecated-system-color>where <image()> = image( <image-tags>? [ <image-src>? , <color>? ]! ...
...And 5 more matches
grid-template-rows - CSS: Cascading Style Sheets
The grid-template-rows CSS property defines the line names and track sizing functions of the grid rows. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...ack sizing functions of the grid rows. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
... The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...And 5 more matches
margin-left - CSS: Cascading Style Sheets
o The left margin receives a share of the unused horizontal space, as determined mainly by the layout mode that is used. If the values of margin-left and margin-right are both auto, the calculated space is evenly distributed. This table summarizes the different cases: Value of display Value of float Value of position Computed value of auto Comment inline, inline-block, inline-table any static or relative 0 Inline layout mode block, inline, inline-block, block, table, inline-table, list-item, table-caption any static or relative 0, except if both margin-left and margin-right are set to auto. In this case, it is set to the value centering the element inside its parent. Block layout mode block,...
...nline-block, inline-table any static or relative 0 Inline layout mode block, inline, inline-block, block, table, inline-table, list-item, table-caption any static or relative 0, except if both margin-left and margin-right are set to auto. In this case, it is set to the value centering the element inside its parent. ...
...ock, inline-table any static or relative 0 Inline layout mode block, inline, inline-block, block, table, inline-table, list-item, table-caption any static or relative 0, except if both margin-left and margin-right are set to auto. In this case, it is set to the value centering the element inside its parent. ...
...And 5 more matches
margin-right - CSS: Cascading Style Sheets
The right margin receives a share of the unused horizontal space, as determined mainly by the layout mode that is used. If the values of margin-left and margin-right are both auto, the calculated space is evenly distributed. This table summarizes the different cases: Value of display Value of float Value of position Computed value of auto Comment inline, inline-block, inline-table any static or relative 0 Inline layout mode block, inline, inline-block, block, table, inline-table, list-item, table-caption any static or relative 0, except if both margin-left and margin-right are set to auto. In this case, it is set to the value centering the element inside its parent. Block layout mode block,...
...nline-block, inline-table any static or relative 0 Inline layout mode block, inline, inline-block, block, table, inline-table, list-item, table-caption any static or relative 0, except if both margin-left and margin-right are set to auto. In this case, it is set to the value centering the element inside its parent. ...
...ock, inline-table any static or relative 0 Inline layout mode block, inline, inline-block, block, table, inline-table, list-item, table-caption any static or relative 0, except if both margin-left and margin-right are set to auto. In this case, it is set to the value centering the element inside its parent. ...
...And 5 more matches
mask - CSS: Cascading Style Sheets
Web › CSS › mask
)> | <gradient><mask-source> = <url><length-percentage> = <length> | <percentage><shape-box> = <box> | margin-boxwhere <image()> = image( <image-tags>? [ <image-src>? , <color>? ]! ...
...url><length-percentage> = <length> | <percentage><shape-box> = <box> | margin-boxwhere <image()> = image( <image-tags>? [ <image-src>? , <color>? ]! ...
...ient()><box> = border-box | padding-box | content-boxwhere <image-tags> = ltr | rtl<image-src> = <url> | <string><color> = <rgb()> | <rgba()> | <hsl()> | <hsla()> | <hex-color> | <named-color> | currentcolor | <deprecated-system-color><image-set-option> = [ <image> | <string> ] <resolution><id-selector> = <hash-token><cf-mixing-image> = <percentage>? && <image><cf-final-image> = <image> | <color><linear-gradient()> = linear-gradient( [ <angle> | to <side-or-corner> ]? , <color-stop-list> )<repeating-linear-gradient()> = repeating-linear-gradient( [ <angle> | to <side-or-corner> ]? , <color-stop-list> )<radial-gradient()> = radial-gradient( [ <ending-shape> | <size> ]? [ at <position> ]? , <color-stop-list> )<repeating-radial-gradient()> = repeating-radial-gradient( [ <ending-shape> | <size> ]?
...And 5 more matches
Getting Started - Developer guides
); alertContents() checks if the response was received and OK, then alert()s the contents of the test.html file. Note: If you're sending a request to a piece of code that will return XML, rather than a static HTML file, you must set response headers to work in Internet Explorer. If you do not set header Content-Type: application/xml, IE will throw a JavaScript "Object Expected" error after the line where you tried to access an XML element. Note 2: If you do not set header Cache-Control: no-cache the browser will cache the response and never re-submit the request, making debugging challenging. You can also add an always-different GET parameter, like a timestamp or random number (see bypassing the cache) Note 3: If the httpRequest variable is used globally, competing functions calling makeR...
...ponse to the HTTP request we used the request object's responseText property , which contained the contents of the test.html file. Now let's try the responseXML property. First off, let's create a valid XML document that we'll request later on. The document (test.xml) contains the following: <?xml version="1.0" ?> <root> I'm a test. ...
...ents of the test.html file. Now let's try the responseXML property. First off, let's create a valid XML document that we'll request later on. The document (test.xml) contains the following: <?xml version="1.0" ?> <root> I'm a test. </root> In the script we only need to change the request line to: ... onclick="makeRequest('test.xml')"> ... Then in alertContents(), we need to replace the line alert(httpRequest.responseText); with: var xmldoc = httpRequest.responseXML; var root_node = xmldoc.getElementsByTagName('root').item(0); alert(root_node.firstChild.data); This code takes the XMLDocument object given by responseXML and uses DOM methods to access some of the data contained in the XML document. You can see the test.xml here and the updated test script here. Step 5 - Working wit...
...And 5 more matches
Block-level elements - HTML: Hypertext Markup Language
HTML (Hypertext Markup Language) elements historically were categorized as either "block-level" elements or "inline-level" elements. By default, a block-level element occupies the entire space of its parent element (container), thereby creating a "block." This article helps to explain what this means. Browsers typically display the block-level element with a newline both before and after the element. You can visualize them as a stack of boxes. A block-level element always starts on a new line and takes up the full width available (stretches out to the left and right as far as it can). The following example demonstrates the block-level element's influence: Block-level elements HTML <p>This paragraph is a block-level element; its background has been colored to display the paragra...
...o the left and right as far as it can). The following example demonstrates the block-level element's influence: Block-level elements HTML <p>This paragraph is a block-level element; its background has been colored to display the paragraph's parent element.</p> CSS p { background-color: #8ABB55; } Usage Block-level elements may appear only within a <body> element. Block-level vs. inline There are a couple of key differences between block-level elements and inline elements: Content model Generally, block-level elements may contain inline elements and (sometimes) other block-level elements. Inherent in this structural distinction is the idea that block elements create "larger" structures than inline elements. Default formatting By default, block-level elements begin on new ...
... There are a couple of key differences between block-level elements and inline elements: Content model Generally, block-level elements may contain inline elements and (sometimes) other block-level elements. Inherent in this structural distinction is the idea that block elements create "larger" structures than inline elements. Default formatting By default, block-level elements begin on new lines, but inline elements can start anywhere in a line. The distinction of block-level vs. inline elements was used in HTML specifications up to 4.01. In HTML5, this binary distinction is replaced with a more complex set of content categories. ...
...And 5 more matches
Introduction - JavaScript
n object reference or access private memory by corrupting Java bytecodes. Java's class-based model means that programs consist exclusively of classes and their methods. Java's class inheritance and strong typing generally require tightly coupled object hierarchies. These requirements make Java programming more complex than JavaScript programming. In contrast, JavaScript descends in spirit from a line of smaller, dynamically typed languages such as HyperTalk and dBASE. These scripting languages offer programming tools to a much wider audience because of their easier syntax, specialized built-in functionality, and minimal requirements for object creation. JavaScript compared to Java JavaScript Java Object-oriented. No distinction between types of objects. Inheritance ...
...me). The ECMAScript document is not intended to help script programmers. Use the JavaScript documentation for information when writing scripts. The ECMAScript specification uses terminology and syntax that may be unfamiliar to a JavaScript programmer. Although the description of the language may differ in ECMAScript, the language itself remains the same. JavaScript supports all functionality outlined in the ECMAScript specification. The JavaScript documentation describes aspects of the language that are appropriate for a JavaScript programmer. Getting started with JavaScript Getting started with JavaScript is easy: all you need is a modern Web browser. This guide includes some JavaScript features which are only currently available in the latest versions of Firefox, so using the most recen...
...rted with JavaScript Getting started with JavaScript is easy: all you need is a modern Web browser. This guide includes some JavaScript features which are only currently available in the latest versions of Firefox, so using the most recent version of Firefox is recommended. The Web Console tool built into Firefox is useful for experimenting with JavaScript; you can use it into two modes: single-line input mode, and multi-line input mode. 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. To open the Web Console (Ctrl+Shift+I on Windows and Linux or Cmd-Option-K on Mac), open the Tools menu in Firefox, and select "De...
...And 5 more matches
display - SVG: Scalable Vector Graphics
Web › SVG › Attribute › display
&& [ flow | flow-root ]? && list-item<display-internal> = table-row-group | table-header-group | table-footer-g...
...&& [ flow | flow-root ]? ...
... Specifications Specification Status Comment Scalable Vector Graphics (SVG) 2The definition of 'display' in that specification. Candidate Recommendation Refers to the CSS 2 specification ...
...And 5 more matches
end - SVG: Scalable Vector Graphics
Web › SVG › Attribute › end
ype="XML" attributeName="width" to="75" begin="0s" end="6s" fill="freeze" /> </rect> <rect x="10" y="85" height="15" width="0"> <animate attributeType="XML" attributeName="width" to="50" begin="0s" end="4s" fill="freeze" /> </rect> <!-- grid --> <text x="10" y="20" text-anchor="middle">0s</text> <line x1="10" y1="25" x2="10" y2="105" stroke="grey" stroke-width=".5" /> <text x="35" y="20" text-anchor="middle">2s</text> <line x1="35" y1="25" x2="35" y2="105" stroke="grey" stroke-width=".5" /> <text x="60" y="20" text-anchor="middle">4s</text> <line x1="60" y1="25" x2="60" y2="105" stroke="grey" stroke-width=".5" /> <text x="85" y="20" text-anchor="middle">6s</text> <line ...
...line x1="35" y1="25" x2="35" y2="105" stroke="grey" stroke-width=".5" /> <text x="60" y="20" text-anchor="middle">4s</text> <line x1="60" y1="25" x2="60" y2="105" stroke="grey" stroke-width=".5" /> <text x="85" y="20" text-anchor="middle">6s</text> <line x1="85" y1="25" x2="85" y2="105" stroke="grey" stroke-width=".5" /> <text x="110" y="20" text-anchor="middle">8s</text> <line x1="110" y1="25" x2="110" y2="105" stroke="grey" stroke-width=".5" /> <line x1="10" y1="30" x2="110" y2="30" stroke="grey" stroke-width=".5" /> <line x1="10" y1="105" x2="110" y2="105" stroke="grey" stroke-width=".5" /> </svg> Event example <svg width="120" height="120" viewBox="0 0 120 120" xmlns="http://www.w3.org/2000/svg" version="1.1" xmlns:xlink="http://www.w3.org/1...
... fill="freeze" /> </rect> <!-- trigger --> <rect id="endButton" style="cursor:pointer;" x="19.5" y="62.5" rx="5" height="25" width="80" fill="#EFEFEF" stroke="black" stroke-width="1" /> <text x="60" y="80" text-anchor="middle" style="pointer-events:none;">Click me.</text> <!-- grid --> <text x="10" y="20" text-anchor="middle">0s</text> <line x1="10" y1="25" x2="10" y2="55" stroke="grey" stroke-width=".5" /> <text x="35" y="20" text-anchor="middle">2s</text> <line x1="35" y1="25" x2="35" y2="55" stroke="grey" stroke-width=".5" /> <text x="60" y="20" text-anchor="middle">4s</text> <line x1="60" y1="25" x2="60" y2="55" stroke="grey" stroke-width=".5" /> <text x="85" y="20" text-anchor="middle">6s</text> <line x1=...
...And 5 more matches
Using the WebAssembly JavaScript API - WebAssembly
sm file (can use our simple template if you haven't got one easily available). Now, to help us understand what is going on here, let's look at the text representation of our wasm module (which we also meet in Converting WebAssembly format to wasm): (module (func $i (import "imports" "imported_func") (param i32)) (func (export "exported_func") i32.const 42 call $i)) In the second line, you will see that the import has a two-level namespace -- the internal function $i is imported from imports.imported_func. We need to reflect this two-level namespace in JavaScript when writing the object to be imported into the wasm module. Create a <script></script> element in your HTML file, and add the following code to it: var importObject = { imports: { imported_func: arg => console.lo...
...try. Starting soon in Firefox, in addition to viewing WebAssembly as text, developers will be able to debug (place breakpoints, inspect the callstack, single-step, etc.) WebAssembly using the text format. See WebAssembly debugging with Firefox DevTools for a video preview. Memory In the low-level memory model of WebAssembly, memory is represented as a contiguous range of untyped bytes called Linear Memory that are read and written by load and store instructions inside the module. In this memory model, any load or store can access any byte in the entire linear memory, which is necessary to faithfully represent C/C++ concepts like pointers. Unlike a native C/C++ program, however, where the available memory range spans the entire process, the memory accessible by a particular WebAssembly I...
...sembly.Memory() constructor, which takes as arguments an initial size and (optionally) a maximum size and a shared property that states whether it is a shared memory or not. Let's start exploring this by looking at a quick example. Create another new simple HTML page (copy our simple template) and call it memory.html. Add a <script></script> element to the page. Now add the following line to the top of your script, to create a memory instance: var memory = new WebAssembly.Memory({initial:10, maximum:100}); The unit of initial and maximum is WebAssembly pages -- these are fixed to 64KB in size. This means that the above memory instance has an initial size of 640KB, and a maximum size of 6.4MB. WebAssembly memory exposes its bytes by simply providing a buffer getter/setter ...
...And 5 more matches
Chapter 3: Introduction to XUL—How to build a more intuitive UI - Archive of obsolete content
<< PreviousNext >> This document was authored by Hiroshi Shimoda of Clear Code Inc. and was originally published in Japanese for the Firefox Developers Conference Summer 2007. Shimoda-san is a co-author of Firefox 3 Hacks (O'Reilly Japan, 2008). Before you learn how to develop extensions, let's learn about XUL, the XML-based User-interface Language, which is one of the building blocks for extensions. Introduction An overview of XUL XUL is an XML-based language, and was developed to be the GUI markup language for the Mozilla browser. ...
...is.only.xul"> <!-- Contents go here. --> </window> Listing 2: General structure of a XUL document Even with the internationalization of Firefox and extensions, this kind of XML function is being used. Reading in style sheets XUL uses CSS to specify the appearance of its elements. Again, since XUL is a type of XML, stylesheets are read in using the xml-stylesheet processing instruction. On line 2 of Listing 2, we're reading in the theme's standard style sheet. By referring to a special style sheet within chrome://global/skin/, we can make label and button sizes, window background color, etc, match the currently selected theme in Firefox. We can also read in a stylesheet that we had set up ourselves. The XUL box model In principle, XUL lays out all UI components using combinations of t...
...he width and height attributes, as shown in Listing 6. If you are creating elements that can grow using the flex attribute, you can also set minimums and maximums using minwidth, minheight, maxwidth, and maxheight. These all use pixels as the unit of size. <button label="Button" width="200" height="100"/> Listing 6: Setting the size of a button Also, as shown in Listing 7, you can embed CSS inline into elements via the style attribute, which allows you to set sizes using units other than pixels. <button label="Button" style="min-width: 10em;"/> Listing 7: Setting the size of a button using CSS markup hidden and collapsed The hidden and collapsed attributes act as switches to turn off the display of elements. Setting hidden="true" disables display of that element. This has the same ef...
...And 4 more matches
Layout FAQ - Archive of obsolete content
until afterwards, but if none are pending, show the view immediately? What is the best way to determine whether there are any pending changes? On the reflow branch you could check the DIRTY and DIRTY_CHILDREN framestate flags. That won't help with pending style changes, but it'll work to detect cases when the popup or something in it needs to be reflown. ...
...determine whether there are any pending changes? On the reflow branch you could check the DIRTY and DIRTY_CHILDREN framestate flags. That won't help with pending style changes, but it'll work to detect cases when the popup or something in it needs to be reflown. ...
... pending changes? On the reflow branch you could check the DIRTY and DIRTY_CHILDREN framestate flags. That won't help with pending style changes, but it'll work to detect cases when the popup or something in it needs to be reflown. ...
...And 4 more matches
Layout System Overview - Archive of obsolete content
m. A content element is passed to the Style System and a request is made to resolve the style for that element. This causes the Style System to apply all style rules that correspond to the element and results in a resolved Style Context - the style data specific to that element. The Layout module looks at the 'display' field of the style context to determine what kind of frame to create (block, inline, table, etc.). The style context is associated with the frame via a reference because it is needed for many other computations during the formatting of the frames. Once a frame is created for a content element, it must be formatted. We refer to this as 'laying out' the frame, or as 'reflowing' the frame. Each frame implements a Reflow method to compute its position and size, among other things. F...
...impact is critical to avoid either the problem of not updating impacted elements, thus presenting an invalid presentation, or updating too much of the presentation and thus doing too much work, potentially causing performance problems. One very special case of dynamic content manipulation is the HTML Editor. Layout is used to implement both a full-blown WYSIWYG HTML editor, and a single and multi-line text entry control. 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. Consider a text entry field: the user types text into a form on the web. As the user types a new character it is inserted into the content model. This causes layou...
...ping into the document: it would be quite unusable if typing a character at the end of a document in the HTML editor caused the entire document to be reformatted - it would be too slow, at least on low-end machines. Thus the HTML editor and text controls put considerable performance requirements on the layout system's handling of dynamic content manipulation. The Fundamentals of Frames: Block and Line There are many types of frames that are designed to model various formatting requirements of different HTML and XML elements. CSS2 defines several (block, inline, list-item, marker, run-in, compact, and various table types) and the standard HTML form controls require their own special frame types to be formatted as expected. The most essential frame types are Block and Inline, and these correspon...
...And 4 more matches
Actionscript Acceptance Tests - Archive of obsolete content
m in a sub-dir with the same name as the test. You must create a testname.as.avm_args file with the USES_SWFVERSION directive. Support Files: There are a variety of support files available for non-standard actionscript tests. testname.as.asc_args This file specifies additional arguments to pass to asc when compiling the test: # ASC args for file # two modes are available: # override| all command line arguments (except builtin.py) are ignored and replaced by these # merge| merge these args in with the current args # specifiy an arg that starts with -no will disable the arg... eg: -no-optimize merge| -AS3 A dir.asc_args file can also be created with the same contents that will apply to the entire directory. testname.as.asc_args files will take precedence over the dir.asc_args file. testname.
....asc_args file. testname.as.avm_args This file specifies additional arguments to pass to the shell when running the test - the user can use the special variable $DIR to refer to the current directory. This example passes in another .abc file as an argument to the file being run: -- $DIR/file.abc Another use would be to pass a specific argument to the shell: -Dtimeout This file can have multiple lines with different arguments. When there are multiple lines, the harness will re-run the test for every line passing along the different arguments. There is one special keyword that can be used, USES_SWFVERSION. When that keyword is encountered, the test harness will run the test against all possible -swfversion versions: USES_SWFVERSION is the equivalent of: -swfversion 9 -swfversion 10 -swfvers...
...s will re-run the test for every line passing along the different arguments. There is one special keyword that can be used, USES_SWFVERSION. When that keyword is encountered, the test harness will run the test against all possible -swfversion versions: USES_SWFVERSION is the equivalent of: -swfversion 9 -swfversion 10 -swfversion 11 -swfversion 12 ... Any additional args on the USES_SWFVERSION line will be passed to each run of the vm. (See Bug 587093 for details.) Specifying multiple .abcs: If you desire to run a test with multiple .abc files (e.g: avmshell a.abc b.abc testname.abc) there is a special avm_args directive called multiabc that is specified surrounded by two pipe (|) symbols: |multiabc| $DIR/testname_support/a.abc $DIR/testname_support/b.abc The extra abc files will usually be...
...And 4 more matches
Creating a Window - Archive of obsolete content
="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <!-- Other elements go here --> </window> This window will not do anything since it doesn't contain any UI elements. Those will be added in the next section. In fact, there will not be shown any window at all. If you want to force the window to become visible you can add the width and height attribute to the window tag. Here is a line by line breakdown of the code above: <?xml version="1.0"?> This line simply declares that this is an XML file. You would normally add this line as is at the top of each xul file. <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> This line is used to specify the style sheets to use for the file. This is the syntax that XML files use to import style sheets. In this case, we im...
...the global part of a skin package. We didn't specify a specific file so Mozilla will determine which files in the directory to use. In this case, the all-important global.css file is selected. This file contains all the default declarations for all of the XUL elements. Because XML does not have any knowledge of how elements should be displayed, the file indicates how. Generally, you will put this line at the top of every XUL file. You can also import other style sheets using a similar syntax. Note that you would normally import the global style sheet from within your own style sheet file. <window This line declares that you are describing a window. Each user interface window is described in a separate file. This tag is much like the HTML tag which surrounds an entire HTML document, except t...
... id="findfile-window" The id attribute is used as an identifier so that the window can be referred to by scripts. You will usually put an id attribute on all elements. The name can be anything you want although it should be something relevant. ...
...And 4 more matches
Gecko Compatibility Handbook - Archive of obsolete content
They are actually replaced by ''-(EXAMPLE REMOVED)-'' The goal of this handbook is to help you update websites to work with standards-based browsers and properly detect Gecko. If you're new to standards, you may find Using Web Standards in Your Web Pages a helpful introduction. Gecko is an embeddable browser, developed as part of the Mozilla open source project and based on W3 Standards rather than the proprietary approaches of the past. ...
... technologies, see Using Web Standards in Your Web Pages for a quick tutorial on what's different in Gecko. AOL or CompuServe Problems Even if your site works on Netscape 7.x, it is important to test your site in AOL for macOS and CompuServe 7 to check for browser detection and network issues. Testing AOL From Within a Firewall If you need to connect to AOL via a corporate firewall, America Online has registered TCP/IP ports 5190 and 11523 so you can communicate with the AOL client software. This way you can test your site on the AOL client from behind your firewall, provided that your network administrators will open these ports. You need to be connected to the Internet to test your site on AOL; it isn't possible to access your site on a local machine via your LAN, without an Internet co...
... implementation of CSS. Internet Explorer incorrectly treats ID's and CLASS names as case insensitive while Gecko treats them correctly as case sensitive. Inconsistent case between the CSS defining the style for HTML ID's and CLASSes results in Gecko browsers not applying the styles to ID's or CLASS names that differ in case. Internet Explorer incorrectly specifies height and width of inline elements such as SPAN. Internet Explorer implements the box model (padding, margins, borders) incorrectly. Do not use Internet Explorer's invalid implementation of CSS. Use only the cross-browser, standards conformant features of CSS. Use consistent case when writing HTML ID and CLASS name attributes and CSS Styles for those IDs and CLASSes. Do not specify heights or w...
...And 4 more matches
Sunbird Theme Tutorial - Archive of obsolete content
Ensure that the internal name is a single word. Note: If your theme is for a version of Sunbird later than 0.4, then also change the maxVersion. Save the file. Registering your theme To register your theme, create ...
... > <em:targetApplication><!-- Sunbird --> <Description em:id="{718e30fb-e89b-41dd-9da7-e25a45638b28}" em:minVersion="0.2.9" em:maxVersion="0.4" /> </em:targetApplication> </Description> </RDF> In the line that starts <tt>em:id</tt>, paste your identifier between the double-quote characters, replacing the identifier that is there now. Change the next six lines to describe your theme. Ensure that the internal name is a single word. ...
...Save the file. Creating the theme itself To create the theme itself, go to Sunbird's program directory. ...
...And 4 more matches
Scratchpad - Archive of obsolete content
Scratchpad is deprecated as of Firefox 70 (bug 1565380), and will be removed as of Firefox 72 (bug 1519103). As an alternative, starting in Firefox 71, you can use the multi-line mode of the JavaScript console input. Scratchpad provides an environment for experimenting with JavaScript code. You can write, run, and examine the results of code that interacts with the web page. Unlike the Web Console, which is designed for interpreting a single line of code at a time, Scratchpad lets you edit larger chunks of JavaScript code, then execute it in various ways depending on how you want to use the output. The featured video tutorial shows a case of using Scratchpad with a page run by a local web server. It is also possible to use Scratchpad over pages opened from a local file system, if perm...
...ew in Firefox 47. From Firefox 47, you can open Scratchpad inside the Toolbox. First you need to check "Scratchpad" in the "Default Firefox Developer Tools" section of the Settings page. Now Scratchpad will be available in the Toolbox, alongside other tools like the Page Inspector and the Web Console. This is especially useful in split Console mode: you can use Scratchpad for a persistent, multiline editor, and the Console to interact with the page. Editing The Scratchpad window looks something like this (on macOS the menu bar is at the top of the screen): The File menu offers options to save and load JavaScript code snippets, so you can reuse code later if you like. Code completion Scratchpad integrates the tern code analysis engine, and uses that to provide autocomplete suggestions ...
... the current symbol. To list autocomplete suggestions, press Ctrl + Space. For example, try typing d, then pressing Ctrl + Space. 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. ? and ? cycle through the suggestions and Enter or Tab select the highlighted choice. Inline documentation To show the inline documentation popup, press Ctrl + Shift + Space when the cursor is on an identifier. For example, if you type document.addEventListener, then press Ctrl + Shift + Space, you'll see a popup that shows a summary of the function's syntax and a short description: The "[docs]" link takes you to the MDN documentation for the symbol. Executing Once you've written you...
...And 4 more matches
Building up a basic demo with the PlayCanvas engine - Game development
> element), and then start the update loop. Add the following code to the bottom of your second <script> element: var app = new pc.Application(canvas); app.start(); The pc global object contains all the PlayCanvas functions available in the engine. Next, we'll set the Canvas to fill the window, and automatically change its resolution to be the same as the Canvas size. Again, add the following lines at the bottom of your script. app.setCanvasFillMode(pc.FILLMODE_FILL_WINDOW); app.setCanvasResolution(pc.RESOLUTION_AUTO); Camera Now when the setup code is in place we need to think about implementing the standard scene components: camera, lights and objects. Let's start with the camera -- add these lines to your code, below the previous ones. var camera = new pc.Entity(); camera.addCompon...
...table for your scene -- milimeters, meters, feet, or miles -- it's up to you. Try saving the file and loading it in your browser. You should now see a gray window. Congratulations! Geometry Now the scene is properly rendering we can start adding 3D shapes to it. To speed up development PlayCanvas provides a bunch of predefined primitives that you can use to create shapes instantly in a single line of code. There are cubes, spheres, cylinders and more complicated shapes available. Drawing everything for given shape is taken care of by the engine, so we can focus on the high level coding. Let's start by defining the geometry for a cube shape -- add the following new code below your previous additions: var box = new pc.Entity(); box.addComponent("model", { type: "box" }); app.root.addChild(b...
...more than one side of the cube. It's time to add the ambient light: app.scene.ambientLight = new pc.Color(0.2, 0.2, 0.2); The code above assign a dark grey ambient light for the whole scene. The box look better now, but it could get some colors to look even better - for that we need to create material for it. Material The basic PlayCanvas material is called PhongMaterial -- add the following lines below the previous code. var boxMaterial = new pc.PhongMaterial(); boxMaterial.diffuse.set(0, 0.58, 0.86); boxMaterial.update(); box.model.model.meshInstances[0].material = boxMaterial; By diffusing the light on the object we can give it it's own color --we'll choose a nice familiar blue. Note: In PlayCanvas, the color channel values are provided as floats in the range 0-1, instead of integ...
...And 4 more matches
Fundamental CSS comprehension - Learn web development
ge file and fill your own name in, you are welcome to -- just make sure the image is square. Grab the CSS resources text file -- this contains a set of raw selectors and rulesets that you'll need to study and combine to answer part of this assessment. Alternatively, you could use a site like JSBin or Glitch to do your assessment. You could paste the HTML and fill in the CSS into one of these online editors, and use this URL to point the <img> element to the image file. If the online editor you are using doesn't have a separate CSS panel, feel free to put it in a <style> element in the head of the document. Note: If you get stuck, then ask us for help -- see the Assessment or further help section at the bottom of this page. Project brief You have been provided with some raw HTML and an ...
...The following sections describe what you need to do. Basic setup: First of all, create a new file in the same directory as your HTML and image files. Call it something really imaginative like style.css. Link your CSS to your HTML file via a <link> element. ...
...ard content (the <article> element), we need to give it a specific height. Set the <article>'s height to 120px, but expressed in ems. Also give it a background color of semi-transparent black, resulting in a slightly darker shade that lets the background red color shine through a bit too. Write a ruleset that gives the <h2> an effective font size of 20px (but expressed in ems) and an appropriate line height to place it in the center of the header's content box. Recall from earlier that the content box height should be 30px -- this gives you all the numbers you need to calculate the line height. Write a ruleset that gives the <p> inside the footer an effective font size of 15px (but expressed in ems) and an appropriate line height to place it in the center of the footer's content box. Recall ...
...And 4 more matches
Test your skills: Selectors - Learn web development
If you get stuck, then ask us for help -- see the Assessment or further help section at the bottom of this page. Selectors One Without changing the HTML, use CSS to do the following things: Make h1 headings blue. Give h2 headings a blue background and white text. ...
...ne Without changing the HTML, use CSS to do the following things: Make h1 headings blue. Give h2 headings a blue background and white text. Cause text wrapped in a span to have a font-size of 200%. Try updating the live code below to recreate the finished example: For assessment or further work purposes, download the starting point for this task to work in your own editor or in an online editor. Selectors Two Without changing the HTML, make the following changes to the look of the content in this example: Give the element with an id of special a yellow background. Give the element with a class of alert a 1px grey border. If the element with a class of alert also has a class of stop, make the background red. If the element with a class of alert also has a class of go, mak...
... alert a 1px grey border. If the element with a class of alert also has a class of stop, make the background red. If the element with a class of alert also has a class of go, make the background green. Try updating the live code below to recreate the finished example: For assessment or further work purposes, download the starting point for this task to work in your own editor or in an online editor. Selectors Three In this example, try making the following changes without adding to the HTML. Style links, making the link-state orange, visited links green, and remove the underline on hover. Make the first element inside the container font-size: 150% and the first line of that element red. Stripe every other row in the table by selecting these rows and giving them a background c...
...And 4 more matches
What text editors are available? - Learn web development
matter to me? Notice we didn't mention price. Obviously, that matters too, but a product's cost has little connection with its quality or capability. There's a big chance you'll find a suitable text editor for free. Here are some popular editors: Editor Licence Price OS Support Doc. ...
...ttle connection with its quality or capability. There's a big chance you'll find a suitable text editor for free. Here are some popular editors: Editor Licence Price OS Support Doc. ...
...nual Yes Brackets MIT/BSD Free Windows, Mac, Linux Forum, IRC GitHub Wiki Yes Coda Closed source $99 Mac Twitter, Forum, E-mail eBook Yes CodeLobster Closed source Free Windows, Mac, Linux Forum, E-mail No end user doc Yes Emacs GPL 3 Free Windows, Mac, Linux FAQ, Mailing list, News Group Online Manual Yes Espresso Closed source $75 Mac FAQ, E-mail No end user doc, but plug-in doc Yes Gedit GPL Free Windows, Mac, Linux Mailing list, IRC Online Manual Yes Kate LGPL, GPL Free Windows, Mac, Linux Mailing list, IRC Online Manual Yes Komodo Edit MPL Free Windows, Mac, Linux Forum On...
...And 4 more matches
How do I use GitHub Pages? - Learn web development
ring your code for upload You can store any code you like in a Github repository, but to use the GitHub Pages feature to full effect, your code should be structured as a typical website, e.g. with the primary entry point being an HTML file called index.html. The other thing you need to do before moving on is to initialise your code directory as a Git repository. ...
...re moving on is to initialise your code directory as a Git repository. To do this: Point the command line to your test-site directory (or whatever you called the directory containing your website). For this, use the cd command (i.e. "change directory"). ...
...ning your website). For this, use the cd command (i.e. "change directory"). Here's what you'd type if you've put your website in a directory called test-site on your desktop: cd Desktop/test-site When the command line is pointing inside your website directory, type the following command, which tells the git tool to turn the directory into a git repository: git init An aside on command line interfaces The best way to upload your code to Github is via the command line -- this is a window where you type in commands to do things like create files and run programs, rather than clicking inside a user interface. It will look something like this: Note: You could also consider using a Git graphical user interface to do the same work, if you feel uncomfortable with the command line. E...
...And 4 more matches
Advanced form styling - Learn web development
us too, with no apparent way to get it back. Styling checkboxes and radio buttons Styling a checkbox or a radio button is tricky by default. The sizes of check boxes and radio buttons are not meant to be changed with their default designs, and browsers react very differently when you try. ...
...unstyling the original check boxes: input[type="checkbox"] { -webkit-appearance: none; appearance: none; } We can use the :checked and :disabled pseudo-classes to change the appearance of our custom checkbox as its state changes: input[type="checkbox"] { position: relative; width: 1em; height: 1em; border: 1px solid gray; /* Adjusts the position of the checkboxes on the text baseline */ vertical-align: -2px; /* Set here so that Windows' High-Contrast Mode can override */ color: green; } input[type="checkbox"]::before { content: "?"; position: absolute; font-size: 1.2em; right: -1px; top: -0.3em; visibility: hidden; } input[type="checkbox"]:checked::before { /* Use `visibility` instead of `display` to avoid recalculating layout */ visibility: visible; }...
...f you want mobile browsers to show the numeric keypad). Range input types <input type="range"> is annoying to style. You can use something like the following to remove the default slider track completely and replace it with a custom style (a thin red track, in this case): input[type="range"] { appearance: none; -webkit-appearance: none; background: red; height: 2px; padding: 0; outline: 1px solid transparent; } However, it is very difficult to customize the style of the range control's drag handle -- to get full control over range styling you'll need to use a whole bunch of complex CSS code, including multiple non-standard, browser-specific pseudo-elements. Check out Styling Cross-Browser Compatible Range Inputs with CSS on CSS tricks for a detailed write up of what's needed. ...
...And 4 more matches
CSS property compatibility table for form controls - Learn web development
eel */ -webkit-appearance: none; appearance: none; /* for Internet Explorer */ background: none; } Compatibility tables Global behaviors Some behaviors are common to many browsers at a global level: border, background, border-radius, height Using one of these properties can partially or fully turn off the native look & feel of widgets on some browsers. Be careful when you use them. line-height This property is supported inconsistently across browsers and you should avoid it. text-decoration This property is not supported by Opera on form widgets. text-overflow Opera, Safari, and IE9 do not support this property on form widgets. text-shadow Opera does not support text-shadow on form widgets and IE9 does not support it at all. Text fields See the text, search, and passwo...
...ch fields. On Windows 7, Internet Explorer 9 does not apply the border unless background:none is applied. Text and font color[1] Yes Yes If the border-color property is not set, some WebKit based browsers will apply the color property to the border as well as the font on <textarea>s. font Yes Yes See the note about line-height letter-spacing Yes Yes text-align Yes Yes text-decoration Partial Partial See the note about Opera text-indent Partial[1] Partial[1] IE9 supports this property only on <textarea>s, whereas Opera only supports it on single line text fields. text-overflow Partial Partial ...
... This property is not applied on WebKit based browsers on Mac OSX or iOS. border Partial Yes margin Yes Yes padding Partial[1] Yes This property is not applied on WebKit based browsers on Mac OSX or iOS. Text and font color Yes Yes font Yes Yes See the note about line-height. letter-spacing Yes Yes text-align No No text-decoration Partial Yes text-indent Yes Yes text-overflow No No text-shadow Partial Partial text-transform Yes Yes Border and background background Yes Yes border-radius ...
...And 4 more matches
JavaScript basics - Learn web development
le. (Hello world! is the standard for introductory programming examples.) Important: If you haven't been following along with the rest of our course, download this example code and use it as a starting point. Go to your test site and create a new folder named scripts. Within the scripts folder, create a new file called main.js, and save it. In your index.html file, enter this code on a new line, just before the closing </body> tag: <script src="scripts/main.js"></script> This is doing the same job as the <link> element for CSS. It applies the JavaScript to the page, so it can have an effect on the HTML (along with the CSS, and anything else on the page). Add this code to the main.js file: const myHeading = document.querySelector('h1'); myHeading.textContent = 'Hello world!'; ...
...manipulate documents. Language basics crash course To give you a better understanding of how JavaScript works, let's explain some of the core features of the language. It's worth noting that these features are common to all programming languages. If you master these fundamentals, you have a head start on coding in other languages too! Important: In this article, try entering the example code lines into your JavaScript console to see what happens. For more details on JavaScript consoles, see Discover browser developer tools. Variables Variables are containers that store values. You start by declaring a variable with the var (less recommended, dive deeper for the explanation) or the let keyword, followed by the name you give to the variable: let myVariable; Note: A semicolon at the en...
...your JavaScript console to see what happens. For more details on JavaScript consoles, see Discover browser developer tools. Variables Variables are containers that store values. You start by declaring a variable with the var (less recommended, dive deeper for the explanation) or the let keyword, followed by the name you give to the variable: let myVariable; Note: A semicolon at the end of a line indicates where a statement ends. It is only required when you need to separate statements on a single line. However, some people believe it's good practice to have semicolons at the end of each statement. There are other rules for when you should and shouldn't use semicolons. For more details, see Your Guide to Semicolons in JavaScript. Note: You can name a variable nearly anything, but there...
...And 4 more matches
HTML text fundamentals - Learn web development
e need structure? To answer this question, let's take a look at text-start.html--the starting point of our running example for this article (a nice hummus recipe). You should save a copy of this file on your local machine, as you'll need it for the exercises later on. This document's body currently contains multiple pieces of content--they aren't marked up in any way, but they are separated with linebreaks (Enter/Return pressed to go onto the next line). However, when you open the document in your browser, you'll see that the text appears as a big chunk! This is because there are no elements to give the content structure, so the browser does not know what is a heading and what is a paragraph. Furthermore: Users looking at a web page tend to scan quickly to find relevant content, often ...
...nfluencing the page's search rankings. Without headings, your page will perform poorly in terms of SEO (Search Engine Optimization). Severely visually impaired people often don't read web pages; they listen to them instead. This is done with software called a screen reader. This software provides ways to get fast access to given text content. Among the various techniques used, they provide an outline of the document by reading out the headings, allowing their users to find the information they need quickly. If headings are not available, they will be forced to listen to the whole document read out loud. To style content with CSS, or make it do interesting things with JavaScript, you need to have elements wrapping the relevant content, so CSS/JavaScript can effectively target it. We therefo...
...Elements like this, which only affect presentation and not semantics, are known as presentational elements and should no lo...
...And 4 more matches
Fetching data from the server - Learn web development
nd is in the same directory as the HTML file, therefore just the file name will do. However, web servers tend to be case sensitive, and the file name doesn't have a space in it. To convert "Verse 1" to "verse1.txt" we need to convert the V to lower case, remove the space, and add .txt on the end. This can be done with replace(), toLowerCase(), and simple string concatenation. ...
... the following lines inside your updateDisplay() function: verse = verse.replace(" ", ""); verse = verse.toLowerCase(); let url = verse + '.txt'; To begin creating an XHR request, you need to create a new request object using the XMLHttpRequest() constructor. You can call this object anything you like, but we'll call it request to keep things simple. Add the following below your previous lines inside your updateDisplay() function: let request = new XMLHttpRequest(); Next, you need to use the open() method to specify what HTTP request method to use to request the resource from the network, and what its URL is. We'll just use the GET method here and set the URL as our url variable. ...
...st to keep things simple. Add the following below your previous lines inside your updateDisplay() function: let request = new XMLHttpRequest(); Next, you need to use the open() method to specify what HTTP request method to use to request the resource from the network, and what its URL is. We'll just use the GET method here and set the URL as our url variable. Add this below your previous line: request.open('GET', url); Next, we'll set the type of response we are expecting -- which is defined by the request's responseType property -- as text. This isn't strictly necessary here -- XHR returns text by default -- but it is a good idea to get into the habit of setting this in case you want to fetch other types of data in the future. Add this next: request.responseType = 'text';...
...And 4 more matches
Handling text — strings in JavaScript - Learn web development
ts, showing the right text labels when needed, sorting terms into the desired order, and much more. Pretty much all of the programs we've shown you so far in the course have involved some string manipulation. Strings -- the basics Strings are dealt with similarly to numbers at first glance, but when you dig deeper you'll start to see some notable differences. Let's start by entering some basic lines into the browser developer console to familiarize ourselves. Creating a string To start with, enter the following lines: let string = 'The revolution will not be televised.'; string; Just like we did with numbers, we are declaring a variable, initializing it with a string value, and then returning the value. The only difference here is that when writing a string, you need to surround the...
...If the browser can't find it, then an error is raised (e.g. "missing; before statement"). ...
...claring a variable, initializing it with a string value, and then returning the value. The only difference here is that when writing a string, you need to surround the value with quotes. If you don't do this, or miss one of the quotes, you'll get an error. Try entering the following lines: let badString = This is a test; let badString = 'This is a test; let badString = This is a test'; These lines don't work because any text without quotes around it is assumed to be a variable name, property name, a reserved word, or similar. If the browser can't find it, then an error is raised (e.g. "missing; before statement"). If the browser can see where a string starts, but can't find the end of the string, as indicated by the 2nd quote, it complains with an error (with "unterminated string literal"...
...And 4 more matches
Inheritance in JavaScript - Learn web development
in the current context. The first parameter specifies the value of this that you want to use when running the function, and the other parameters are those that should be passed to the function when it is invoked. We want the Teacher() constructor to take the same parameters as the Person() constructor it is inheriting from, so we specify them all as parameters in the call() invocation. The last line inside the constructor simply defines the new subject property that teachers are going to have, which generic people don't have. As a note, we could have simply done this: function Teacher(first, last, age, gender, interests, subject) { this.name = { first, last }; this.age = age; this.gender = gender; this.interests = interests; this.subject = subject; } But this is just r...
...te, we could have simply done this: function Teacher(first, last, age, gender, interests, subject) { this.name = { first, last }; this.age = age; this.gender = gender; this.interests = interests; this.subject = subject; } But this is just redefining the properties anew, not inheriting them from Person(), so it defeats the point of what we are trying to do. It also takes more lines of code. Inheriting from a constructor with no parameters Note that if the constructor you are inheriting from doesn't take its property values from parameters, you don't need to specify them as additional arguments in call(). So, for example, if you had something really simple like this: function Brick() { this.width = 10; this.height = 20; } You could inherit the width and height prope...
...acher.prototype) into either the text input field or your JavaScript console. Then enter it again, replacing Teacher with Person. Nor does the new constructor inherit those methods. To see this, compare the outputs of Person.prototype.greeting and Teacher.prototype.greeting. We need to get Teacher() to inherit the methods defined on Person()'s prototype. So how do we do that? Add the following line below your previous addition: Teacher.prototype = Object.create(Person.prototype); Here our friend create() comes to the rescue again. In this case we are using it to create a new object and make it the value of Teacher.prototype. The new object has Person.prototype as its prototype and will therefore inherit, if and when needed, all the methods available on Person.prototype. We need to do o...
...And 4 more matches
Aprender y obtener ayuda - Learn web development
le is a learning site where the tutorials mainly consist of interactive code editors where you have to directly write code and see if the desired result was achieved. Many MDN Web docs reference pages provide interactive examples too, where you can alter the code and see how the live result changes. And there is also nothing wrong with creating your own code examples on your computer, or in an online code editor like JSBin, Codepen, or Glitch. In fact, you'll be called to do so as part of this course when you are learning! Note: Online code editors are also really useful for sharing code you've written, for example, if you are collaborating on learning with someone else who isn't in the same location, or are sending it someone to ask for help with it. You can share the web address of the ex...
...good idea to research what you'll need to achieve the goal. For example: Materials I need: A computer Internet access Pens and paper Knowledge I need: How to use HTML, CSS, JavaScript, and associated tools and best practices to build web sites and web applications (we can definitely help you with this one!). How to get a domain, hosting, and use them to put a web site or application online. How to run a small business. How to advertise my business and attract clients. How much time and money will it take? Estimate the time and cost of getting these things. If you'll need to work to earn money to buy the materials required, then the time to do that will have to be factored in. Once you have a time estimate, you can start to build a plan around your life. How many hours per wee...
... out basic site typography Work out a basic color scheme Implement a high-level layout -- header, horizontal navigation menu, main content area with main and side columns, and footer. Implement a horizontal navigation menu etc. Then you could break it down further, for example, "Implement horizontal navigation menu" could be written out as: Make a list of menu items sit horizontally in a line. Remove unneeded defaults, like list spacing and bullet points. Style hover/focus/active states of menu items appropriately. Make the menu items equally spaced along the line. Give the menu items enough vertical spacing. Make sure the text is centered inside each menu item etc. Each of these problems doesn't seem nearly as difficult to solve as the one big problem you had initially. Now y...
...And 4 more matches
Getting started with Ember - Learn web development
orks Next In our first Ember article we will look at how Ember works and what it's useful for, install the Ember toolchain locally, create a sample app, and then do some initial setup to get it ready for development. Prerequisites: At minimum, it is recommended that you are familiar with the core HTML, CSS, and JavaScript languages, and have knowledge of the terminal/command line. A deeper understanding of modern JavaScript features (such as classes, modules, etc), will be extremely beneficial, as Ember makes heavy use of them. Objective: To learn how to install Ember, and create a starter app. Introducing Ember Ember is a component-service framework that focuses on the overall web application development experience, minimizing the trivial dif...
...odoMVC is a basic to-do tracking app implemented in many different technologies. Here is the completed Ember version, for reference. A note on TodoMVC and accessibility The TodoMVC project has a few issues in terms of adhering to accessible/default web practices. There are a couple of GitHub issues open about this on the TodoMVC family of projects: Add keyboard access to demos Re-enable Outline on focusable elements Ember has a strong commitment to being accessible by default and there is an entire section of the Ember Guides on accessibility on what it means for website / app design. That said, because this tutorial is a focus on the JavaScript side of making a small web application, TodoMVC's value comes from providing pre-made CSS and recommended HTML structure, which eliminates s...
...us on the JavaScript side of making a small web application, TodoMVC's value comes from providing pre-made CSS and recommended HTML structure, which eliminates small differences between implementations, allowing for easier comparison. Later on in the tutorial, we'll focus on adding code to our application to fix some of TodoMVC's biggest faults. Installing the Ember tooling Ember uses a command-line interface (CLI) tool for building and scaffolding parts of your application. You'll need node and npm installed before you can install ember-cli. Go here to find out how to install node and npm, if you haven't already got them. Now type the following into your terminal to install ember-cli: npm install -g ember-cli This tool provides the ember program in your terminal, which is ...
...And 4 more matches
Client-side tooling overview - Learn web development
ased every day to solve specific problems. You might even find yourself writing a piece of software to aid your own development process, to solve a specific problem that existing tools don't already seem to handle. It is easy to become overwhelmed by the sheer number of tools that can be included in a single project. Equally, a single configuration file for a tool like Webpack can be hundreds of lines long, most of which are magical incantations that seem to do the job but which only a master engineer will fully understand! From time to time, even the most experienced of web developers get stuck on a tooling problem; it is possible to waste hours attempting to get a tooling pipeline working before even touching a single line of application code. If you have found yourself struggling in the p...
.... Safety net tooling should also help you either prevent mistakes or correct mistakes automatically without having to build your code from scratch each time. A few very common safety net tool types you will find being used by developers are as follows. Linters Linters are tools that check through your code and tell you about any errors that are present, what error types they are, and what code lines they are present on. Often linters can be configured to not only report errors, but also report any violations of a specified style guide that you team might be using (for example code that is using the wrong number of spaces for indentation, or using template literals rather than regular string literals). eslint is the industry standard JavaScript linter -- a highly configurable tool for catch...
...eir eslint configs. You can also find linting tools for other languages, such as csslint. Also well-worth looking at is webhint, a configurable, open-source linter for the web that surfaces best practices including approaches to accessibility, performance, cross-browser compatibility via MDN's browser compatibility data, security, testing for PWAs, and more. It is available as a Node.js command-line tool and a VS Code extension. Source code control Also known as version control systems (VCS), source code control is essential for backing work up and working in teams. A typical VCS involves having a local version of the code that you make changes to. You then "push" changes to a "master" version of the code inside a remote repository stored on a server somewhere. There is usually a way of co...
...And 4 more matches
Package management basics - Learn web development
waste time reinventing the wheel? Moreover, a reliable third-party dependency will likely have been tested in a lot of different situations, making it more robust and cross-browser compatible than your own solution. A project dependency can be an entire JavaScript library or framework -- such as React or Vue -- or a very small utility like our human-readable date library, or it can be a command line tool such as Prettier or eslint, which we talked about in previous articles. Without modern build tools, dependencies like this might be included in your project using a simple <script> element, but this might not work right out of the box and you will likely need some modern tooling to bundle your code and dependencies together when they are released on the web. A bundle is the term that's gene...
...ry service, and there will be likely more options appearing as time goes on. What is important is that you ensure you've chosen the best registry for you. Many projects will use npm, and we'll stick to this in our examples throughout the rest of the module. Using the package ecosystem Let's run through an example to get you started with using a package manager and registry to install a command line utility. Parcel is a(nother) tool that developers commonly use in their development process. Parcel is clever in that it can watch the contents of our code for calls to dependencies and automatically installs any dependencies it sees that our code needs. It can also automatically build our code. In our previous chapter we installed Prettier as a global tool. Here however, let's use npm to insta...
... the parcel command in, you'll find a number of new files; the most interesting of which are: node_modules: The dependency files of Parcel and date-fns. dist: The distribution directory -- these are the automatically packaged, minified files Parcel has built for us, and the files it is serving at localhost:1234. These are the files you would upload to your web server when releasing the site online for public consumption. So long as we know the package name, we can use it in our code and Parcel will go off, fetch, and install (actually "copy") the package into our local directory (under node_modules). Building our code for production However, this code is not ready for production. Most build tooling systems will have a "development mode" and a "production mode". The important difference...
...And 4 more matches
Gecko info for Windows accessibility vendors
SAA events do we support? EVENT_FOCUS is fired for focus changes on any kind of focusable object EVENT_STATECHANGE is used in check boxes, radio buttons, text fields, combo boxes and list boxes. It's also used in the root pane object to show when the STATE_BUSY flag changes from loading new content. EVENT_SCROLLINGEND is used to indicate when a document has scrolled, even if only 1 line. Gecko fires this event when the scrolling is finished, rather than fire excessive events. EVENT_SCROLLINGSTART is fired when the user has jumped to a named anchor within the page. The event is fired on the first accessible object in the part of the document that has been jumped to. EVENT_MENUPOPUPSTART and EVENT_MENUPOPUPEND are fired when XUL menus are opened or closed. EVENT_MENUST...
...sed to expose the list structure. This makes it important to check the STATE_READONLY flag when encountering a ROLE_LIST, because the HTML list form element also uses ROLE_LIST, but without STATE_READONLY set. Positional Descriptions are Supported The accDescription field is overriden for the following roles: ROLE_LISTITEM, ROLE_MENUITEM, ROLE_RADIOBUTTON, ROLE_PAGETAB and ROLE_OUTLINEITEM For everything other than outline item, the positional description is in the form "n of m" where n is an integer indicating the position within other similar objects in a group, and m represents the number of objects in that group. For example, "3 of 5" indicates the 3rd object out of 5. For outline item, more information is provided, in a format that reads "L#, n of m with c" where #...
... Finally, true descriptions are now exposed with the text "Description: " prepending the description. This makes it clear that the description is truly intended to be read. ...
...And 4 more matches
Links and Resources
Here are some useful links for those interested in web accessibility as well as open source accessibility. Guidelines & Standards Information and resources on Section 508 - legal policy for US government purchases requiring software accessibility. WAI - Web Accessibility Initiative Web Content Accessibility Guidelines (WCAG) 1.0 The first set of official guidelines from the W3C Web Accessibility Initiative (WAI). The European Union is looking to base their upcoming accessibility regulations on these guidelines. WAI interest group - Discussion list for standards in web accessibility. Web Accessibility Checklist from IBM. IBM's Java accessibility checklist - guidelines to making Java accessibility. Accessibility Information Resource Center For Developers at Adobe - Flash M...
...g accessibility regulations on these guidelines. WAI interest group - Discussion list for standards in web accessibility. Web Accessibility Checklist from IBM. IBM's Java accessibility checklist - guidelines to making Java accessibility. Accessibility Information Resource Center For Developers at Adobe - Flash MX accessibility, PDF document accessibility and ActionScript accessibility. Online Accessibility validators There are now a few available and excellent online accessibility validators which check single webpages according to checkpoints of WCAG guidelines and then reports errors or warnings. ...
...s at Adobe - Flash MX accessibility, PDF document accessibility and ActionScript accessibility. Online Accessibility validators There are now a few available and excellent online accessibility validators which check single webpages according to checkpoints of WCAG guidelines and then reports errors or warnings. WebXACT(TM) from Watchfire(R) Corporation WebXACT(TM) is a free and complete online accessibility validation service that can test single pages for quality, accessibility and privacy issues. The accessibility report will contain errors and warnings for "Automatic Checkpoints" and "Manual Checkpoints"; detailed and useful information (line numbers, instances/occurences, textual references to guidelines) will be included for web authors. Cynthia says(TM) from HiSoftware(R) Co...
...And 4 more matches
Debugging Frame Reflow
number. When the frame's reflow is finished the following information is displayed : reflow metric (desired) width, height max. element width maximum width frame status overflow area Getting the log Make sure that your build is a debug build (in short you need ac_add_options --enable-debug in your .mozconfig file). Create a text file (for instance reflow_rules.txt). Enter this line in the text file * 1 This should look like: point the GECKO_DISPLAY_REFLOW_RULES_FILE environment variable to the path of the reflow_rules.txt file. Run the debug build, saving stdout to a file. On Mac this is accomplished with: $ env DYLD_LIBRARY_PATH="`pwd`/obj-ff-dbg/dist/NightlyDebug.app/Contents/MacOS" \ ./obj-ff-dbg/dist/NightlyDebug.app/Contents/MacOS...
...D8 r=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). This viewport has the address 00B97C30. It is the initial reflow: r=0. Other reflow reasons are: incremental reflow resize reflow style change reflow dirty reflow The available width is 9180 twips. The available height is 4470 twips (a=9180,4470). The computed width is 9180 twips. The computed height is 4470 twips (c=9180,4470). The line count is 8...
...ort (VP). This viewport has the address 00B97C30. It is the initial reflow: r=0. Other reflow reasons are: incremental reflow resize reflow style change reflow dirty reflow The available width is 9180 twips. The available height is 4470 twips (a=9180,4470). The computed width is 9180 twips. The computed height is 4470 twips (c=9180,4470). The line count is 856 (cnt=856). Below this is a line that reads: tblO 02D7B5F0 r=0 a=8940,UC c=0,0 cnt=870 Here the UC shows that on initial reflow the available height for the outer table frame is unconstrained. The table cell requires its children to compute the MES. It is reported back from the block as: block 02D7BCF8 d=300,300 me=300 The block max. element size is 300 twips. The second table reflow is started at rowG 00B984A4 r=2 a=1500,UC c=1...
...And 4 more matches
Debugging JavaScript
in the browser, including from Firefox code. To enable it, go to about:config in the url bar and set devtools.chrome.enabled to true, or set the "Enable chrome and add-on debugging" option in the developer tool settings. Activate it through with the menu Tools > Web Developer > Browser Console. You can also start the Browser Console when you launch Firefox, by launching Firefox from the command line and passing --jsconsole as a flag: /path/to/firefox --jsconsole Log to the Browser Console using the standard console API after importing Console.jsm: let console = (Cu.import("resource://gre/modules/Console.jsm", {})).console; console.log("Hello from Firefox code"); Error Console This is obsolete and is no longer enabled in Firefox by default. Use the Web Console or the Browser Console inst...
...hecking If you set the pref javascript.options.strict to true, the JavaScript engine gives you more types of warnings on the Error Console, most of which hint at code bugs that are easy to oversee or even bad syntax. (The pref also warns on common JavaScript idioms that are not errors). Console.log in Browser Console You can dump variables in the Browser Console from addon code, by adding this line to import the console utility: const { console } = Components.utils.import("resource://gre/modules/devtools/Console.jsm", {}); This has an advantage over dump in that you can list out properties of an object logged with console.log. dump() The dump() function allows you to print text on the native console. Use \n to output a newline at the end. To see anything, you need to set the pref brows...
...sole : firefox.exe -console Using normal JavaScript object inspection, you can write a function that dumps a whole object, similar to this ddumpObject(). Log.jsm (formerly log4moz) This is a partial implementation of the Log4* interfaces (for example, see log4j or log4net). ...
...And 4 more matches
Simple Thunderbird build
nd earlier): hg clone https://hg.mozilla.org/mozilla-central source/ cd source/ hg clone https://hg.mozilla.org/comm-central comm/ The source code requires 3.6GB of free space or more and additionally 5GB or more for default build. Build configuration To build Thunderbird, you need to add a file named mozconfig to the root directory of the mozilla-central checkout that contains the following line: ac_add_options --enable-application=comm/mail You can create a file with this line by doing this in the source/ directory: echo 'ac_add_options --enable-application=comm/mail' > mozconfig If you omit this line, the build system will build Firefox instead. Other build configuration options can be added to this file, although it's strongly recommended that you only use options that you fully ...
... For more on configuration options, see the page Configuring build options. Note that if you use an MOZ_OBJDIR it cannot be a sibling folder to your source directory. ...
... For more on configuration options, see the page Configuring build options. Note that if you use an MOZ_OBJDIR it cannot be a sibling folder to your source directory. Use an absolute path to be sure! To also build Lightning when building Thunderbird (DEPRECATED) NOTE: The Lightning calendar add-on was integrated into Thunderbird starting with version 74. ...
...And 4 more matches
Eclipse CDT Manual Setup
projects like Mozilla that have their own build system. Eclipse provides a tool that can collect the options that are passed to the compiler for each file that's compiled during an actual build. This process is sometimes called "build option discovery" or "compiler option discovery". The way that Eclipse CDT does build option discovery is to scan the console output from a real build looking for lines where a compiler was invoked. For each line that invoked a compiler, it tries to figure out which source file was being built and what its include paths were. If relative paths are used to specify the source file or any of its include paths (common in Mozilla), and if you fail to take steps to make sure the build output specifies which directory the compiler is invoked from, this will not be pos...
...iscovery imposes on us. First, Eclipse needs build console output for a complete build, so that it can find compiler options for as many source files as possible. The build must be explicitly instructed to output information that allows the directory, where the compiler is being invoked from to be identified (i.e., 'make' must be instructed to output "Entering directory..."/"Leaving directory..." lines). Finally, the build must not be parallelized, since that would result in the interleaving of build output from different directories (breaking resolution of relative paths by interleaving the "Entering directory..."/"Leaving directory..." lines), and the build must not be silenced/quietened. Conversely, note this very carefully: if you configure Eclipse to invoke a build process that is parall...
...ntly degrade the quality of the code assistance that Eclipse will provide after it next re-indexes the code. These requirements aren't a very good fit with the typical Mozilla developer's wish to minimize build times, implying parallelized, silenced builds. The consequences of the above observations are this: It is strongly recommended that you invoke your normal (re)builds from the command line, externally of Eclipse. Below we will configure Eclipse's build step so that you use it only occasionally to manually trigger a special "build" (actually a fast script that fakes a build) purely for the purposes of setting/updating the compiler options that Eclipse associates with each source file. (Not using Eclipse to invoke your real builds does lose you some minor benefits that Eclipse ha...
...And 4 more matches
mach
Requirements Mach requires a current version of /mozilla-central/ (or a tree derived from there). Mach was committed on 2012-SEP-26. Mach also requires Python 2.7. Mach itself is Python 3 compliant, but modules used by mach likely are not Python 3 compliant - so stick to Python 2.7. Running From the root of the source tree checkout, you should just be able to type: $ ./mach If all is well, you should see a help message. Of course, in a random dir you just get a cryptic error message to improve the experience. ...
...h build simply invokes client.mk as an ersatz Makefile. There are no differences in terms of how the build is performed (well, at least there should not be any ideally). However - mach does offer some additional features over manual invocation of client.mk: If on Windows, mach will automatically use pymake instead of GNU make, as that is preferred on Windows. mach will print timings with each line of output from the build. This gives you an idea of how long things take. mach will colorize terminal output (on terminals that support it - typically most terminals except on Windows) mach will scan build output for compiler warnings and will automatically record them to a database which can be queried with mach warnings-list and mach warnings-summary. Not all warnings are currently detected. ...
...f make targets that aren't part of building (read: compiling) the tree. This includes things related to testing and packaging. These weigh down make files and add to the burden of maintaining the build system. Instead, you are encouraged to implement ancillary functionality in not make (preferably Python). If you do implement something in Python, hooking it up to mach is often trivial (just a few lines of proxy code). How does mach fit into the modules system? Mozilla operates with a modules governance system where there are different components with different owners. There is not currently a mach module. There may or may never be one. Mach is just a generic tool. The mach core is the only thing that could fall under perview of a module and an owner. Even if a mach module were established,...
...And 4 more matches
MathML Accessibility in Mozilla
y end rounded box __________ Not supported. See WebKit's bug 146543. x plus y Enclosed by: a rounded box x + y rounded box enclosed x+y __________ begin circle x plus y end circle __________ Not supported. See WebKit's bug 146543. ...
...__ Not supported. See WebKit's bug 146543. x plus y Enclosed by: a rounded box x + y rounded box enclosed x+y __________ begin circle x plus y end circle __________ Not supported. See WebKit's bug 146543. x plus y Enclosed by: a circle x + y circle enclosed x+y __________ line left of x plus y end line __________ Not supported. ...
...nded box enclosed x+y __________ begin circle x plus y end circle __________ Not supported. See WebKit's bug 146543. x plus y Enclosed by: a circle x + y circle enclosed x+y __________ line left of x plus y end line __________ Not supported. See WebKit's bug 146543. x plus y Enclosed by: a line on the left x + y left enclosed x+y __________ line right of x plus y end line __________ Not supported. See WebKit's bug 146543. x plus y Enclosed by: a line on the right x + y right enclosed x+y __________ line above x plus y end line __________ Not supported. See WebKit's bug 146543. ...
...And 4 more matches
Gecko Profiler FAQ
ists a number of questions asked by people in preparation for a tutorial session about the Gecko Profiler. mstange and ehsan tried to respond to some of the questions in advance in writing, and you can find the answers below. Is it possible to locate hot spots occurring within a single function? The Gecko Profiler currently doesn't have the ability to show you information about line numbers, neither for JS code nor for native code. For JS code, the profiler platform doesn't capture any information about lines. It only knows what function was executed and what line this function starts at. For native code, the profiler captures the necessary information but doesn't have a way to display it. Similarly it also can't show you instruction level...
... Therefore the Gecko Profiler is not a suitable tool for finding hotspots within a single function. ...
...e it displays is a native function. Therefore the Gecko Profiler is not a suitable tool for finding hotspots within a single function. For this purpose you should try to use a native profiler on your platform of choice (for example xperf/vtune on Windows, Instruments on OSX, and perf/Zoom on Linux.) One workaround is to break the hot function into several explicitly-non-inline helpers, recompile, and re-profile. This can change some performance characteristics, but is a decent way to get a sense of which parts of a large function are expensive. How to profile startup code that regresses just a little (<10-15ms ts_paint/tpaint) [mstange] We currently don't have a good way to do that. You can write your own tools to assist you in this process, th...
...And 4 more matches
TimerFirings logging
It's best to redirect this output to a file. ...
...n. Note: The power profiling overview is worth reading at this point if you haven't already. It may make parts of this document easier to understand. Invocation TimerFirings logging uses Gecko's own logging mechanism, and so is able to be used in any build. Set the following environment variable to enable it. NSPR_LOG_MODULES=TimerFirings:4 Output Once enabled, TimerFirings will print one line of logging output per timer fired. It's best to redirect this output to a file. The following sample shows the basics of this output. -991946880[7f46c365ba00]: [6775] fn timer (SLACK 100 ms): LayerActivityTracker -991946880[7f46c365ba00]: [6775] fn timer (ONE_SHOT 250 ms): PresShell::sPaintSuppressionCallback -991946880[7f46c365ba00]: [6775] fn timer (ONE_SHOT 160 ms): nsBrows...
... The first two values identify the thread. This is not especially useful. The next value is the process ID (pid). This is useful in a multi-process scenario. Next is the timer kind, one of fn (function), iface (interface) or obs (observer), which are the three kinds of timers that Gecko supports. Then comes the function kind, one of ONE_SHOT (a single-use timer...
...And 4 more matches
gtstd.html
Upgraded documentation may be found in the Current NSS Reference Getting Started With SSL Chapter 2 Getting Started With SSL This chapter describes how to set up your environment, including certificate and key databases. ...
.... You can use Communicator to set up client certificate databases by obtaining certificates from either a public CA or from a certificate server such as Netscape Certificate Management System. The instructions that follow assume you are using the Certificate Database Tool to set up both the server and client databases for testing purposes. You can use the Security Module Database Tool, a command-line utility that comes with NSS, to manage PKCS #11 module information within secmod.db files. The Security Module Database Tool allows you to add and delete PKCS #11 modules, change passwords, set defaults, list module contents, enable or disable slots, enable or disable FIPS-140-1 compliance, and assign default providers for cryptographic operations. Setting Up the Certificate and Key Databases...
...late them with valid CA, client SSL, and server SSL certificates. ...
...And 4 more matches
Starting WebLock
cko application to browse any website regardless of the white list. AddSite - Add the current URL to the white list. RemoveSite - Remove the current URL from the white list. EnumerateSites - Allows the enumeration of all sites in the white list. EnumerateSites might be used in the user interface to provide something like an editable listbox of all sites in the white list. Even this simple outline presents some ambiguity, however. It's certainly not enough to spell out the interface for the WebLock component in this way. For example, AddSite is supposed to add the current URL to the white list, but is the URL an input parameter to the method, is it the topmost web page in the Gecko application, or is it something more random-a URL picked from global history or that's been given context in ...
... is closely based. The XPIDL for iWebLock appears below: iWebLock #include "nsISupports.idl" interface nsISimpleEnumerator; [scriptable, uuid(ea54eee4-9548-4b63-b94d-c519ffc91d09)] interface iWeblock : nsISupports { void lock(); void unlock(); // assume strings are UTF-8 void addSite(in string url); void removeSite(in string url); attribute nsISimpleEnumerator sites; }; The first line includes the file nsISupports.idl, which defines the nsISupports interface from which all XPCOM interfaces must derive, and makes it possible for the iWebLock interface to subclass that base interface. #include "nsISupports.idl" The next line of the XPIDL is a forward declaration of the interface nsISimpleEnumerator. Again, this is similar to the forward declare in C++ (except that C++ does no...
...Recall that every interface has a unique number that is assigned to it. In the case of interfaces, the identifier is an IID. ...
...And 4 more matches
nsIDOMEvent
ISupports Last changed in Gecko 16.0 (Firefox 16.0 / Thunderbird 16.0 / SeaMonkey 2.13) Note: As of Gecko 16.0, the nsIPrivateDOMEvent interface was merged into this interface. Everything marked as Gecko 16.0 was previously available in that interface. See bug 761613. ...
...erface was merged into this interface. Everything marked as Gecko 16.0 was previously available in that interface. See bug 761613. ...
...erface guidelines void duplicatePrivateData(); Native code only! nsEventPtr GetInternalNSEvent(); Violates the XPCOM interface guidelines boolean getPreventDefault(); Deprecated since Gecko 16.0 void initEvent(in DOMString eventTypeArg, in boolean canBubbleArg, in boolean cancelableArg); boolean IsDispatchStopped(); Violates the XPCOM interface guidelines void preventBubble(); Obsolete since Gecko 24 void preventCapture(); Obsolete since Gecko 24 void preventDefault(); void Serialize(in IPCMessagePtr aMsg, in boolean aSerializeInterfaceType); Violates the XPCOM interface guidelines void setTarget(in nsIDOMEventTarget aTarget); Native code only! void SetTrusted(in boolean aTrusted); Native c...
...And 4 more matches
AnalyserNode - Web APIs
output. The node works even if the output is not connected. ...
...nnected) Channel count mode "max" Channel count 2 Channel interpretation "speakers" Inheritance This interface inherits from the following parent interfaces: <div id="interfaceDiagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 11.666666666666666%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 70" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="m...
...; left: 0;" viewbox="-50 0 600 70" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/AudioNode" target="_top"><rect x="151" y="1" width="90" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="196" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middl...
...And 4 more matches
CDATASection - Web APIs
]> For example: <foo>Here is a CDATA section: <![CDATA[ < > & ]]> with all kinds of unescaped text.</foo> The only sequence which is not allowed within a CDATA section is the closing sequence of a CDATA section itself, ]]>: <![CDATA[ ]]> will cause an error ]]> Note that CDATA sections should not be used within HTML; they only work in XML. ...
...ch is not allowed within a CDATA section is the closing sequence of a CDATA section itself, ]]>: <![CDATA[ ]]> will cause an error ]]> Note that CDATA sections should not be used within HTML; they only work in XML. ...
...inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monosp...
...And 4 more matches
Document - Web APIs
Web › API › Document
ocument interface represents any web page loaded in the browser and serves as an entry point into the web page's content, which is the DOM tree. The DOM tree includes elements such as <body> and <table>, among many others. It provides functionality globally to the document, like how to obtain the page's URL and create new elements in the document. ...
... DOM tree includes elements such as <body> and <table>, among many others. It provides functionality globally to the document, like how to obtain the page's URL and create new elements in the document. ...
... inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 70" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monosp...
...And 4 more matches
HTMLAnchorElement - Web APIs
ment interface represents hyperlink elements and provides special properties and methods (beyond those of the regular HTMLElement object interface that they inherit from) for manipulating the layout and presentation of such elements. ...
...ject interface that they inherit from) for manipulating the layout and presentation of such elements. ...
...inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monosp...
...And 4 more matches
HTMLAreaElement - Web APIs
The HTMLAreaElement interface provides special properties and methods (beyond those of the regular object HTMLElement interface it also has available to it by inheritance) for manipulating the layout and presentation of <area> elements. ...
... interface provides special properties and methods (beyond those of the regular object HTMLElement interface it also has available to it by inheritance) for manipulating the layout and presentation of <area> elements. ...
...inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monosp...
...And 4 more matches
HTMLBaseElement - Web APIs
The HTMLBaseElement interface contains the base URI for a document. This object inherits all of the properties and methods as described in the HTMLElement interface. ...
... The HTMLBaseElement interface contains the base URI for a document. This object inherits all of the properties and methods as described in the HTMLElement interface. ...
...inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monosp...
...And 4 more matches
HTMLButtonElement - Web APIs
The HTMLButtonElement interface provides properties and methods (beyond the regular HTMLElement interface it also has available to it by inheritance) for manipulating <button> elements. ...
... The HTMLButtonElement interface provides properties and methods (beyond the regular HTMLElement interface it also has available to it by inheritance) for manipulating <button> elements. ...
...inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monosp...
...And 4 more matches
HTMLCanvasElement - Web APIs
The HTMLCanvasElement interface provides properties and methods for manipulating the layout and presentation of <canvas> elements. The HTMLCanvasElement interface also inherits the properties and methods of the HTMLElement interface. ...
...ement interface provides properties and methods for manipulating the layout and presentation of <canvas> elements. The HTMLCanvasElement interface also inherits the properties and methods of the HTMLElement interface. ...
...inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monosp...
...And 4 more matches
HTMLDListElement - Web APIs
The HTMLDListElement interface provides special properties (beyond those of the regular HTMLElement interface it also has available to it by inheritance) for manipulating definition list (<dl>) elements. ...
... The HTMLDListElement interface provides special properties (beyond those of the regular HTMLElement interface it also has available to it by inheritance) for manipulating definition list (<dl>) elements. ...
...inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monosp...
...And 4 more matches
HTMLDataElement - Web APIs
The HTMLDataElement interface provides special properties (beyond the regular HTMLElement interface it also has available to it by inheritance) for manipulating <data> elements. ...
... The HTMLDataElement interface provides special properties (beyond the regular HTMLElement interface it also has available to it by inheritance) for manipulating <data> elements. ...
...inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monosp...
...And 4 more matches
HTMLDataListElement - Web APIs
The HTMLDataListElement interface provides special properties (beyond the HTMLElement object interface it also has available to it by inheritance) to manipulate <datalist> elements and their content. ...
... The HTMLDataListElement interface provides special properties (beyond the HTMLElement object interface it also has available to it by inheritance) to manipulate <datalist> elements and their content. ...
...inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monosp...
...And 4 more matches
HTMLDivElement - Web APIs
The HTMLDivElement interface provides special properties (beyond the regular HTMLElement interface it also has available to it by inheritance) for manipulating <div> elements. ...
... The HTMLDivElement interface provides special properties (beyond the regular HTMLElement interface it also has available to it by inheritance) for manipulating <div> elements. ...
...inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monosp...
...And 4 more matches
HTMLElement - Web APIs
The HTMLElement interface represents any HTML element. Some elements directly implement this interface, while others implement it via an interface that inherits it. ...
... The HTMLElement interface represents any HTML element. Some elements directly implement this interface, while others implement it via an interface that inherits it. ...
... inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 70" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monosp...
...And 4 more matches
HTMLEmbedElement - Web APIs
The HTMLEmbedElement interface provides special properties (beyond the regular HTMLElement interface it also has available to it by inheritance) for manipulating <embed> elements. This topic describes the HTMLEmbedElement interface as defined in the standard. It does not address earlier, non-standardized version of the interface. ...
...lable to it by inheritance) for manipulating <embed> elements. This topic describes the HTMLEmbedElement interface as defined in the standard. It does not address earlier, non-standardized version of the interface. ...
...inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monosp...
...And 4 more matches
HTMLFieldSetElement - Web APIs
The HTMLFieldSetElement interface provides special properties and methods (beyond the regular HTMLElement interface it also has available to it by inheritance) for manipulating the layout and presentation of <fieldset> elements. ...
...ldSetElement interface provides special properties and methods (beyond the regular HTMLElement interface it also has available to it by inheritance) for manipulating the layout and presentation of <fieldset> elements. ...
...inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monosp...
...And 4 more matches
HTMLFormElement - Web APIs
The HTMLFormElement interface represents a <form> element in the DOM. It allows access to--and, in some cases, modification of--aspects of the form, as well as access to its component elements. ...
... The HTMLFormElement interface represents a <form> element in the DOM. It allows access to--and, in some cases, modification of--aspects of the form, as well as access to its component elements. ...
...inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monosp...
...And 4 more matches
HTMLHRElement - Web APIs
The HTMLHRElement interface provides special properties (beyond those of the HTMLElement interface it also has available to it by inheritance) for manipulating <hr> elements. ...
... The HTMLHRElement interface provides special properties (beyond those of the HTMLElement interface it also has available to it by inheritance) for manipulating <hr> elements. ...
...inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monosp...
...And 4 more matches
HTMLHeadElement - Web APIs
The HTMLHeadElement interface contains the descriptive information, or metadata, for a document. This object inherits all of the properties and methods described in the HTMLElement interface. ...
... The HTMLHeadElement interface contains the descriptive information, or metadata, for a document. This object inherits all of the properties and methods described in the HTMLElement interface. ...
...inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monosp...
...And 4 more matches
HTMLHeadingElement - Web APIs
The HTMLHeadingElement interface represents the different heading elements, <h1> through <h6>. It inherits methods and properties from the HTMLElement interface. ...
... The HTMLHeadingElement interface represents the different heading elements, <h1> through <h6>. It inherits methods and properties from the HTMLElement interface. ...
...inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monosp...
...And 4 more matches
HTMLHtmlElement - Web APIs
The HTMLHtmlElement interface serves as the root node for a given HTML document. This object inherits the properties and methods described in the HTMLElement interface. You can retrieve the HTMLHtmlElement object for a given document by reading the value of the document.documentElement property. ...
... This object inherits the properties and methods described in the HTMLElement interface. You can retrieve the HTMLHtmlElement object for a given document by reading the value of the document.documentElement property. ...
...inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monosp...
...And 4 more matches
HTMLImageElement - Web APIs
The HTMLImageElement interface represents an HTML <img> element, providing the properties and methods used to manipulate image elements. ...
... The HTMLImageElement interface represents an HTML <img> element, providing the properties and methods used to manipulate image elements. ...
...inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monosp...
...And 4 more matches
HTMLLIElement - Web APIs
The HTMLLIElement interface exposes specific properties and methods (beyond those defined by regular HTMLElement interface it also has available to it by inheritance) for manipulating list elements. ...
... The HTMLLIElement interface exposes specific properties and methods (beyond those defined by regular HTMLElement interface it also has available to it by inheritance) for manipulating list elements. ...
...inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monosp...
...And 4 more matches
HTMLLabelElement - Web APIs
The HTMLLabelElement interface gives access to properties specific to <label> elements. It inherits methods and properties from the base HTMLElement interface. ...
... The HTMLLabelElement interface gives access to properties specific to <label> elements. It inherits methods and properties from the base HTMLElement interface. ...
...inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monosp...
...And 4 more matches
HTMLLegendElement - Web APIs
The HTMLLegendElement is an interface allowing to access properties of the <legend> elements. It inherits properties and methods from the HTMLElement interface. ...
... The HTMLLegendElement is an interface allowing to access properties of the <legend> elements. It inherits properties and methods from the HTMLElement interface. ...
...inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monosp...
...And 4 more matches
HTMLLinkElement - Web APIs
The HTMLLinkElement interface represents reference information for external resources and the relationship of those resources to a document and vice-versa (corresponds to <link> element; not to be confused with <a>, which is represented by HTMLAnchorElement). This object inherits all of the properties and methods of the HTMLElement interface. ...
...o a document and vice-versa (corresponds to <link> element; not to be confused with <a>, which is represented by HTMLAnchorElement). This object inherits all of the properties and methods of the HTMLElement interface. ...
...inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monosp...
...And 4 more matches
HTMLMapElement - Web APIs
The HTMLMapElement interface provides special properties and methods (beyond those of the regular object HTMLElement interface it also has available to it by inheritance) for manipulating the layout and presentation of map elements. ...
...ent interface provides special properties and methods (beyond those of the regular object HTMLElement interface it also has available to it by inheritance) for manipulating the layout and presentation of map elements. ...
...inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monosp...
...And 4 more matches
HTMLMediaElement.onencrypted - Web APIs
The onencrypted property of the HTMLMediaElement is an event handler, fired whenever an encrypted event occurs, denoting the media is encrypted. This interface inherits from the ExtendableEvent interface. ...
... onencrypted property of the HTMLMediaElement is an event handler, fired whenever an encrypted event occurs, denoting the media is encrypted. This interface inherits from the ExtendableEvent interface. ...
... inline-block; position: absolute; top: 0; left: 0;" viewbox="-20 0 700 60" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monosp...
...And 4 more matches
HTMLMediaElement.onwaitingforkey - Web APIs
The onwaitingforkey property of the HTMLMediaElement is an event handler, fired when a waitingforkey event occurs, when playback is blocked while waiting for an encryption key. This interface inherits from the ExtendableEvent interface. ...
...HTMLMediaElement is an event handler, fired when a waitingforkey event occurs, when playback is blocked while waiting for an encryption key. This interface inherits from the ExtendableEvent interface. ...
... inline-block; position: absolute; top: 0; left: 0;" viewbox="-20 0 700 60" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monosp...
...And 4 more matches
HTMLMenuElement - Web APIs
The HTMLMenuElement interface provides special properties (beyond those defined on the regular HTMLElement interface it also has available to it by inheritance) for manipulating <menu> elements. ...
... The HTMLMenuElement interface provides special properties (beyond those defined on the regular HTMLElement interface it also has available to it by inheritance) for manipulating <menu> elements. ...
...inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monosp...
...And 4 more matches
HTMLMenuItemElement - Web APIs
The HTMLMenuItemElement interface provides special properties (beyond those defined on the regular HTMLElement interface it also has available to it by inheritance) for manipulating <menuitem> elements. ...
... The HTMLMenuItemElement interface provides special properties (beyond those defined on the regular HTMLElement interface it also has available to it by inheritance) for manipulating <menuitem> elements. ...
...inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monosp...
...And 4 more matches
HTMLMetaElement - Web APIs
The HTMLMetaElement interface contains descriptive metadata about a document. It inherits all of the properties and methods described in the HTMLElement interface. ...
... The HTMLMetaElement interface contains descriptive metadata about a document. It inherits all of the properties and methods described in the HTMLElement interface. ...
...inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monosp...
...And 4 more matches
HTMLMeterElement - Web APIs
The HTML <meter> elements expose the HTMLMeterElement interface, which provides special properties and methods (beyond the HTMLElement object interface they also have available to them by inheritance) for manipulating the layout and presentation of <meter> elements. ...
...ment interface, which provides special properties and methods (beyond the HTMLElement object interface they also have available to them by inheritance) for manipulating the layout and presentation of <meter> elements. ...
...inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monosp...
...And 4 more matches
HTMLModElement - Web APIs
The HTMLModElement interface provides special properties (beyond the regular methods and properties available through the HTMLElement interface they also have available to them by inheritance) for manipulating modification elements, that is <del> and <ins>. ...
...ecial properties (beyond the regular methods and properties available through the HTMLElement interface they also have available to them by inheritance) for manipulating modification elements, that is <del> and <ins>. ...
...inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monosp...
...And 4 more matches
HTMLObjectElement - Web APIs
The HTMLObjectElement interface provides special properties and methods (beyond those on the HTMLElement interface it also has available to it by inheritance) for manipulating the layout and presentation of <object> element, representing external resources. ...
... special properties and methods (beyond those on the HTMLElement interface it also has available to it by inheritance) for manipulating the layout and presentation of <object> element, representing external resources. ...
...inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monosp...
...And 4 more matches
HTMLOptGroupElement - Web APIs
The HTMLOptGroupElement interface provides special properties and methods (beyond the regular HTMLElement object interface they also have available to them by inheritance) for manipulating the layout and presentation of <optgroup> elements. ...
... interface provides special properties and methods (beyond the regular HTMLElement object interface they also have available to them by inheritance) for manipulating the layout and presentation of <optgroup> elements. ...
...inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monosp...
...And 4 more matches
HTMLOptionElement - Web APIs
The HTMLOptionElement interface represents <option> elements and inherits all classes and methods of the HTMLElement interface. ...
... The HTMLOptionElement interface represents <option> elements and inherits all classes and methods of the HTMLElement interface. ...
...inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monosp...
...And 4 more matches
HTMLOutputElement - Web APIs
The HTMLOutputElement interface provides properties and methods (beyond those inherited from HTMLElement) for manipulating the layout and presentation of <output> elements. ...
... The HTMLOutputElement interface provides properties and methods (beyond those inherited from HTMLElement) for manipulating the layout and presentation of <output> elements. ...
...inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monosp...
...And 4 more matches
HTMLParagraphElement - Web APIs
The HTMLParagraphElement interface provides special properties (beyond those of the regular HTMLElement object interface it inherits) for manipulating <p> elements. ...
... The HTMLParagraphElement interface provides special properties (beyond those of the regular HTMLElement object interface it inherits) for manipulating <p> elements. ...
...inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monosp...
...And 4 more matches
HTMLParamElement - Web APIs
The HTMLParamElement interface provides special properties (beyond those of the regular HTMLElement object interface it inherits) for manipulating <param> elements, representing a pair of a key and a value that acts as a parameter for an <object> element. ...
...s special properties (beyond those of the regular HTMLElement object interface it inherits) for manipulating <param> elements, representing a pair of a key and a value that acts as a parameter for an <object> element. ...
...inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monosp...
...And 4 more matches
HTMLPictureElement - Web APIs
The HTMLPictureElement interface represents a <picture> HTML element. It doesn't implement specific properties or methods. ...
... The HTMLPictureElement interface represents a <picture> HTML element. It doesn't implement specific properties or methods. ...
...inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monosp...
...And 4 more matches
HTMLPreElement - Web APIs
The HTMLPreElement interface exposes specific properties and methods (beyond those of the HTMLElement interface it also has available to it by inheritance) for manipulating a block of preformatted text (<pre>). ...
... The HTMLPreElement interface exposes specific properties and methods (beyond those of the HTMLElement interface it also has available to it by inheritance) for manipulating a block of preformatted text (<pre>). ...
...inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monosp...
...And 4 more matches
HTMLProgressElement - Web APIs
The HTMLProgressElement interface provides special properties and methods (beyond the regular HTMLElement interface it also has available to it by inheritance) for manipulating the layout and presentation of <progress> elements. ...
...gressElement interface provides special properties and methods (beyond the regular HTMLElement interface it also has available to it by inheritance) for manipulating the layout and presentation of <progress> elements. ...
...inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monosp...
...And 4 more matches
HTMLQuoteElement - Web APIs
The HTMLQuoteElement interface provides special properties and methods (beyond the regular HTMLElement interface it also has available to it by inheritance) for manipulating quoting elements, like <blockquote> and <q>, but not the <cite> element. ...
...e provides special properties and methods (beyond the regular HTMLElement interface it also has available to it by inheritance) for manipulating quoting elements, like <blockquote> and <q>, but not the <cite> element. ...
...inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monosp...
...And 4 more matches
HTMLScriptElement - Web APIs
ent interface). JavaScript files should be served with the application/javascript MIME type, but browsers are lenient and block them only if the script is served with an image type (image/*), video type (video/*), audio type (audio/*), or text/csv. If the script is blocked, its element receives an error event; otherwise, it receives a load event. ...
...m only if the script is served with an image type (image/*), video type (video/*), audio type (audio/*), or text/csv. If the script is blocked, its element receives an error event; otherwise, it receives a load event. ...
...inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monosp...
...And 4 more matches
HTMLSelectElement - Web APIs
The HTMLSelectElement interface represents a <select> HTML Element. These elements also share all of the properties and methods of other HTML elements via the HTMLElement interface. ...
... The HTMLSelectElement interface represents a <select> HTML Element. These elements also share all of the properties and methods of other HTML elements via the HTMLElement interface. ...
...inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monosp...
...And 4 more matches
HTMLShadowElement - Web APIs
The HTMLShadowElement interface represents a <shadow> HTML Element, which is used in Shadow DOM. ...
... The HTMLShadowElement interface represents a <shadow> HTML Element, which is used in Shadow DOM. ...
...inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monosp...
...And 4 more matches
HTMLSourceElement - Web APIs
The HTMLSourceElement interface provides special properties (beyond the regular HTMLElement object interface it also has available to it by inheritance) for manipulating <source> elements. ...
... The HTMLSourceElement interface provides special properties (beyond the regular HTMLElement object interface it also has available to it by inheritance) for manipulating <source> elements. ...
...inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monosp...
...And 4 more matches
HTMLSpanElement - Web APIs
The HTMLSpanElement interface represents a <span> element and derives from the HTMLElement interface, but without implementing any additional properties or methods. ...
... The HTMLSpanElement interface represents a <span> element and derives from the HTMLElement interface, but without implementing any additional properties or methods. ...
...inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monosp...
...And 4 more matches
HTMLStyleElement - Web APIs
terface represents a <style> element. It inherits properties and methods from its parent, HTMLElement, and from LinkStyle. This interface doesn't allow to manipulate the CSS it contains (in most case). To manipulate CSS, see Using dynamic styling information for an overview of the objects used to manipulate specified CSS properties using the DOM. ...
...erface doesn't allow to manipulate the CSS it contains (in most case). To manipulate CSS, see Using dynamic styling information for an overview of the objects used to manipulate specified CSS properties using the DOM. ...
...inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monosp...
...And 4 more matches
HTMLTableCaptionElement - Web APIs
The HTMLTableCaptionElement interface special properties (beyond the regular HTMLElement interface it also has available to it by inheritance) for manipulating table caption elements. ...
... The HTMLTableCaptionElement interface special properties (beyond the regular HTMLElement interface it also has available to it by inheritance) for manipulating table caption elements. ...
...inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monosp...
...And 4 more matches
HTMLTableColElement - Web APIs
The HTMLTableColElement interface provides special properties (beyond the HTMLElement interface it also has available to it inheritance) for manipulating single or grouped table column elements. ...
... The HTMLTableColElement interface provides special properties (beyond the HTMLElement interface it also has available to it inheritance) for manipulating single or grouped table column elements. ...
...inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monosp...
...And 4 more matches
HTMLTableElement - Web APIs
The HTMLTableElement interface provides special properties and methods (beyond the regular HTMLElement object interface it also has available to it by inheritance) for manipulating the layout and presentation of tables in an HTML document. ...
...nterface provides special properties and methods (beyond the regular HTMLElement object interface it also has available to it by inheritance) for manipulating the layout and presentation of tables in an HTML document. ...
...inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monosp...
...And 4 more matches
HTMLTemplateElement - Web APIs
The HTMLTemplateElement interface enables access to the contents of an HTML <template> element. ...
... The HTMLTemplateElement interface enables access to the contents of an HTML <template> element. ...
...inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monosp...
...And 4 more matches
HTMLTimeElement - Web APIs
The HTMLTimeElement interface provides special properties (beyond the regular HTMLElement interface it also has available to it by inheritance) for manipulating <time> elements. ...
... The HTMLTimeElement interface provides special properties (beyond the regular HTMLElement interface it also has available to it by inheritance) for manipulating <time> elements. ...
...inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monosp...
...And 4 more matches
HTMLTitleElement - Web APIs
The HTMLTitleElement interface contains the title for a document. This element inherits all of the properties and methods of the HTMLElement interface. ...
... The HTMLTitleElement interface contains the title for a document. This element inherits all of the properties and methods of the HTMLElement interface. ...
...inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monosp...
...And 4 more matches
HTMLTrackElement - Web APIs
The HTMLTrackElement interface represents an HTML <track> element within the DOM. This element can be used as a child of either <audio> or <video> to specify a text track containing information such as closed captions or subtitles. ...
...lement interface represents an HTML <track> element within the DOM. This element can be used as a child of either <audio> or <video> to specify a text track containing information such as closed captions or subtitles. ...
...inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monosp...
...And 4 more matches
HTMLUnknownElement - Web APIs
The HTMLUnknownElement interface represents an invalid HTML element and derives from the HTMLElement interface, but without implementing any additional properties or methods. ...
... The HTMLUnknownElement interface represents an invalid HTML element and derives from the HTMLElement interface, but without implementing any additional properties or methods. ...
...inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monosp...
...And 4 more matches
Using IndexedDB - Web APIs
About this document This tutorial walks you through using the asynchronous API of IndexedDB. If you are not familiar with IndexedDB, you should first read Basic Concepts About IndexedDB. For the reference documentation on the IndexedDB API, see the IndexedDB article and its subpages. ...
...to the right kind of DOM event. Do something with the results (which can be found on the request object). With these big concepts under our belts, we can get to more concrete stuff. Creating and structuring the store Using an experimental version of IndexedDB In case you want to test your code in browsers that still use a prefix, you can use the following code: // In the following line, you should include the prefixes of implementations you want to test. window.indexedDB = window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB; // DON'T use "var indexedDB = ..." if you're not in a function. // Moreover, you may need references to some window.IDB* objects: window.IDBTransaction = window.IDBTransaction || window.webkitIDBTransaction || window.msID...
...s you want to test. window.indexedDB = window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB; // DON'T use "var indexedDB = ..." if you're not in a function. // Moreover, you may need references to some window.IDB* objects: window.IDBTransaction = window.IDBTransaction || window.webkitIDBTransaction || window.msIDBTransaction || {READ_WRITE: "readwrite"}; // This line should only be needed if it is needed to support the object's constants for older browsers window.IDBKeyRange = window.IDBKeyRange || window.webkitIDBKeyRange || window.msIDBKeyRange; // (Mozilla has never prefixed these objects, so we don't need window.mozIDB*) Beware that implementations that use a prefix may be buggy, or incomplete, or following an old version of the specification. Therefore,...
...And 4 more matches
SVGClipPathElement - Web APIs
The SVGClipPathElement interface provides access to the properties of <clipPath> elements, as well as methods to manipulate them. ...
... The SVGClipPathElement interface provides access to the properties of <clipPath> elements, as well as methods to manipulate them. ...
...inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 140" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monosp...
...And 4 more matches
SVGCursorElement - Web APIs
The SVGCursorElement interface provides access to the properties of <cursor> elements, as well as methods to manipulate them. ...
... The SVGCursorElement interface provides access to the properties of <cursor> elements, as well as methods to manipulate them. ...
...inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 140" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monosp...
...And 4 more matches
SVGDescElement - Web APIs
The SVGDescElement interface corresponds to the <desc> element. ...
... The SVGDescElement interface corresponds to the <desc> element. ...
...inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 140" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monosp...
...And 4 more matches
SVGElement - Web APIs
All of the SVG DOM interfaces that correspond directly to elements in the SVG language derive from the SVGElement interface. ...
... All of the SVG DOM interfaces that correspond directly to elements in the SVG language derive from the SVGElement interface. ...
... inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 70" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monosp...
...And 4 more matches
SVGFEBlendElement - Web APIs
The SVGFEBlendElement interface corresponds to the <feBlend> element. ...
... The SVGFEBlendElement interface corresponds to the <feBlend> element. ...
...inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 140" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monosp...
...And 4 more matches
SVGFEColorMatrixElement - Web APIs
The SVGFEColorMatrixElement interface corresponds to the <feColorMatrix> element. ...
... The SVGFEColorMatrixElement interface corresponds to the <feColorMatrix> element. ...
...inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 140" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monosp...
...And 4 more matches
SVGFEComponentTransferElement - Web APIs
The SVGFEComponentTransferElement interface corresponds to the <feComponentTransfer> element. ...
... The SVGFEComponentTransferElement interface corresponds to the <feComponentTransfer> element. ...
...inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 140" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monosp...
...And 4 more matches
SVGFECompositeElement - Web APIs
The SVGFECompositeElement interface corresponds to the <feComposite> element. ...
... The SVGFECompositeElement interface corresponds to the <feComposite> element. ...
...inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 140" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monosp...
...And 4 more matches
SVGFEConvolveMatrixElement - Web APIs
The SVGFEConvolveMatrixElement interface corresponds to the <feConvolveMatrix> element. ...
... The SVGFEConvolveMatrixElement interface corresponds to the <feConvolveMatrix> element. ...
...inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 140" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monosp...
...And 4 more matches
SVGFEDiffuseLightingElement - Web APIs
The SVGFEDiffuseLightingElement interface corresponds to the <feDiffuseLighting> element. ...
... The SVGFEDiffuseLightingElement interface corresponds to the <feDiffuseLighting> element. ...
...inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 140" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monosp...
...And 4 more matches
SVGFEDisplacementMapElement - Web APIs
The SVGFEDisplacementMapElement interface corresponds to the <feDisplacementMap> element. ...
... The SVGFEDisplacementMapElement interface corresponds to the <feDisplacementMap> element. ...
...inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 140" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monosp...
...And 4 more matches
SVGFEDistantLightElement - Web APIs
The SVGFEDistantLightElement interface corresponds to the <feDistantLight> element. ...
... The SVGFEDistantLightElement interface corresponds to the <feDistantLight> element. ...
...inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 140" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monosp...
...And 4 more matches
SVGFEDropShadowElement - Web APIs
The SVGFEDropShadowElement interface corresponds to the <feDropShadow> element. ...
... The SVGFEDropShadowElement interface corresponds to the <feDropShadow> element. ...
...inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 140" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monosp...
...And 4 more matches
SVGFEFloodElement - Web APIs
The SVGFEFloodElement interface corresponds to the <feFlood> element. ...
... The SVGFEFloodElement interface corresponds to the <feFlood> element. ...
...inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 140" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monosp...
...And 4 more matches
SVGFEGaussianBlurElement - Web APIs
The SVGFEGaussianBlurElement interface corresponds to the <feGaussianBlur> element. ...
... The SVGFEGaussianBlurElement interface corresponds to the <feGaussianBlur> element. ...
...inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 140" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monosp...
...And 4 more matches
SVGFEImageElement - Web APIs
The SVGFEImageElement interface corresponds to the <feImage> element. ...
... The SVGFEImageElement interface corresponds to the <feImage> element. ...
...inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 140" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monosp...
...And 4 more matches
SVGFEMergeElement - Web APIs
The SVGFEMergeElement interface corresponds to the <feMerge> element. ...
... The SVGFEMergeElement interface corresponds to the <feMerge> element. ...
...inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 140" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monosp...
...And 4 more matches
SVGFEMergeNodeElement - Web APIs
The SVGFEMergeNodeElement interface corresponds to the <feMergeNode> element. ...
... The SVGFEMergeNodeElement interface corresponds to the <feMergeNode> element. ...
...inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 140" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monosp...
...And 4 more matches
SVGFEMorphologyElement - Web APIs
The SVGFEMorphologyElement interface corresponds to the <feMorphology> element. ...
... The SVGFEMorphologyElement interface corresponds to the <feMorphology> element. ...
...inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 140" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monosp...
...And 4 more matches
SVGFEOffsetElement - Web APIs
The SVGFEOffsetElement interface corresponds to the <feOffset> element. ...
... The SVGFEOffsetElement interface corresponds to the <feOffset> element. ...
...inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 140" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monosp...
...And 4 more matches
SVGFEPointLightElement - Web APIs
The SVGFEPointLightElement interface corresponds to the <fePointLight> element. ...
... The SVGFEPointLightElement interface corresponds to the <fePointLight> element. ...
...inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 140" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monosp...
...And 4 more matches
SVGFESpecularLightingElement - Web APIs
The SVGFESpecularLightingElement interface corresponds to the <feSpecularLighting> element. ...
... The SVGFESpecularLightingElement interface corresponds to the <feSpecularLighting> element. ...
...inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 140" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monosp...
...And 4 more matches
SVGFESpotLightElement - Web APIs
The SVGFESpotLightElement interface corresponds to the <feSpotLight> element. ...
... The SVGFESpotLightElement interface corresponds to the <feSpotLight> element. ...
...inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 140" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monosp...
...And 4 more matches
SVGFETileElement - Web APIs
The SVGFETileElement interface corresponds to the <feTile> element. ...
... The SVGFETileElement interface corresponds to the <feTile> element. ...
...inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 140" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monosp...
...And 4 more matches
SVGFETurbulenceElement - Web APIs
The SVGFETurbulenceElement interface corresponds to the <feTurbulence> element. ...
... The SVGFETurbulenceElement interface corresponds to the <feTurbulence> element. ...
...inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 140" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monosp...
...And 4 more matches
SVGFilterElement - Web APIs
The SVGFilterElement interface provides access to the properties of <filter> elements, as well as methods to manipulate them. ...
... The SVGFilterElement interface provides access to the properties of <filter> elements, as well as methods to manipulate them. ...
...inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 140" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monosp...
...And 4 more matches
SVGGraphicsElement - Web APIs
The SVGGraphicsElement interface represents SVG elements whose primary purpose is to directly render graphics into a group. ...
... The SVGGraphicsElement interface represents SVG elements whose primary purpose is to directly render graphics into a group. ...
...inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monosp...
...And 4 more matches
SVGMPathElement - Web APIs
The SVGMPathElement interface corresponds to the <mpath> element. ...
... The SVGMPathElement interface corresponds to the <mpath> element. ...
...inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 140" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monosp...
...And 4 more matches
SVGMaskElement - Web APIs
The SVGMaskElement interface provides access to the properties of <mask> elements, as well as methods to manipulate them. ...
... The SVGMaskElement interface provides access to the properties of <mask> elements, as well as methods to manipulate them. ...
...inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 140" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monosp...
...And 4 more matches
SVGMetadataElement - Web APIs
The SVGMetadataElement interface corresponds to the <metadata> element. ...
... The SVGMetadataElement interface corresponds to the <metadata> element. ...
...inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 140" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monosp...
...And 4 more matches
SVGPatternElement - Web APIs
The SVGPatternElement interface corresponds to the <pattern> element. ...
... The SVGPatternElement interface corresponds to the <pattern> element. ...
...inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 140" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monosp...
...And 4 more matches
SVGScriptElement - Web APIs
The SVGScriptElement interface corresponds to the SVG <script> element. ...
... The SVGScriptElement interface corresponds to the SVG <script> element. ...
...inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 140" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monosp...
...And 4 more matches
SVGStopElement - Web APIs
The SVGStopElement interface corresponds to the <stop> element. ...
... The SVGStopElement interface corresponds to the <stop> element. ...
...inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 140" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monosp...
...And 4 more matches
SVGStyleElement - Web APIs
SVG style interface The SVGStyleElement interface corresponds to the SVG <style> element. ...
... SVG style interface The SVGStyleElement interface corresponds to the SVG <style> element. ...
...inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 140" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monosp...
...And 4 more matches
SVGSymbolElement - Web APIs
The SVGSymbolElement interface corresponds to the <symbol> element. ...
... The SVGSymbolElement interface corresponds to the <symbol> element. ...
...inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 140" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monosp...
...And 4 more matches
SVGTitleElement - Web APIs
The SVGTitleElement interface corresponds to the <title> element. ...
... The SVGTitleElement interface corresponds to the <title> element. ...
...inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 140" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monosp...
...And 4 more matches
Using server-sent events - Web APIs
her 6 SSE connections to www.example2.com (per Stackoverflow). When using HTTP/2, the maximum number of simultaneous HTTP streams is negotiated between the server and the client (defaults to 100). Sending events from the server The server-side script that sends events needs to respond using the MIME type text/event-stream. Each notification is sent as a block of text terminated by a pair of newlines. For details on the format of the event stream, see Event stream format. The PHP code for the example we're using here follows: date_default_timezone_set("America/New_York"); header("Cache-Control: no-cache"); header("Content-Type: text/event-stream"); $counter = rand(1, 10); while (true) { // Every second, send a "ping" event. echo "event: ping\n"; $curDate = date(DATE_ISO8601); ech...
...error("EventSource failed:", err); }; Closing event streams By default, if the connection between the client and server closes, the connection is restarted. The connection is terminated with the .close() method. evtSource.close(); Event stream format The event stream is a simple stream of text data which must be encoded using UTF-8. Messages in the event stream are separated by a pair of newline characters. A colon as the first character of a line is in essence a comment, and is ignored. Note: The comment line can be used to prevent connections from timing out; a server can send a comment periodically to keep the connection alive. Each message consists of one or more lines of text listing the fields for that message. Each field is represented by the field name, followed by a colon, fol...
...o prevent connections from timing out; a server can send a comment periodically to keep the connection alive. Each message consists of one or more lines of text listing the fields for that message. Each field is represented by the field name, followed by a colon, followed by the text data for that field's value. Fields Each message received has some combination of the following fields, one per line: event A string identifying the type of event described. If this is specified, an event will be dispatched on the browser to the listener for the specified event name; the website source code should use addEventListener() to listen for named events. The onmessage handler is called if no event name is specified for a message. data The data field for the message. When the EventSource receives...
...And 4 more matches
User Timing API - Web APIs
There are two types of user defined timing event types: the "mark" event type and the "measure" event type. mark events are named by the application and can be set at any location in an application. measure events are also named by the application but they are placed between two marks thus they are effectively a midpoint between two marks. This document provides an overview of the mark and measure performance event types including the four User Timing methods that extend the Performance interface. ...
...nd measure performance event types including the four User Timing methods that extend the Performance interface. For more details and example code regarding these two performance event types and the methods, see Using the User Timing API. Performance marks A performance mark is a named performance entry that is created by the application. The mark is a timestamp in the browser's performance timeline. Creating a performance mark The performance.mark() method is used to create a performance mark. The method takes one argument, the name of the mark (for example performance.mark("mark-1")). The mark's performance entry will have the following property values: entryType - set to "mark". name - set to the "name" given when the mark was created. startTime - set to the timestamp when mark() ...
...alues: entryType - set to "mark". name - set to the "name" given when the mark was created. startTime - set to the timestamp when mark() was called. duration - set to "0" (a mark has no duration). Retrieving performance marks The Performance interface has three methods that can be used to retrieve a mark: performance.getEntries() Returns all performance entries in the performance timeline. Finding only mark entries requires checking each entry's entryType for "mark". performance.getEntriesByName(name, entryType) Returns all performance entries in the performance timeline with the specified name and entryType, thus set entryType to "mark" to get all marks (and set name accordingly to retrieve more specific entries). performance.getEntriesByType(entryType) Returns all performanc...
...And 4 more matches
WheelEvent - Web APIs
ecessarily dispatch a scroll event. Even when it does, that doesn't mean that the delta* values in the wheel event necessarily reflect the content's scrolling direction. Therefore, do not rely on delta* properties to get the content's scrolling direction. Instead, detect value changes to scrollLeft and scrollTop of the target in the scroll event. ...
... scrolling direction. Therefore, do not rely on delta* properties to get the content's scrolling direction. Instead, detect value changes to scrollLeft and scrollTop of the target in the scroll event. ...
...play: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 70" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/Event" target="_top"><rect x="1" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="38.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">Event</text></a><polyline points="76,25 86,20 86,30 76,25" stroke="#D4DDE4" fill="none"/><line x1="86" y1="25" x2="116" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/UIEvent" target="_top"><rect x="116" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="153.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fil...
...And 4 more matches
Window - Web APIs
Web › API › Window
y JavaScript code running within a given tab always represents the tab in which the code is running. That said, even in a tabbed browser, some properties and methods still apply to the overall window that contains the tab, such as resizeTo() and innerHeight. Generally, anything that can't reasonably pertain to a tab pertains to the window instead. ...
...rties and methods still apply to the overall window that contains the tab, such as resizeTo() and innerHeight. Generally, anything that can't reasonably pertain to a tab pertains to the window instead. ...
... DOMParser DOMParser can parse XML or HTML source stored in a string into a DOM Document. DOMParser is specified in DOM Parsing and Serialization. Image Used for creating an HTMLImageElement. Option Used for creating an HTMLOptionElement. ...
...And 4 more matches
Synchronous and asynchronous requests - Web APIs
is is the simplest usage of asynchronous XMLHttpRequest. var xhr = new XMLHttpRequest(); xhr.open("GET", "/bar/foo.txt", true); xhr.onload = function (e) { if (xhr.readyState === 4) { if (xhr.status === 200) { console.log(xhr.responseText); } else { console.error(xhr.statusText); } } }; xhr.onerror = function (e) { console.error(xhr.statusText); }; xhr.send(null); Line 2 specifies true for its third parameter to indicate that the request should be handled asynchronously. Line 3 creates an event handler function object and assigns it to the request's onload attribute. This handler looks at the request's readyState to see if the transaction is complete in line 4; if it is, and the HTTP status is 200, the handler dumps the received content. If an error occurred, ...
...The callback routine is called whenever the state of the request changes. Example: writing a function to read an external file In some cases, you must read many external files. ...
...} 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 (via the arguments property) to the success callback function. Line 1 declares a function invoked when the XHR operation completes successfully. It, in turn, invokes the callback function specified in the invocation of the loadFile function (in this case, the function showMessage) which has been assigned to a property of the XHR object (Line 11). The additional arguments (if any) supplied to the invocation of function loadFile are "applied" to the running of the ...
...And 4 more matches
-webkit-box-reflect - CSS: Cascading Style Sheets
The -webkit-box-reflect CSS property lets you reflect the content of an element in one specific direction. /* Direction values */ -webkit-box-reflect: above; -webkit-box-reflect: below; -webkit-box-reflect: left; -webkit-box-reflect: right; /* Offset value */ -webkit-box-reflect: below 10px; /* Mask value */ -webkit-box-reflect: below 0 linear-gradient(transparent, white); /* Global values */ -webkit-box-reflect: inherit; -webkit-box-reflect: initial; -webkit-box-reflect: unset; Note: This feature is not intended to be used by Web sites. To achieve reflection on the Web, the standard way is to use the CSS element() function. Syntax Values above, below, right, left Are keywords indicating in which direction the reflection is to happen. <length> Indicates the size of the...
...<image>?where <image> = <url> | <image()> | <image-set()> | <element()> | <paint()> | <cross-fade()> | <gradient>where <image()> = image( <image-tags>? [ <image-src>? , <color>? ]! ...
...<image()> | <image-set()> | <element()> | <paint()> | <cross-fade()> | <gradient>where <image()> = image( <image-tags>? [ <image-src>? , <color>? ]! ...
...And 4 more matches
CSS Grid Layout and Progressive Enhancement - CSS: Cascading Style Sheets
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. ...
... 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. Using display: inline-block is an alternate method. Once again I can use feature queries to overwrite a layout that uses display: inline-block, and again I don't need to overwrite everything. ...
...r 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. Using display: inline-block is an alternate method. Once again I can use feature queries to overwrite a layout that uses display: inline-block, and again I don't need to overwrite everything. An item that is set to inline-block becomes a grid item, and so the behaviour of inline-block no longer applies. ...
...And 4 more matches
Grid template areas - CSS: Cascading Style Sheets
In the previous guide we looked at grid lines, and how to position items against those lines. When you use CSS Grid Layout you always have lines, and this can be a straightforward way to place items on your grid. However, there is an alternate method to use for positioning items on the grid which you can use alone or in combination with line-based placement. This method involves placing our items using named template areas, and we will find out exactly how this method works. You will see very quickly why we sometimes call this the ascii-art method of grid layout! Naming a grid area You have already encountered the grid-area property. This is the property that can take as a value all four of the lines used to position a grid area. .box1 { grid-area: 1 / 1 / 4 / 2; } What we are ...
...d we will find out exactly how this method works. You will see very quickly why we sometimes call this the ascii-art method of grid layout! Naming a grid area You have already encountered the grid-area property. This is the property that can take as a value all four of the lines used to position a grid area. .box1 { grid-area: 1 / 1 / 4 / 2; } What we are doing here when defining all four lines, is defining the area by specifying the lines that enclose that area. We can also define an area by giving it a name and then specify the location of that area in the value of the grid-template-areas property. You can choose what you would like to name your area. For example, if I wish to create the layout shown below I can identify four main areas. a header a footer a sidebar the main ...
...main content With the grid-area property I can assign each of these areas a name. This will not yet create any layout, but we now have named areas to use in a layout. .header { grid-area: hd; } .footer { grid-area: ft; } .content { grid-area: main; } .sidebar { grid-area: sd; } Having defined these names I then create my layout. This time, instead of placing my items using line numbers specified on the items themselves, I create the whole layout on the grid container. .wrapper { display: grid; grid-template-columns: repeat(9, 1fr); grid-auto-rows: minmax(100px, auto); grid-template-areas: "hd hd hd hd hd hd hd hd hd" "sd sd sd main main main main main main" "ft ft ft ft ft ft ft ft ft"; } * {box-sizing: border-bo...
...And 4 more matches
border-image-source - CSS: Cascading Style Sheets
the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. The border-image-slice property is used to divide the source image into regions, which are then dynamically applied to the final border image. Syntax /* Keyword value */ border-image-source: none; /* <image> values */ border-image-source: url(image.jpg); border-image-source: linear-gradient(to top, red, yellow); /* Global values */ border-image-source: inherit; border-image-source: initial; border-image-source: unset; Values none No border image is used. The appearance defined by border-style is displayed instead. <image> Image reference to use for the border. Formal definition Initial valuenoneApplies toall elements, except internal table elements when border...
... <image>where <image> = <url> | <image()> | <image-set()> | <element()> | <paint()> | <cross-fade()> | <gradient>where <image()> = image( <image-tags>? [ <image-src>? , <color>? ]! ...
...<image()> | <image-set()> | <element()> | <paint()> | <cross-fade()> | <gradient>where <image()> = image( <image-tags>? [ <image-src>? , <color>? ]! ...
...And 4 more matches
<gradient> - CSS: Cascading Style Sheets
Web › CSS › gradient
to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. A CSS gradient has no intrinsic dimensions; i.e., it has no natural or preferred size, nor a preferred ratio. Its concrete size will match the size of the element to which it applies. Syntax The <gradient> data type is defined with one of the function types listed below. Linear gradient Linear gradients transition colors progressively along an imaginary line. They are generated with the linear-gradient() function. Radial gradient Radial gradients transition colors progressively from a center point (origin). They are generated with the radial-gradient() function. Repeating gradient Repeating gradients duplicate a gradient as much as necessary to fill a given a...
... Conic gradient Conic gradients transition colors progressively around a circle. They are generated with the conic-gradient() function. Interpolation As with any interpolation involving colors, gradients are calculated in the alpha-premultiplied color space. ...
...a circle. They are generated with the conic-gradient() function. Interpolation As with any interpolation involving colors, gradients are calculated in the alpha-premultiplied color space. This prevents unexpected shades of gray from appearing when both the color and the opacity are changing. (Be aware that older browsers may not use this behavior when using the transparent keyword.) Examples Linear gradient example A simple linear gradient. <div class="linear-gradient">Linear gradient</div> div { width: 240px; height: 80px; } .linear-gradient { background: linear-gradient(to right, red, orange, yellow, green, blue, indigo, violet); } Radial gradient example A simple radial gradient. <div class="radial-gradient">Radial gradient</div> div { width: 240px; heigh...
...And 4 more matches
hyphens - CSS: Cascading Style Sheets
Web › CSS › hyphens
It can prevent hyphenation entirely, hyphenate at manually-specified points within the text, or let the browser automatically insert hyphens where appropriate. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Hyphenation rules are language-specific. ...
...performed are not explicitly defined by the specification, so the exact hyphenation may vary from browser to browser. Syntax /* Keyword values */ hyphens: none; hyphens: manual; hyphens: auto; /* Global values */ hyphens: inherit; hyphens: initial; hyphens: unset; The hyphens property is specified as a single keyword value chosen from the list below. Values none Words are not broken at line breaks, even if characters inside the words suggest line break points. Lines will only wrap at whitespace. manual Words are broken for line-wrapping only where characters inside the word suggest line break opportunities. See Suggesting line break opportunities below for details. auto The browser is free to automatically break words at appropriate hyphenation points, following whatever rules i...
... Note: The auto setting's behavior depends on the language being properly tagged to select the appropriate hyphenation rules. ...
...And 4 more matches
initial-letter-align - CSS: Cascading Style Sheets
initial-letter-align: unset; Syntax One of the keyword values listed below. Values auto The user agent selects the value which corresponds to the language of the text. Western languages would default to alphabetic, CJK languages to ideographic, and some Indic languages to hanging. ...
...unset; Syntax One of the keyword values listed below. Values auto The user agent selects the value which corresponds to the language of the text. Western languages would default to alphabetic, CJK languages to ideographic, and some Indic languages to hanging. alphabetic As described above, the cap height of the initial letter aligns with the cap height of the first line of text. ...
...ed below. Values auto The user agent selects the value which corresponds to the language of the text. Western languages would default to alphabetic, CJK languages to ideographic, and some Indic languages to hanging. alphabetic As described above, the cap height of the initial letter aligns with the cap height of the first line of text. The baseline of the initial letter aligns with the baseline of the Nth text baseline. ...
...And 4 more matches
justify-content - CSS: Cascading Style Sheets
The interactive example below demonstrates some of the values using Grid Layout. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...around the center */ justify-content: start; /* Pack items from the start */ justify-content: end; /* Pack items from the end */ justify-content: flex-start; /* Pack flex items from the start */ justify-content: flex-end; /* Pack flex items from the end */ justify-content: left; /* Pack items from the left */ justify-content: right; /* Pack items from the right */ /* Baseline alignment */ /* justify-content does not take baseline values */ /* Normal alignment */ justify-content: normal; /* Distributed alignment */ justify-content: space-between; /* Distribute items evenly The first item is flush with the start, the last is flush with the end */ justify-content: space-around; /* Distribute items e...
...-end side. This only applies to flex layout items. For items that are not children of a flex container, this value is treated like end. center The items are packed flush to each other toward the center of the alignment container along the main axis. left The items are packed flush to each other toward the left edge of the alignment container. If the property's axis is not parallel with the inline axis, this value behaves like start. right The items are packed flush to each other toward the right edge of the alignment container in the appropriate axis. If the property's axis is not parallel with the inline axis, this value behaves like start. normal The items are packed in their default position as if no justify-content value was set. This value behaves as stretch in grid and flex cont...
...And 4 more matches
mask-border-source - CSS: Cascading Style Sheets
The mask-border-source CSS property sets the source image used to create an element's mask border. The mask-border-slice property is used to divide the source image into regions, which are then dynamically applied to the final mask border. Syntax /* Keyword value */ mask-border-source: none; /* <image> values */ mask-border-source: url(image.jpg); mask-border-source: linear-gradient(to top, red, yellow); /* Global values */ mask-border-source: inherit; mask-border-source: initial; mask-border-source: unset; Values none No mask border is used. <image> Image reference to use for the mask border. Formal definition Initial valuenoneApplies toall elements; In SVG, it applies to container elements excluding the defs element and all graphics elementsInheritednoComputed valueas specif...
... <image>where <image> = <url> | <image()> | <image-set()> | <element()> | <paint()> | <cross-fade()> | <gradient>where <image()> = image( <image-tags>? [ <image-src>? , <color>? ]! ...
...<image()> | <image-set()> | <element()> | <paint()> | <cross-fade()> | <gradient>where <image()> = image( <image-tags>? [ <image-src>? , <color>? ]! ...
...And 4 more matches
mask-image - CSS: Cascading Style Sheets
The mask-image CSS property sets the image that is used as mask layer for an element. /* Keyword value */ mask-image: none; /* <mask-source> value */ mask-image: url(masks.svg#mask1); /* <image> values */ mask-image: linear-gradient(rgba(0, 0, 0, 1.0), transparent); mask-image: image(url(mask.png), skyblue); /* Multiple values */ mask-image: image(url(mask.png), skyblue), linear-gradient(rgba(0, 0, 0, 1.0), transparent); /* Global values */ mask-image: inherit; mask-image: initial; mask-image: unset; Syntax Values none This keyword is interpreted as a transparent black image layer. <mask-source> A <url> reference to a <mask> or to a CSS image. <image> An image value used as mask image layer. Formal definition Initial valuenoneApplies toall elements; In SVG, it applies to co...
... = <url> | <image()> | <image-set()> | <element()> | <paint()> | <cross-fade()> | <gradient><mask-source> = <url>where <image()> = image( <image-tags>? [ <image-src>? , <color>? ]! ...
...t()> | <element()> | <paint()> | <cross-fade()> | <gradient><mask-source> = <url>where <image()> = image( <image-tags>? [ <image-src>? , <color>? ]! ...
...And 4 more matches
overflow-wrap - CSS: Cascading Style Sheets
The property was originally a nonstandard and unprefixed Microsoft extension called word-wrap, and was implemented by most browsers with the same name. ...
... The property was originally a nonstandard and unprefixed Microsoft extension called word-wrap, and was implemented by most browsers with the same name. ...
... The property was originally a nonstandard and unprefixed Microsoft extension called word-wrap, and was implemented by most browsers with the same name. It has since been renamed to overflow-wrap, with word-wrap being an alias. ...
...And 4 more matches
place-content - CSS: Cascading Style Sheets
the align-content and justify-content properties) in a relevant layout system such as Grid or Flexbox. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...and send us a pull request. ...
...is property is a shorthand for the following CSS properties: align-content justify-content Syntax /* Positional alignment */ /* align-content does not take left and right values */ place-content: center start; place-content: start center; place-content: end left; place-content: flex-start center; place-content: flex-end center; /* Baseline alignment */ /* justify-content does not take baseline values */ place-content: baseline center; place-content: first baseline space-evenly; place-content: last baseline right; /* Distributed alignment */ place-content: space-between space-evenly; place-content: space-around space-evenly; place-content: space-evenly stretch; place-content: stretch space-evenly; /* Global values */ place-content: inherit; place-content: initial; place-content: unset...
...And 4 more matches
position - CSS: Cascading Style Sheets
Web › CSS › position
y, not auto), top wins. If both left and right are specified, left wins when direction is ltr (English, horizontal Japanese, etc.) and right wins when direction is rtl (Persian, Arabic, Hebrew, etc.). Accessibility concerns Ensure that elements positioned with an absolute or fixed value do not obscure other content when the page is zoomed to increase text size. MDN Understanding WCAG, Guideline 1.4 explanations Visual Presentation: Understanding SC 1.4.8 | Understanding WCAG 2.0 Performance & Accessibility Scrolling elements containing fixed or sticky content can cause performance and accessibility issues. As a user scrolls, the browser must repaint the sticky or fixed content in a new location. Depending on the content needing to be repainted, the browser performance, and the devic...
...m their normal position within the document, but without the offset affecting other elements. In the example below, note how the other elements are placed as if "Two" were taking up the space of its normal location. HTML <div class="box" id="one">One</div> <div class="box" id="two">Two</div> <div class="box" id="three">Three</div> <div class="box" id="four">Four</div> CSS .box { display: inline-block; width: 100px; height: 100px; background: red; color: white; } #two { position: relative; top: 20px; left: 20px; background: blue; } Absolute positioning Elements that are relatively positioned remain in the normal flow of the document. In contrast, an element that is absolutely positioned is taken out of the flow; thus, other elements are positioned as if it did not e...
...o its nearest positioned ancestor (i.e., the nearest ancestor that is not static). If a positioned ancestor doesn't exist, it is positioned relative to the ICB (initial containing block -- see also the W3C definition), which is the containing block of the document's root element. HTML <h1>Absolute positioning</h1> <p>I am a basic block level element. ...
...And 4 more matches
text-decoration-thickness - CSS: Cascading Style Sheets
The text-decoration-thickness CSS property sets the stroke thickness of the decoration line that is used on text in an element, such as a line-through, underline, or overline. Syntax /* Single keyword */ text-decoration-thickness: auto; text-decoration-thickness: from-font; /* length */ text-decoration-thickness: 0.1em; text-decoration-thickness: 3px; /* percentage */ text-decoration-thickness: 10%; /* Global values */ text-decoration-thickness: inherit; text-decoration-thickness: initial; text-decoration-thickness: unset; Values auto The browser chooses an appropriate width for the text decoration line. from-font If the font file includes information about a preferred thickness, use that value. If the font file doesn't include this information, behave as if auto was set, with th...
...A percentage inherits as a relative value, and so therefore scales with changes in the font. ...
...A percentage inherits as a relative value, and so therefore scales with changes in the font. ...
...And 4 more matches
text-indent - CSS: Cascading Style Sheets
The text-indent CSS property sets the length of empty space (indentation) that is put before lines of text in a block. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Horizontal spacing is with respect to the left (or right, for right-to-left layout) edge of the containing block-level element's content box. ...
...b.com/mdn/interactive-examples and send us a pull request. Horizontal spacing is with respect to the left (or right, for right-to-left layout) edge of the containing block-level element's content box. ...
...rizontal spacing is with respect to the left (or right, for right-to-left layout) edge of the containing block-level element's content box. ...
...And 4 more matches
white-space - CSS: Cascading Style Sheets
a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Note: To make words break within themselves, use overflow-wrap, word-break, or hyphens instead. Syntax /* Keyword values */ white-space: normal; white-space: nowrap; white-space: pre; white-space: pre-wrap; white-space: pre-line; white-space: break-spaces; /* Global values */ white-space: inherit; white-space: initial; white-space: unset; The white-space property is specified as a single keyword chosen from the list of values below. Values normal Sequences of white space are collapsed. Newline characters in the source are handled the same as other white space. Lines are broken as necessary to fill line boxes. no...
...ace: inherit; white-space: initial; white-space: unset; The white-space property is specified as a single keyword chosen from the list of values below. Values normal Sequences of white space are collapsed. Newline characters in the source are handled the same as other white space. Lines are broken as necessary to fill line boxes. nowrap Collapses white space as for normal, but suppresses line breaks (text wrapping) within the source. pre Sequences of white space are preserved. Lines are only broken at newline characters in the source and at <br> elements. ...
...racters in the source are handled the same as other white space. Lines are broken as necessary to fill line boxes. nowrap Collapses white space as for normal, but suppresses line breaks (text wrapping) within the source. pre Sequences of white space are preserved. Lines are only broken at newline characters in the source and at <br> elements. pre-wrap Sequences of white space are preserved. Lines are broken at newline characters, at <br>, and as necessary to fill line boxes. pre-line Sequences of white space are collapsed. Lines are broken at newline characters, at <br>, and as necessary to fill line boxes. break-spaces The behavior is identical to that of pre-wrap, except that: Any sequence of preserved white space always takes up space, including at the end of the line. A lin...
...And 4 more matches
writing-mode - CSS: Cascading Style Sheets
Thus, it also determines the ordering of block-level content. ...
...ent for HTML documents). The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. This property specifies the block flow direction, which is the direction in which block-level containers are stacked, and the direction in which inline-level content flows within a block container. Thus, it also determines the ordering of block-level content. Syntax /* Keyword values */ writing-mode: horizontal-tb; writing-mode: vertical-rl; writing-mode: vertical-lr; /* Global values */ writing-mode: inherit; writing-mode: initial; writing-mode: unset; The writing-mode property is specified as one of the values listed below. The flow direct...
...es listed below. The flow direction in horizontal scripts is also affected by the directionality of that script, either left-to-right (ltr, like English and most other languages) or right-to-left (rtl, like Hebrew or Arabic). Values horizontal-tb For ltr scripts, content flows horizontally from left to right. For rtl scripts, content flows horizontally from right to left. The next horizontal line is positioned below the previous line. vertical-rl For ltr scripts, content flows vertically from top to bottom, and the next vertical line is positioned to the left of the previous line. For rtl scripts, content flows vertically from bottom to top, and the next vertical line is positioned to the right of the previous line. vertical-lr For ltr scripts, content flows vertically from top to bot...
...And 4 more matches
The HTML autocomplete attribute - HTML: Hypertext Markup Language
d. "one-time-code" A one-time code used for verifying user identity. "organization-title" A job title, or the title a person has within an organization, such as "Senior Technical Writer", "President", or "Assistant Troop Leader". "organization" A company or organization name, such as "Acme Widget Company" or "Girl Scouts of America". "street-address" A street address. This can be multiple lines of text, and should fully identify the location of the address within its second administrative level (typically a city or town), but should not include the city name, ZIP or postal code, or country name. "address-line1", "address-line2", "address-line3" Each individual line of the street address. These should only be present if the "street-address" is not present. "address-level4" The fines...
...ency", of the transaction, for a payment form. "language" A preferred language, given as a valid BCP 47 language tag. "bday" A birth date, as a full date. "bday-day" The day of the month of a birth date. "bday-month" The month of the year of a birth date. "bday-year" The year of a birth date. "sex" A gender identity (such as "Female", "Fa'afafine", "Male"), as freeform text without newlines. "tel" A full telephone number, including the country code. If you need to break the phone number up into its components, you can use these values for those fields: "tel-country-code" The country code, such as "1" for the United States, Canada, and other areas in North America and parts of the Caribbean. "tel-national" The entire phone number without the country code component, inclu...
...Postal Service shorthand for "California"). Thus address-level1 is the state, or "CA" in this case. The second-least specific portion of the address is the city or town name, so address-level2 is "Exampleville" in this example address. United States addresses do not use levels 3 and up. United Kingdom Address input forms in the UK should contain one address level and one, two or three address lines, depending on the address. A complete address would look like so: 103 Frogmarch Street Upper-Wapping Winchelsea TN99 8ZZ The address levels are: address-level1: The post town -- "Winchelsea" in this case. address-line2: The locality -- "Upper-Wapping" in this case. address-line1: The house/street particulars -- "103 Frogmarch Street" The postcode is separate. Note that you can actual...
...And 4 more matches
<textarea> - HTML: Hypertext Markup Language
Web › HTML › Element › textarea
The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. The above example demonstrates a number of features of <textarea>: An id attribute to allow the <textarea> to be associated with a <label> element for accessibility purposes A name attribute to set the name of the associated data point submitted to the server when the form is submitted. ...
...maxlength The maximum number of characters (UTF-16 code units) that the user can enter. If this value isn't specified, the user can enter an unlimited number of characters. minlength The minimum number of characters (UTF-16 code units) required that the user should enter. name The name of the control. placeholder A hint to the user of what can be entered in the control. Carriage returns or line-feeds within the placeholder text must be treated as line breaks when rendering the hint. Note: Placeholders should only be used to show an example of the type of data that should be entered into a form; they are not a substitute for a proper <label> element tied to the input. See Labels and placeholders in <input>: The Input (Form Input) element for a full explanation. readonly This Boolean...
...lean attribute indicates that the user cannot modify the value of the control. Unlike the disabled attribute, the readonly attribute does not prevent the user from clicking or selecting in the control. The value of a read-only control is still submitted with the form. required This attribute specifies that the user must fill in a value before submitting a form. rows The number of visible text lines for the control. spellcheck Specifies whether the <textarea> is subject to spell checking by the underlying browser/OS. the value can be: true: Indicates that the element needs to have its spelling and grammar checked. default : Indicates that the element is to act according to a default behavior, possibly based on the parent element's own spellcheck value. false : Indicates that the e...
...And 4 more matches
Cross-Origin Resource Sharing (CORS) - HTTP
Web › HTTP › CORS
The browser determines that it needs to send this based on the request parameters that the JavaScript code snippet above was using, so that the server can respond whether it is acceptable to send the request with the actual request parameters. OPTIONS is an HTTP/1.1 method that is used to determine further information from ser...
...he JavaScript code snippet above was using, so that the server can respond whether it is acceptable to send the request with the actual request parameters. OPTIONS is an HTTP/1.1 method that is used to determine further information from servers, and is a safe method, meaning that it can't be used to change the resource. Note that along with the OPTIONS request, two other request headers are sent (lines 9 and 10 respectively): Access-Control-Request-Method: POST Access-Control-Request-Headers: X-PINGOTHER, Content-Type The Access-Control-Request-Method header notifies the server as part of a preflight request that when the actual request is sent, it will be sent with a POST request method. The Access-Control-Request-Headers header notifies the server that when the actual request is sent, it ...
...erver as part of a preflight request that when the actual request is sent, it will be sent with a POST request method. The Access-Control-Request-Headers header notifies the server that when the actual request is sent, it will be sent with a X-PINGOTHER and Content-Type custom headers. The server now has an opportunity to determine whether it wishes to accept a request under these circumstances. Lines 13 - 22 above are the response that the server sends back indicating that the request method (POST) and request headers (X-PINGOTHER) are acceptable. In particular, let's look at lines 16-19: Access-Control-Allow-Origin: http://foo.example Access-Control-Allow-Methods: POST, GET, OPTIONS Access-Control-Allow-Headers: X-PINGOTHER, Content-Type Access-Control-Max-Age: 86400 The server responds w...
...And 4 more matches
JavaScript modules - JavaScript
s a module by runtimes such as Node.js, and build tools such as Babel. However, we decided to keep to using .js, at least for the moment. To get modules to work correctly in a browser, you need to make sure that your server is serving them with a Content-Type header that contains a JavaScript MIME type such as text/javascript. If you don't, you'll get a strict MIME type checking error along the lines of "The server responded with a non-JavaScript MIME type" and the browser won't run your JavaScript. Most servers already set the correct type for .js files, but not yet for .mjs files. Servers that already serve .mjs files correctly include GitHub Pages and http-server for Node.js. This is OK if you are using such an environment already, or if you aren't but you know what you are doing and hav...
...ollowed by the path beyond that to the file we are trying to find. This is much better than writing out the entire relative path each time, as it is shorter, and it makes the URL portable -- the example will still work if you move it to a different location in the site hierarchy. ...
... becomes ./modules/square.js You can see such lines in action in main.js. Note: In some module systems, you can omit the file extension and the dot (e.g. '/modules/square'). This doesn't work in native JavaScript modules. Once you've imported the features into your script, you can use them just like they were defined inside the same file. The following is found in main.js, below the import lines: let myCanvas = create('myCanvas', document.body, 480, 320); let reportList = createReportList(myCanvas.id); let square1 = draw(myCanvas.ctx, 50, 50, 100, 'blue'); reportArea(square1.length, reportList); reportPerimeter(square1.length, reportList); Note: Although imported features are available in the file, they are read only views of the feature that was exported. You cannot change the var...
...And 4 more matches
Regular expressions - JavaScript
se the pattern /ab*c/: the * after "b" means "0 or more occurrences of the preceding item." In the string "cbbabbbbcdebc", this pattern will match the substring "abbbbc". The following pages provide lists of the different special characters that fit into each category, along with descriptions and examples. Assertions Assertions include boundaries, which indicate the beginnings and endings of lines and words, and other patterns indicating in some way that a match is possible (including look-ahead, look-behind, and conditional expressions). Character classes Distinguish different types of characters. For example, distinguishing between letters and digits. Groups and ranges Indicate groups and ranges of expression characters. Quantifiers Indicate numbers of characters or expressions to...
...ctionality like global and case insensitive searching. These flags can be used separately or together in any order, and are included as part of the regular expression. Regular expression flags Flag Description Corresponding property g Global search. RegExp.prototype.global i Case-insensitive search. RegExp.prototype.ignoreCase m Multi-line search. RegExp.prototype.multiline s Allows . to match newline characters. RegExp.prototype.dotAll u "unicode"; treat a pattern as a sequence of unicode code points. RegExp.prototype.unicode y Perform a "sticky" search that matches starting at the current position in the target string. See sticky. RegExp.prototype.sticky To include a flag wit...
...integral part of a regular expression. They cannot be added or removed later. For example, re = /\w+\s/g creates a regular expression that looks for one or more characters followed by a space, and it looks for this combination throughout the string. var re = /\w+\s/g; var str = 'fee fi fo fum'; var myArray = str.match(re); console.log(myArray); // ["fee ", "fi ", "fo "] You could replace the line: var re = /\w+\s/g; with: var re = new RegExp('\\w+\\s', 'g'); and get the same result. The behavior associated with the g flag is different when the .exec() method is used. The roles of "class" and "argument" get reversed: In the case of .match(), the string class (or data type) owns the method and the regular expression is just an argument, while in the case of .exec(), it is the regula...
...And 4 more matches
RegExp - JavaScript
RegExp properties. Constructor RegExp() Creates a new RegExp object. Static properties get RegExp[@@species] The constructor function that is used to create derived objects. RegExp.lastIndex The index at which to start the next match. Instance properties RegExp.prototype.flags A string that contains the flags of the RegExp object. RegExp.prototype.dotAll Whether . matches newlines or not. RegExp.prototype.global Whether to test the regular expression against all possible matches in a string, or only against the first. RegExp.prototype.ignoreCase Whether to ignore case while attempting a match in a string. RegExp.prototype.multiline Whether or not to search in strings across multiple lines. RegExp.prototype.source The text of the pattern. RegExp.prototype.sticky ...
... a name in the format first last and output it in the format last, first. In the replacement text, the script uses $1 and $2 to indicate the results of the corresponding matching parentheses in the regular expression pattern. let re = /(\w+)\s(\w+)/ let str = 'John Smith' let newstr = str.replace(re, '$2, $1') console.log(newstr) This displays "Smith, John". ...
... first last and output it in the format last, first. In the replacement text, the script uses $1 and $2 to indicate the results of the corresponding matching parentheses in the regular expression pattern. let re = /(\w+)\s(\w+)/ let str = 'John Smith' let newstr = str.replace(re, '$2, $1') console.log(newstr) This displays "Smith, John". ...
...And 4 more matches
Progressive web apps (PWAs)
ke secure transactions. Most of the features related to a PWA such as geolocation and even service workers are available only once the app has been loaded using HTTPS. Service workers A service worker is a script that allows intercepting and control of how a web browser handles its network requests and asset caching. With service workers, web developers can create reliably fast web pages and offline experiences. Manifest file A JSON file that controls how your app appears to the user and ensures that progressive web apps are discoverable. It describes the name of the app, the start URL, icons, and all of the other details necessary to transform the website into an app-like format. PWA advantages PWAs should be discoverable, installable, linkable, network independent, progressive, re-eng...
...Allowing the user to install the web app on their home screen is even better. But instead of relying only on user actions, we can do more, using push messages and notifications to automatically re-engage and deliver new content whenever it is available.Introduction to progressive web appsThis article provides an introduction to Progressive Web Apps (PWAs), discussing what they...
...creen is even better. But instead of relying only on user actions, we can do more, using push messages and notifications to automatically re-engage and deliver new content whenever it is available.Introduction to progressive web appsThis article provides an introduction to Progressive Web Apps (PWAs), discussing what they are and the advantages they offer over regular web apps.Making PWAs work offline with Service workersIn this article we took a simple look at how you can make your PWA work offline with service workers. Be sure to check out our further documentation if you want to learn more about the concepts behind the Service Worker API and how to use it in more detail. Progressive loadingIn previous articles we covered APIs that help us make our js13kPWA example a Progressive Web App:...
...And 4 more matches
points - SVG: Scalable Vector Graphics
Web › SVG › Attribute › points
The points attribute defines a list of points. Each point is defined by a pair of number representing a X and a Y coordinate in the user coordinate system. If the attribute contains an odd number of coordinates, the last one will be ignored. ...
...defines a list of points. Each point is defined by a pair of number representing a X and a Y coordinate in the user coordinate system. If the attribute contains an odd number of coordinates, the last one will be ignored. Two elements are using this attribute: <polyline>, and <polygon> html,body,svg { height:100% } <svg viewBox="-10 -10 220 120" xmlns="http://www.w3.org/2000/svg"> <!-- polyline is an open shape --> <polyline stroke="black" fill="none" points="50,0 21,90 98,35 2,35 79,90"/> <!-- polygon is a closed shape --> <polygon stroke="black" fill="none" transform="translate(100,0)" points="50,0 21,90 98,35 2,35 79,90"/> <!-- It is usualy considered best practices to separate a X and Y coordinate with a comma and a group of coordinates by a space. It makes thi...
...ne" points="50,0 21,90 98,35 2,35 79,90"/> <!-- polygon is a closed shape --> <polygon stroke="black" fill="none" transform="translate(100,0)" points="50,0 21,90 98,35 2,35 79,90"/> <!-- It is usualy considered best practices to separate a X and Y coordinate with a comma and a group of coordinates by a space. It makes things more readable for human beings. --> </svg> polyline For <polyline>, points defines a list of points, each representing a vertex of the line to be drawn. Each point is define by a X and Y coordinate in the user coordinate system. Note: A polyline is an open shape, meaning the last point is not connected to the first point. Value [ <number>+ ]# Default value none Animatable Yes Example html,body,svg { ...
...And 4 more matches
requiredFeatures - SVG: Scalable Vector Graphics
itch on the given element whether to render the element or not. To detect availability of an SVG feature from script, there is the (also deprecated) DOMImplementation.hasFeature() method. ...
...ement or not. To detect availability of an SVG feature from script, there is the (also deprecated) DOMImplementation.hasFeature() method. ...
...guage attributes http://www.w3.org/TR/SVG11/feature#Image The browser supports the <image> element. http://www.w3.org/TR/SVG11/feature#Style The browser supports the <style> element. http://www.w3.org/TR/SVG11/feature#ViewportAttribute The browser supports the clip and overflow attributes. http://www.w3.org/TR/SVG11/feature#Shape The browser supports the <rect>, <circle>, <line>, <polyline>, <polygon>, <ellipse> and <path> elements. http://www.w3.org/TR/SVG11/feature#Text The browser supports the <text>, <tspan>, <tref>, <textPath>, <altGlyph>, <altGlyphDef>, <altGlyphItem> and <glyphRef> elements. http://www.w3.org/TR/SVG11/feature#BasicText The browser supports the <text> element http://www.w3.org/TR/SVG11/feature#PaintAttribute The browser supports ...
...And 4 more matches
stroke-miterlimit - SVG: Scalable Vector Graphics
limit on the ratio of the miter length to the stroke-width used to draw a miter join. When the limit is exceeded, the join is converted from a miter to a bevel. Note: As a presentation attribute stroke-miterlimit can be used as a CSS property. ...
...operty. ...
...p://www.w3.org/2000/svg"> <!-- Impact of the default miter limit --> <path stroke="black" fill="none" stroke-linejoin="miter" id="p1" d="M1,9 l7 ,-3 l7 ,3 m2,0 l3.5 ,-3 l3.5 ,3 m2,0 l2 ,-3 l2 ,3 m2,0 l0.75,-3 l0.75,3 m2,0 l0.5 ,-3 l0.5 ,3" /> <!-- Impact of the smallest miter limit (1) --> <path stroke="black" fill="none" stroke-linejoin="miter" stroke-miterlimit="1" id="p2" d="M1,19 l7 ,-3 l7 ,3 m2, 0 l3.5 ,-3 l3.5 ,3 m2, 0 l2 ,-3 l2 ,3 m2, 0 l0.75,-3 l0.75,3 m2, 0 l0.5 ,-3 l0.5 ,3" /> <!-- Impact of a large miter limit (8) --> <path stroke="black" fill="none" stroke-linejoin="miter" stroke-miterlimit="8" id="p3" d="M1,29 l7 ,-3 l7 ,...
...And 4 more matches
x1 - SVG: Scalable Vector Graphics
Web › SVG › Attribute › x1
The x1 attribute is used to specify the first x-coordinate for drawing an SVG element that requires more than one coordinate. Elements that only need one coordinate use the x attribute instead. Two elements are using this attribute: <line>, and <linearGradient> html,body,svg { height:100% } <svg viewBox="0 0 10 10" xmlns="http://www.w3.org/2000/svg"> <line x1="1" x2="5" y1="1" y2="9" stroke="red" /> <line x1="5" x2="5" y1="1" y2="9" stroke="green" /> <line x1="9" x2="5" y1="1" y2="9" stroke="blue" /> </svg> line For <line>, x1 defines the x coordinate of the starting point of the line. Value <length> | <percentage> Default value 0 Animatable Yes Example html,body,svg { height:100% } <svg viewBox="0 0 10 10" xmlns="http://www.w3.
...="5" x2="5" y1="1" y2="9" stroke="green" /> <line x1="9" x2="5" y1="1" y2="9" stroke="blue" /> </svg> line For <line>, x1 defines the x coordinate of the starting point of the line. Value <length> | <percentage> Default value 0 Animatable Yes Example html,body,svg { height:100% } <svg viewBox="0 0 10 10" xmlns="http://www.w3.org/2000/svg"> <line x1="1" x2="5" y1="1" y2="9" stroke="red" /> <line x1="5" x2="5" y1="1" y2="9" stroke="green" /> <line x1="9" x2="5" y1="1" y2="9" stroke="blue" /> </svg> linearGradient For <linearGradient>, x1 defines the x coordinate of the starting point of the gradient vector used to map the gradient stop values. The exact behavior of this attribute is influenced by the gradientUnits attributs ...
...xact behavior of this attribute is influenced by the gradientUnits attributs Value <length> | <percentage> Default value 0% Animatable Yes Example html,body,svg { height:100% } <svg viewBox="0 0 20 10" xmlns="http://www.w3.org/2000/svg"> <!-- By default the gradient vector start at the left bounding limit of the shape it is applied to --> <linearGradient x1="0%" id="g0"> <stop offset="0" stop-color="black" /> <stop offset="100%" stop-color="red" /> </linearGradient> <rect x="1" y="1" width="8" height="8" fill="url(#g0)" /> <!-- Here the gradient vector start at 80% of the left bounding limit of the shape it is applied to --> <linearGradient x1="80%" id="g1"> <stop offset="0" stop-color="black" /> ...
...And 4 more matches
x2 - SVG: Scalable Vector Graphics
Web › SVG › Attribute › x2
The x2 attribute is used to specify the second x-coordinate for drawing an SVG element that requires more than one coordinate. Elements that only need one coordinate use the x attribute instead. Two elements are using this attribute: <line>, and <linearGradient> html,body,svg { height:100% } <svg viewBox="0 0 10 10" xmlns="http://www.w3.org/2000/svg"> <line x1="5" x2="1" y1="1" y2="9" stroke="red" /> <line x1="5" x2="5" y1="1" y2="9" stroke="green" /> <line x1="5" x2="9" y1="1" y2="9" stroke="blue" /> </svg> line For <line>, x2 defines the x coordinate of the ending point of the line. Value <length> | <percentage> Default value 0 Animatable Yes Example html,body,svg { height:100% } <svg viewBox="0 0 10 10" xmlns="http://www.w3.o...
...x1="5" x2="5" y1="1" y2="9" stroke="green" /> <line x1="5" x2="9" y1="1" y2="9" stroke="blue" /> </svg> line For <line>, x2 defines the x coordinate of the ending point of the line. Value <length> | <percentage> Default value 0 Animatable Yes Example html,body,svg { height:100% } <svg viewBox="0 0 10 10" xmlns="http://www.w3.org/2000/svg"> <line x1="5" x2="1" y1="1" y2="9" stroke="red" /> <line x1="5" x2="5" y1="1" y2="9" stroke="green" /> <line x1="5" x2="9" y1="1" y2="9" stroke="blue" /> </svg> linearGradient For <linearGradient>, x2 defines the x coordinate of the ending point of the gradient vector used to map the gradient stop values. The exact behavior of this attribute is influenced by the gradientUnits attributs ...
...act behavior of this attribute is influenced by the gradientUnits attributs Value <length> | <percentage> Default value 100% Animatable Yes Example html,body,svg { height:100% } <svg viewBox="0 0 20 10" xmlns="http://www.w3.org/2000/svg"> <!-- By default the gradient vector end at the right bounding limit of the shape it is applied to --> <linearGradient x2="100%" id="g0"> <stop offset="0" stop-color="black" /> <stop offset="100%" stop-color="red" /> </linearGradient> <rect x="1" y="1" width="8" height="8" fill="url(#g0)" /> <!-- Here the gradient vector start at 20% of the left bounding limit of the shape it is applied to --> <linearGradient x2="20%" id="g1"> <stop offset="0" stop-color="black" /> ...
...And 4 more matches
Basic shapes - SVG: Scalable Vector Graphics
vg"> <rect x="10" y="10" width="30" height="30" stroke="black" fill="transparent" stroke-width="5"/> <rect x="60" y="10" rx="10" ry="10" width="30" height="30" stroke="black" fill="transparent" stroke-width="5"/> <circle cx="25" cy="75" r="20" stroke="red" fill="transparent" stroke-width="5"/> <ellipse cx="75" cy="75" rx="20" ry="5" stroke="red" fill="transparent" stroke-width="5"/> <line x1="10" x2="50" y1="110" y2="150" stroke="orange" stroke-width="5"/> <polyline points="60 110 65 120 70 115 75 130 80 125 85 140 90 135 95 150 100 145" stroke="orange" fill="transparent" stroke-width="5"/> <polygon points="50 160 55 180 70 180 60 190 65 205 50 195 35 205 40 190 30 180 45 180" stroke="green" fill="transparent" stroke-width="5"/> <path d="M20,230 Q40,205 50,230 ...
...e> is a more general form of the <circle> element, where you can scale the x and y radius (commonly refferred to as the semimajor and semiminor axes in maths) of the circle separately. <ellipse cx="75" cy="75" rx="20" ry="5"/> rx The x radius of the ellipse. ry The y radius of the ellipse. cx The x position of the center of the ellipse. cy The y position of the center of the ellipse. Line The <line> element takes the positions of two points as parameters and draws a straight line between them. <line x1="10" x2="50" y1="110" y2="150"/> x1 The x position of point 1. y1 The y position of point 1. x2 The x position of point 2. y2 The y position of point 2. Polyline A <polyline> is a group of connected straight lines. Since the list of points can get quite long, all the ...
...two points as parameters and draws a straight line between them. <line x1="10" x2="50" y1="110" y2="150"/> x1 The x position of point 1. y1 The y position of point 1. x2 The x position of point 2. y2 The y position of point 2. Polyline A <polyline> is a group of connected straight lines. Since the list of points can get quite long, all the points are included in one attribute: <polyline points="60, 110 65, 120 70, 115 75, 130 80, 125 85, 140 90, 135 95, 150 100, 145"/> points A list of points. Each number must be separated by a space, comma, EOL, or a line feed character. Each point must contain two numbers: an x coordinate and a y coordinate. So, the list (0,0), (1,1), and (2,2) would be written as 0, 0 1, 1 2, 2. ...
...And 4 more matches
Venkman Internals - Archive of obsolete content
Start with Venkman Information. Notes on Venkman source code. As with any complex application, aspects of the design may not be clear for new readers of the source. These notes are written by such readers: as you learn please correct any errors. Questions Why can't breakpoints be set on some source lines some of the time? Sometimes the source has small ticks in the margin for every executable line in my JavaScript. Sometimes these ticks are missing on some or all lines of a file. Only lines with tick marks seem to break point properly. Venkman asks the JS engine which lines are executable. It will mark these with a "tick" as you call it. If the file is not currently loaded, the JS engine doesn't know anything about the file. You can still set breakpoints, but they will be future b...
...oint right from the jsdScript instead, you wouldn't see it in the Venkman UI, and you might confuse Venkman when the actual breakpoint was hit and it couldn't find a matching breakpoint object. You can see the prototype for this object at http://lxr.mozilla.org/mozilla/sourc...ebugger.js#914 scriptWrapper.jsdScript is the reference to the jsdIScript object for the function. ...
..., and you might confuse Venkman when the actual breakpoint was hit and it couldn't find a matching breakpoint object. You can see the prototype for this object at http://lxr.mozilla.org/mozilla/sourc...ebugger.js#914 scriptWrapper.jsdScript is the reference to the jsdIScript object for the function. sourceContext is the 5 lines of source text before the last instance of the word "function" on the line where this function starts. ...
...And 3 more matches
Using XPInstall to Install Plugins - Archive of obsolete content
he browsing environment to launch a binary installer (the classic setup.exe experience on Windows) or obliging the user to restart their browser. For plugin vendors who have already written a native code (e.g. EXE) installer, XPInstall can wrap this native installer and run it so that the user never has to leave the browsing environment and click on the EXE to run it. This article presents a guideline for improving the plugin installation experience for Netscape Gecko browsers using XPInstall. A Definition of Terms XPInstall is an installer technology, and the name itself stands for "Cross Platform Install" (hence "XP" -- an abbreviation for "Cross Platform"). An XPInstall package is usually called an XPI package for short (and often pronounced "zippy"). This article is about how you can us...
...ased browsers is analogous to SmartUpdate in Netscape Communicator 4.x browsers. Porting SmartUpdate deployments to XPInstall is trivial after gaining some familiarity with the new XPInstall API. The Recommended Installation Process XPInstall provides a cohesive API to accomplish rapid installation and setup of plugin software for end-users. The benefit of using XPInstall is to provide a streamlined installation mechanism. This section discusses what an ideal XPInstall Package will do, as well as points out some of the JavaScript API calls that you will make to accomplish these install tasks. An ideal XPI Package will: Install to the current browser that is initiating the XPInstall installation via HTML or triggering an XPInstall installation via a Trigger Script. We will use the term cur...
...ows System Registry to disclose this secondary location. This section traces some of the XPInstall APIs that can do this. A complete template of an XPI Package is also presented in this section. Not all the work needs to be done in JavaScript -- if you have a native installer (EXE) that recognizes Netscape Gecko browsers, and you merely wish to wrap the EXE installer in an XPI Package for a streamlined delivery to the client, you can easily do so. This section refers extensively to the XPInstall API Documentation. Initializing Installation with Plugin Identifier All XPInstall installations are initiated with the initInstall method of the Install Object. Since the Install Object is available to the install script, it need not be mentioned in the install script (e.g. there is no need to invok...
...And 3 more matches
Broadcasters and Observers - Archive of obsolete content
adcaster. Broadcasters support attribute forwarding in the same way that commands do. They work the same as commands except that a command is used for actions, while a broadcaster is instead used for holding state information. For example, a command would be used for an action such as Back, Cut or Delete. A broadcaster would be used to hold, for instance, a flag to indicate whether the user was online or not. In the former case, menu items and toolbar buttons would need to be disabled when there was no page to go back to, or no text to cut or delete. In the latter case, various user interface elements might need to update when the user switches from offline mode to online mode. The simplest broadcaster is shown below. You should always use an id attribute so that it can be referred to by othe...
...ttons would need to be disabled when there was no page to go back to, or no text to cut or delete. In the latter case, various user interface elements might need to update when the user switches from offline mode to online mode. The simplest broadcaster is shown below. You should always use an id attribute so that it can be referred to by other elements. <broadcasterset> <broadcaster id="isOffline" label="Offline"/> </broadcasterset> Any elements that are watching the broadcaster will be modified automatically whenever the broadcaster has its label attribute changed. This results in these elements having a new label. Like other non-displayed elements, the broadcasterset element serves as a placeholder for broadcasters. You should declare all your broadcasters inside a broadcasterset elem...
... together. Making elements observers Elements that are watching the broadcaster are called observers because they observe the state of the broadcaster. To make an element an observer, add an observes attribute to it. This is analogous to using the command attribute when attaching an element to a command element. For example, to make a button an observer of the broadcaster above: <button id="offline_button" observes="isOffline"/> The observes attribute has been placed on the button and its value has been set to the value of the id on the broadcaster to observe. Here the button will observe the broadcaster which has the id isOffline, which is the one defined earlier. If the value of the label attribute on the broadcaster changes, the observers will update the values of their label attribute...
...And 3 more matches
Input Controls - Archive of obsolete content
, several different kinds of fields can be created with the input element, in XUL there are separate elements for each type. 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. HTML also has a textarea element for creating a larger text entry area. In XUL, you can use the textbox element for this purpose as well -- two separate elements are not necessary. If you set the multiline attribute to true, the text entry field will display multiple rows. Example 2 :...
...This should be set to the number of rows and columns of characters to display. Our find files example Let's add a search entry field to the find file dialog. ...
...This should be set to the number of rows and columns of characters to display. ...
...And 3 more matches
XUL accessibility tool - Archive of obsolete content
General Information The XUL Accessibility Tool is a Firefox extension designed by Aaron Andersen of WebAIM as part of a Mozilla Foundation accessibility minigrant in the spring of 2007. It is designed to test (insofar as automated testing is possible) the guidelines and requirement for creating accessible XUL as set forth in the XUL accessibility guidelines, and to report on any problems found in tested documents. While not meant to be a comprehensive test suite (meaning that passing all included tests does not guarantee that an application is free of accessibility bugs or issues), many of the most common accessibility mistakes will be found and reported. Availability The XUL Accessibility Tool can currently be obtained from [http://www.xulplanet.com/aaron/files...bilitytool.xpi]. Fut...
...e speed of your machine. Future Work The following things have been suggested or are planned for a future version of the tool: New Tests: (aaronlev) Warning: hardcoded color and pixel sizings (aaronlev) Error: Duplicate accesskey in a dialog (already have this for menus) (aaronlev) Error: form control without accesskey (aaronlev) Warning: Accesskey as lowercase letter with descender (underlined g,j,y,q,p are hard to read, not recommended) (aaronandy) List of things to check manually, such as a list oftrees in the document (make sure they have accessible column picker equivs) or a list of toolbarbuttons (make sure they have accessible alternatives). New Features: (aaronlev) Automatically test any new windows as they are opened. (aaronandy) Highlight or blink source element in orig...
...mended) (aaronandy) List of things to check manually, such as a list oftrees in the document (make sure they have accessible column picker equivs) or a list of toolbarbuttons (make sure they have accessible alternatives). New Features: (aaronlev) Automatically test any new windows as they are opened. (aaronandy) Highlight or blink source element in original XUL app upon click of referencing line in report. (aaronlev) Compatibility with more XUL Applications. (aaronandy) Maybe an online tool to automatically generate a XUL A11y Tool compatible with a user-specified XUL app. (aaronandy) Link report sections to relevant part of XUL A11y Guidelines. (aaronandy) Enable tabs, context menu, and other browser extras in report window. (aaronandy) XUL Runner version that can run from the comma...
...And 3 more matches
application/http-index-format specification - Archive of obsolete content
The application/http-index-format file format is an attempt to provide a generic, extensible file listing format that is principly machine readable. Syntax Every line in the file must conform to the following generic syntax: NUMBER: DATA where NUMBER is at least a three digit number (note that more digits are possible in the future) and DATA is separated from NUMBER by a colon and a space. The syntax of DATA is defined by the syntax spec for every NUMBER type. If a NUMBER is encountered that a parser does not understand the parser is required to ignore that line. There is no line length limit. All lines must be terminated by a carriage return followed by a line feed. NUMBER codes 100 A human readable comment line. Machine parsers should ignore this data. This data is not inte...
...This data is intended for the end user of the file format data if there is one. ...
... This data is not intended for display to the end user and is only meant as a comment to make the file format clear to a human interpreter. 101 Pre formatted human readable information line. This data is intended for the end user of the file format data if there is one. This data should be presented to the user when they are viewing data drawn from the file. 102 A human readable information line in HTML format. This data is intended for the end user of the file format data if there is one. This data should be presented to the user when they are viewing data drawn from the file. ...
...And 3 more matches
Examples - Archive of obsolete content
to test these examples by yourself, you must use the right filename extension (it is written at the beginning of the code). Ideally, upload the file to a web server and you're done. Please note that the examples 4, 5 and 6 require a file named style.css to exist in the same directory as the example. You can get the contents of style.css at the bottom of this page. Examples for "Problems with Inline style and script" Problem 1 <!-- This file should have a .xhtml extension and will generate an error when parsed. --> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en-US" xml:lang="en-US"> <head> <title>Problem 1 - &lt; in XHTML</title> <meta http-equiv="Content-Type" c...
...or: yellow; } --> </style> <script type="text/javascript"> <!-- var i = 0; var sum = 0; for (i = 0; i < 10; ++i) { sum += i; } alert('sum = ' + sum); // --> </script> </head> <body> <h1>Problem 2 - Comments in XHTML</h1> <p> This document is valid XHTML 1.0 Strict served as <code>application/xhtml+xml</code>. </p> <p> This document contains inline CSS rules contained in a <code>style</code> element and surrounded by a Comment and JavaScript contained in a <code>script</code> element and surrounded by a Comment. </p> <dl> <dt>Mozilla 1.1+/Opera 7</dt> <dd>Do not apply CSS or execute the JavaScript.</dd> <dt>Netscape 7.0x/Mozilla 1.0.x</dt> <dd>Do not apply CSS but does execute the JavaScript.</dd> <dt>Internet Explorer ...
...ication/xhtml+xml; charset=utf-8" /> <script type="text/javascript"> var i; var sum = 0; for (i = 10; i > 0; --i) { sum += i; } </script> </head> <body> <h1>Problem 3 - Comments in XHTML</h1> <p> This document is not well formed XHTML due to the double dash contained in the Comment. ...
...And 3 more matches
Choosing Standards Compliance Over Proprietary Practices - Archive of obsolete content
lows them to more easily plan and predict. With processes, organizations can make release schedules, implement marketing plans, analyze resource allocations, and make adjustments when needed. Adherence to standards and processes can actually provide a level of flexibility because development does become predictable. In addition to predictability, standard processes improve understanding and streamline costs. Common Development Process As an organization matures, managers and engineers develop a fundamental understanding of the importance of requiring adherence to these processes. When projects are proposed, they are evaluated to ensure compatibility with the overall business strategy. Product marketing must then analyze the marketability of the application/product, and then conduct in-depth ...
...is process is not unique: most organizations have basic project management processes for product or service. Even within organizations, their processes are fine-tuned to work within the existing culture. When this happens, a development standard is created and is expected to be followed. It is easy to get caught up in the process and forget why organizations have these processes in place. Bottom line, organizations have them because they save money, time, and resources. Sure, there are other reasons -- accountability, checkpoints, and scheduling, for example. The end result, however, is having a process in place that maximizes the organization's investment. Other Standards It is also important to follow other types of standards across an organization. There are numerous standards organizati...
...s investment. Other Standards It is also important to follow other types of standards across an organization. There are numerous standards organizations that affect how and why we do what we do. For example, in the accounting arena there is FASB (Financial Accounting Standards Board) and IASB (International Accounting Standards Board). All businesses are expected and required to follow the guidelines set forth by the FASB. When auditors evaluate an organizations financial health, they do so by following the FASB rules. Focusing on the software development portion of an organization, there are numerous standards bodies that can affect development decisions. For example, if an organization is developing a web-based client, they may have to adhere to standards imposed by these organizations: ...
...And 3 more matches
Building up a basic demo with PlayCanvas editor - Game development
This can be a more pleasant working environment if you are not someone who likes to code. Creating an account The PlayCanvas Editor is free -- all you have to do to begin with is register your account and login: When you first sign up, you are taken straight into the editor and given a simple starter tutorial involving editing a 3D rolling ball game. You can finish this before you continue our tutorial if you like. ...
...want to load models or start a platform game. We want to start small, so we will use the empty project -- click on the Blank Project option and enter a name for it (we are using "MDN Games demo".) Enter a description if you want -- it is optional. Click Create to have it created. Next you'll see your project's page -- there's not much yet. By clicking the Editor button we'll launch the online PlayCanvas editor where we'll create our scene with the shapes. Do this now. Creating the scene Here's how the scene looks initially in the editor. Even though it's a blank new project we don't have to start entirely from scratch -- the camera and directional light are prepared already, so you don't have to worry about them. Now onto the creative part. To add an entity to the scene you hav...
... Click on the big Add Entity (plus) button and select cylinder from the dropdown list -- it will add a new cylinder shape to the scene. Now follow the same steps as we did before when coloring the cube: Create a new material using the Add Asset (plus) button. Make sure the New Material in the Assets panel is selected, to bring up the entity inspector. Give the material a new name, along the lines of cylinderMaterial. Click diffuse, then click the color picker -- give it an orange color (we used FF9500.) Drag and drop the cylinderMaterial icon onto the cylinder object on the sceene to apply that color. Follow the same approach again to add a cone to the scene, giving it a grayish color (we used EAEFF2.) You should now have three shapes on your scene, something like the below screens...
...And 3 more matches
Animations and tweens - Game development
e how to implement Phaser animations and tweens in our game. Animations In Phaser, animations, involve taking a spritesheet from an external source and displaying the sprites sequentially. As an example, we will make the ball wobble when it hits something. First of all, grab the spritesheet from Github and save it in your /img directory. Next, we will load the spritesheet -- put the following line at the bottom of your preload() function: game.load.spritesheet('ball', 'img/wobble.png', 20, 20); Instead of loading a single image of the ball we can load the whole spritesheet -- a collection of different images. We will show the sprites sequentially to create the illusion of animation. The spritesheet() method's two extra paremeters determine the width and height of each single frame in th...
...itesheet -- a collection of different images. We will show the sprites sequentially to create the illusion of animation. The spritesheet() method's two extra paremeters determine the width and height of each single frame in the given spritesheet file, indicating to the program how to chop it up to get the individual frames. ...
...1, and 2. The above array says that we are displaying frame 0, then 1, then 0, etc. The framerate, in fps. Since we are running the animation at 24fps and there are 9 frames, the animation will display just under three times per second. ...
...And 3 more matches
Test your skills: HTML accessibility - Learn web development
If you get stuck, then ask us for help -- see the Assessment or further help section at the bottom of this page. HTML accessibility 1 In this task we will test your understanding of text semantics, and why they are good for accessibility. ...
...e information panel with action buttons, but the HTML is really bad. We want you to update it use appropriate semantic HTML. You don't need to worry too much about recreating the exact same look and text sizing, as long as the semantics are good. Try updating the live code below to recreate the finished example: Download the starting point for this task to work in your own editor or in an online editor. HTML accessibility 2 In the second task, you have a form containing three input fields. You need to: Semantically associate the input with their labels. Assume that these inputs will be part of a larger form, and wrap them in an element that associates them all together as a single related group. Give the group a description/title that summarises all of the information as personal...
...labels. Assume that these inputs will be part of a larger form, and wrap them in an element that associates them all together as a single related group. Give the group a description/title that summarises all of the information as personal data. Try updating the live code below to recreate the finished example: Download the starting point for this task to work in your own editor or in an online editor. HTML accessibility 3 In this task you are required to turn all the information links in the paragraph into good, accessible links. The first two links just go to regular web pages. The third link goes to a PDF, and it's large -- 8MB. The fourth link goes to a Word document, so the user will need some kind of application installed that can handle that. Try updating the live code ...
...And 3 more matches
What is accessibility? - Learn web development
Notes Designing with cognitive accessibility will lead to good design practices. They will b...
...easy as possible without compromising security; and making forms easy to complete, such as with clear error messages and simple error recovery. Notes Designing with cognitive accessibility will lead to good design practices. They will benefit everyone. Many people with cognitive impairments also have physical disabilities. Websites must conform with the W3C's Web Content Accessibility Guidelines, including cognitive accessibility guidelines. The W3C's Cognitive and Learning Disabilities Accessibility Task Force produces web accessibility guidelines for people with cognitive impairments. WebAIM has a Cognitive page of relevant information and resources. The United States Centers for Disease Control estimate that, as of 2018, 1 in 4 U.S. citizens have a disability and, of them, cogniti...
... a lot of accessibility best practices benefit everyone, not just users with disabilities. For example, lean semantic markup is not only good for screen readers, but it is also fast to load and performant. This benefits everyone, especially those on mobile devices and/or slow connections. Publish an accessibility statement on your site and engage with people having problems. Accessibility guidelines and the law There are numerous checklists and sets of guidelines available for basing accessibility tests on, which might seem overwhelming at first glance. Our advice is to familiarize yourself with the basic areas in which you need to take care, as well as understanding the high-level structures of the guidelines that are most relevant to you. For a start, the W3C has published a large and...
...And 3 more matches
Organizing your CSS - Learn web development
taining consistent formatting (for example will you use tabs or spaces to indent your code? If spaces, how many spaces?) Having a set of rules you always follow reduces the amount of mental overhead needed when writing CSS, as some of the decisions are already made. Formatting readable CSS There are a couple of ways you will see CSS formatted. Some developers put all of the rules onto a single line, like so: .box { background-color: #567895; } h2 { background-color: black; color: white; } Other developers prefer to break everything onto a new line: .box { background-color: #567895; } h2 { background-color: black; color: white; } CSS doesn't mind which one you use. We personally find it is more readable to have each property and value pair on a new line. Comment your CSS Adding ...
...kground-color: black; color: white; } CSS doesn't mind which one you use. We personally find it is more readable to have each property and value pair on a new line. Comment your CSS Adding comments to your CSS will help any future developer work with your CSS file, but will also help you when you come back to the project after a break. /* This is a CSS comment It can be broken onto multiple lines. */ A good tip is to add a block of comments between logical sections in your stylesheet too, to help locate different sections quickly when scanning through, or even give you something to search for to jump right into that part of the CSS. If you use a string which won't appear in the code you can jump from section to section by searching for it -- below we have used ||. /* || General styles ...
...o comment every single thing in your CSS, as much of it will be self-explanatory. What you should comment are the things where you made a particular decision for a reason. You may have used a CSS property in a specific way to get around older browser incompatibilities, for example: .box { background-color: red; /* fallback for older browsers that don't support gradients */ background-image: linear-gradient(to right, #ff0000, #aa0000); } Perhaps you followed a tutorial to achieve something, and the CSS is a little non-obvious. In that case you could add the URL of the tutorial to the comments. You will thank yourself when you come back to this project in a year or so, and can vaguely remember there was a great tutorial about that thing, but where is it? Create logical sections in your ...
...And 3 more matches
Pseudo-classes and pseudo-elements - Learn web development
rather than applying a class to existing elements. Pseudo-elements start with a double colon ::. ::pseudo-element-name Note: Some early pseudo-elements used the single colon syntax, so you may sometimes see this in code or examples. Modern browsers support the early pseudo-elements with single- or double-colon syntax for backwards compatibility. ...
... the early pseudo-elements with single- or double-colon syntax for backwards compatibility. For example, if you wanted to select the first line of a paragraph you could wrap it in a <span> element and use an element selector; however, that would fail if the number of words you had wrapped were longer or shorter than the parent element's width. As we tend not to know how many words will fit on a line -- as that will change if the screen width or font-size changes -- it is impossible to robustly do this by adding HTML. ...
...st line of a paragraph you could wrap it in a <span> element and use an element selector; however, that would fail if the number of words you had wrapped were longer or shorter than the parent element's width. As we tend not to know how many words will fit on a line -- as that will change if the screen width or font-size changes -- it is impossible to robustly do this by adding HTML. The ::first-line pseudo-element selector will do this for you reliably -- if the number of words increases and decreases it will still only select the first line. It acts as if a <span> was magically wrapped around that first formatted line, and updated each time the line length changed. You can see that this selects the first line of both paragraphs. Combining pseudo-classes and pseudo-elements If you want...
...And 3 more matches
Test your skills: sizing - Learn web development
If you get stuck, then ask us for help -- see the Assessment or further help section at the bottom of this page. Task One In this task, you have two boxes. ...
...ving the content from the HTML to make sure you still get a 100 pixel tall box even with no content. The second box should be fixed at 100 pixels tall, so that content will overflow if there is too much. ...
... Task Three This task has two images in boxes. ...
...And 3 more matches
Styling tables - Learn web development
Let's work through styling our table example together. To start with, make a local copy of the sample markup, download both images (noise and leopardskin), and put the three resulting files in a working directory somewhere on your local computer. Next, create a new file called style.css and save it in the same directory as your other files. ...
...ave set a global sans-serif font stack; this is purely a stylistic choice. We've also set our custom font on the headings inside the <thead> and <tfoot> elements, for a nice grungy, punky look. We've set some letter-spacing on the headings and cells, as we feel it aids readability. Again, mostly a stylistic choice. We've center-aligned the text in the table cells inside the <tbody> so that they line up with the headings. By default, cells are given a text-align value of left, and headings are given a value of center, but generally it looks better to have the alignments set the same for both. The default bold weight on the heading fonts is enough to differentiate their look. We've right-aligned the heading inside the <tfoot> so that it is visually associated better with its data point. The...
...ght imposing styling to suit. Don't worry, you don't have to make your tables this loud -- you can opt for something more subtle and tasteful. Start by adding the following CSS to your style.css file, again at the bottom: /* graphics and colors */ thead, tfoot { background: url(leopardskin.jpg); color: white; text-shadow: 1px 1px 1px black; } thead th, tfoot th, tfoot td { background: linear-gradient(to bottom, rgba(0,0,0,0.1), rgba(0,0,0,0.5)); border: 3px solid purple; } Again, there's nothing specific to tables here, but it is worthwhile to note a few things. We've added a background-image to the <thead> and <tfoot>, and changed the color of all the text inside the header and footer to white (and given it a text-shadow) so it is readable. You should always make sure your te...
...And 3 more matches
Test your skills: Grid Layout - Learn web development
This aim of this task is to get you working with CSS Grid Layout, and test that you understand how a grid and grid items behave. You will be working through three small tasks which use different elements of the material you have just covered. Note: You can try out solutions in the interactive editors below, however it may be helpful to download the code and use an online tool such as CodePen, jsFiddle, or Glitch to work on the tasks. If you get stuck, then ask us for help -- see the Assessment or further help section at the bottom of this page. Grid Layout One In this task you should create a grid into which the four child elements will auto-place. The grid should have three columns sharing the available space equally, and a 20-pixel gap between the column and row tracks. Try upd...
...k you should create a grid into which the four child elements will auto-place. The grid should have three columns sharing the available space equally, and a 20-pixel gap between the column and row tracks. Try updating the live code below to recreate the finished example: For assessment or further work purposes, download the starting point for this task to work in your own editor or in an online editor. Grid Layout Two In this example we already have a grid defined. By editing the CSS rules for the two child elements, cause them to span over several grid tracks each; the second item should overlay the first as in the image below. Try updating the live code below to recreate the finished example: Additional questions: Can you now cause the first item to display on top without ...
...racks each; the second item should overlay the first as in the image below. Try updating the live code below to recreate the finished example: Additional questions: Can you now cause the first item to display on top without changing the order of items in the source? For assessment or further work purposes, download the starting point for this task to work in your own editor or in an online editor. Grid Layout Three There are four direct children in this grid; the starting point has them displayed using auto-placement. Use the grid-area and grid-template-areas properties to lay the items out as shown in the image. Try updating the live code below to recreate the finished example: For assessment or further work purposes, download the starting point for this task to work in ...
...And 3 more matches
Typesetting a community school homepage - Learn web development
t comprehension of CSS text styling techniques. Starting point To get this assessment started, you should: Go and grab the HTML and CSS files for the exercise, and the provided external link icon. Make a copy of them on your local computer. Alternatively, you could use a site like JSBin or Glitch to do your assessment. You could paste the HTML and fill in the CSS into one of these online editors, and use this URL to point the background image. If the online editor you are using doesn't have a separate CSS panel, feel free to put it in a <style> element in the head of the document. Note: If you get stuck, then ask us for help -- see the Assessment or further help section at the bottom of this page. Project brief You have been provided with some raw HTML for the homepage of an...
...eadings might be nice. Use a suitable service to generate bulletproof @font-face code for these two fonts. Apply your body font to the whole page, and your heading font to your headings. General text styling: Give the page a site-wide font-size of 10px. Give your headings and other element types appropriate font-sizes defined using a suitable relative unit. Give your body text a suitable line-height. Center your top level heading on the page. Give your headings a little bit of letter-spacing to make them not too too squashed, and allow the letters to breathe a bit. Give your body text some letter-spacing and word-spacing, as appropriate. Give the first paragraph after each heading in the <section> a little bit of text-indentation, say 20px. Links: Give the link, visited, focu...
...low the letters to breathe a bit. Give your body text some letter-spacing and word-spacing, as appropriate. Give the first paragraph after each heading in the <section> a little bit of text-indentation, say 20px. Links: Give the link, visited, focus, and hover states some colors that go with the color of the horizontal bars at the top and bottom of the page. Make it so that links are underlined by default, but when you hover or focus them, the underline disappears. Remove the default focus outline from ALL the links on the page. Give the active state a noticeably different styling so it stands out nicely, but make it still fit in with the overall page design. Make it so that external links have the external link icon inserted next to them. Lists: Make sure the spacing of your l...
...And 3 more matches
Example 1 - Learn web development
<div class="select"> <span class="value">Cherry</span> <ul class="optList hidden"> <li class="option">Cherry</li> <li class="option">Lemon</li> <li class="option">Banana</li> <li class="option">Strawberry</li> <li class="option">Apple</li> </ul> </div> CSS /* --------------- */ /* Required Styles */ /* --------------- */ .select { position: relative; display : inline-block; } .select.active, .select:focus { box-shadow: 0 0 3px 1px #227755; outline: none; } .select .optList { position: absolute; top : 100%; left : 0; } .select .optList.hidden { max-height: 0; visibility: hidden; } /* ------------ */ /* Fancy Styles */ /* ------------ */ .select { font-size : 0.625em; /* 10px */ font-family : Verdana, Arial, sans-serif; -moz-b...
...0.625em; /* 10px */ font-family : Verdana, Arial, sans-serif; -moz-box-sizing : border-box; box-sizing : border-box; padding : 0.1em 2.5em 0.2em 0.5em; /* 1px 25px 2px 5px */ width : 10em; /* 100px */ border : 0.2em solid #000; /* 2px */ border-radius : 0.4em; /* 4px */ box-shadow : 0 0.1em 0.2em rgba(0,0,0,.45); /* 0 1px 2px */ background : #F0F0F0; background : linear-gradient(0deg, #E3E3E3, #fcfcfc 50%, #f0f0f0); } .select .value { display : inline-block; width : 100%; overflow : hidden; white-space : nowrap; text-overflow : ellipsis; vertical-align: top; } .select:after { content : "?"; position: absolute; z-index : 1; height : 100%; width : 2em; /* 20px */ top : 0; right : 0; padding-top : .1em; -moz-box-s...
...class="select active"> <span class="value">Cherry</span> <ul class="optList hidden"> <li class="option">Cherry</li> <li class="option">Lemon</li> <li class="option">Banana</li> <li class="option">Strawberry</li> <li class="option">Apple</li> </ul> </div> CSS /* --------------- */ /* Required Styles */ /* --------------- */ .select { position: relative; display : inline-block; } .select.active, .select:focus { box-shadow: 0 0 3px 1px #227755; outline: none; } .select .optList { position: absolute; top : 100%; left : 0; } .select .optList.hidden { max-height: 0; visibility: hidden; } /* ------------ */ /* Fancy Styles */ /* ------------ */ .select { font-size : 0.625em; /* 10px */ font-family : Verdana, Arial, sans-serif; box-si...
...And 3 more matches
Test your skills: Advanced styling - Learn web development
If you get stuck, then ask us for help -- see the Assessment or further help section at the bottom of this page. ...
...This is due to native OS styling being used in some cases. How can you remove this native styling? Once you've removed the native styling, you'll need to add back one of the features it was providing, to keep same look and feel we originally had. How do you do this? One thing that is inconsistent across browsers (particularly looking at Safari here) is the position of the standard blue focus outline. How can you remove this? There is a major problem with just getting rid of the blue focus outline. What is it? Can you add some kind of styling back in so that users can tell when the search box is being hovered or focused? Another thing that commonly denotes a search box is a magnifying glass icon. We've made one available in the same directory as our HTML files -- see search-24px.png -- plus...
...ed or focused? Another thing that commonly denotes a search box is a magnifying glass icon. We've made one available in the same directory as our HTML files -- see search-24px.png -- plus a <div> element after the search input to help you attach it, should you need it. Can you figure out a sensible way to attach it, and can you use some CSS to get it to sit to the right of the search box, and be lined up vertically as well? Try updating the live code below to recreate the finished example: Download the starting point for this task to work in your own editor or in an online editor. Advanced form styling 2 In our next task we provide you with a set of three radio buttons. We want you to give them custom styling. We've already provided you with a basic reset to build upon. First of ...
...And 3 more matches
Your first form - Learn web development
er in the module), or used on the client-side to immediately update the interface in some way (for example, add another item to a list, or show or hide a UI feature). A web form's HTML is made up of one or more form controls (sometimes called widgets), plus some additional elements to help structure the overall form -- they are often referred to as HTML forms. The controls can be single or multi-line text fields, dropdown boxes, buttons, checkboxes, or radio buttons, and are mostly created using the <input> element, although there are some other elements to learn about too. Form controls can also be programmed to enforce specific formats or values to be entered (form validation), and paired with text labels that describe their purpose to both sighted and blind users. Designing your form Be...
... data with (usually get or post). Note: We'll look at how those attributes work in our Sending form data article later on. For now, add the above <form> element into your HTML <body>. The <label>, <input>, and <textarea> elements Our contact form is not complex: the data entry portion contains three text fields, each with a corresponding <label>: The input field for the name is a single-line text field. The input field for the e-mail is an input of type email: a single-line text field that accepts only e-mail addresses. The input field for the message is a <textarea>; a multiline text field. In terms of HTML code we need something like the following to implement these form widgets: <form action="/my-handling-form-page" method="post"> <ul> <li> <label for="name">Name:</lab...
...input> element, the most important attribute is the type attribute. This attribute is extremely important because it defines the way the <input> element appears and behaves. You'll find more about this in the Basic native form controls article later on. In our simple example, we use the value <input/text> for the first input -- the default value for this attribute. It represents a basic single-line text field that accepts any kind of text input. For the second input, we use the value <input/email>, which defines a single-line text field that only accepts a well-formed e-mail address. This turns a basic text field into a kind of "intelligent" field that will perform some validation checks on the data typed by the user. It also causes a more appropriate keyboard layout for entering email add...
...And 3 more matches
Test your skills: Links - Learn web development
If you get stuck, then ask us for help -- see the Assessment or further help section at the bottom of this page. ...
...as the current page. We'd also like you to give it a tooltip when moused over that tells the user that the page includes information on Blue Whales and Sperm Whales. The second link should be turned into a link you can click to open up an email in the user's default mail application, with the recipient set as "whales@example.com". You'll get a bonus point if you also set it so that the subject line of the email is automatically filled in as "Question about Whales". Note: The first link in the example has the target="_blank" attribute set on it, so that when you click on it, it opens the page in a new tab. This is not strictly best practice, but we've done it here so that the page doesn't open in the embedded <iframe>, getting rid of your example code in the process! Try updating the li...
...attribute set on it, so that when you click on it, it opens the page in a new tab. This is not strictly best practice, but we've done it here so that the page doesn't open in the embedded <iframe>, getting rid of your example code in the process! Try updating the live code below to recreate the finished example: Download the starting point for this task to work in your own editor or in an online editor. Links 2 In this task we want you to fill in the four links so that they link to the appropriate places: The first link should link to an image called blue-whale.jpg, which is located in a directory called blue inside the current directory. The second link should link to an image called narwhal.jpg, which is located in a directory called narwhal, which is located one directory level...
...And 3 more matches
Making asynchronous programming easier with async and await - Learn web development
them. The basics of async/await There are two parts to using async/await in your code. The async keyword First of all we have the async keyword, which you put in front of a function declaration to turn it into an async function. An async function is a function that knows how to expect the possibility of the await keyword being used to invoke asynchronous code. Try typing the following lines into your browser's JS console: function hello() { return "Hello" }; hello(); The function returns "Hello" -- nothing special, right? But what if we turn this into an async function? Try the following: async function hello() { return "Hello" }; hello(); Ah. Invoking the function now returns a promise. This is one of the traits of async functions -- their return values are guaranteed to be c...
.... By only adding the necessary handling when the function is declared async, the JavaScript engine can optimize your program for you. Sweet! The await keyword The real advantage of async functions becomes apparent when you combine it with the await keyword -- in fact, await only works inside async functions. This can be put in front of any async promise-based function to pause your code on that line until the promise fulfills, then return the resulting value. In the meantime, other code that may be waiting for a chance to execute gets to do so. You can use await when calling any function that returns a Promise, including web API functions. Here is a trivial example: async function hello() { return greeting = await Promise.resolve("Hello"); }; hello().then(alert); Of course, the above ...
...etch() function definition you can see that the code closely resembles the previous promise version, but there are some differences. Instead of needing to chain a .then() block on to the end of each promise-based method, you just need to add an await keyword before the method call, and then assign the result to a variable. The await keyword causes the JavaScript runtime to pause your code on this line, allowing other code to execute in the meantime, until the async function call has returned its result. Once that's complete, your code continues to execute starting on the next line. For example: let response = await fetch('coffee.jpg'); The response returned by the fulfilled fetch() promise is assigned to the response variable when that response becomes available, and the parser pauses on thi...
...And 3 more matches
Test your skills: Conditionals - Learn web development
If you get stuck, then ask us for help -- see the Assessment or further help section at the bottom of this page. ...
...assign a generic string to response that tells the user we don't know what season it is. To finish off, you should then add another test that checks whether season contains the string "winter", and again assigns an appropriate string to response. Try updating the live code below to recreate the finished example: Download the starting point for this task to work in your own editor or in an online editor. Conditionals 2 For this task you are given three variables: machineActive -- contains an indicator of whether the answer machine is switched on or not (true/false) score -- Contains your score in an imaginary game. This score is fed into the answer machine, which provides a response to indicate how well you did. response -- begins uninitialized, but is later used to store a repons...
...!" Score of 70 to 89 -- "That\'s a great score, you really know your stuff." Score of 90 to 100 -- "What an amazing score! Did you cheat? Are you for real?" Try updating the live code below to recreate the finished example. After you've entered your code, try changing machineActive to true, to see if it works. Download the starting point for this task to work in your own editor or in an online editor. Conditionals 3 In this task you need to take the code you wrote for the second task, and rewrite the inner if...else if...else to use a switch statement instead. Try updating the live code below to recreate the finished example: Download the starting point for this task to work in your own editor or in an online editor. Conditionals 4 For the final task you are given four varia...
...And 3 more matches
Third-party APIs - Learn web development
article. The purpose of these is so that the user knows what is going on in the websites they visit and is less likely to fall victim to someone using an API in a malicious way. Third party APIs have a slightly different permissions system -- they tend to use developer keys to allow developers access to the API functionality, which is more to protect the API vendor than the user. You'll find a line similar to the following in the Mapquest API example: L.mapquest.key = 'YOUR-API-KEY-HERE'; This line specifies an API or developer key to use in your application -- the developer of the application must apply to get a key, and then include it in their code to be allowed access to the API's functionality. In our example we've just provided a placeholder. Note: When creating your own examples,...
...was called a "consumer key" on the site, and the key creation process also asked for an optional "callback URL". You don't need to fill in a URL here: just leave it blank.) Open up your starting file, and replace the API key placeholder with your key. Changing the type of map There are a number of different types of map that can be shown with the Mapquest API. To do this, find the following line: layers: L.mapquest.tileLayer('map') Try changing 'map' to 'hybrid' to show a hybrid-style map. Try some other values too. The tileLayer reference page shows the different available options, plus a lot more information. Adding different controls The map has a number of different controls available; by default it just shows a zoom control. You can expand the controls available using the map.ad...
...earch term and optional start and end dates, which it will then use to query the Article Search API and display the search results. Connect the API to your app First, you'll need to make a connection between the API and your app. In the case of this API, you need to include the API key as a get parameter every time you request data from the service at the correct URL. Find the following line: let key = ' ... '; Replace the existing API key with the actual API key you got in the previous section. Add the following line to your JavaScript, below the "// Event listeners to control the functionality" comment. This runs a function called submitSearch() when the form is submitted (the button is pressed). searchForm.addEventListener('submit', submitSearch); Now add the ...
...And 3 more matches
Arrays - Learn web development
t the bottom. In the editable example below there are comments containing numbers -- each of these marks a place where you have to add something to the code. They are as follows: Below the // number 1 comment are a number of strings, each one containing a product name and price separated by a colon. We'd like you to turn this into an array and store it in an array called products. On the same line as the // number 2 comment is the beginning of a for loop. In this line we currently have i <= 0, which is a conditional test that causes the for loop to only run once, because it is saying "stop when i is no longer less than or equal to 0", and i starts at 0. We'd like you to replace this with a conditional test that stops the loop when i is no longer less than the products array's length. Just...
...loop. In this line we currently have i <= 0, which is a conditional test that causes the for loop to only run once, because it is saying "stop when i is no longer less than or equal to 0", and i starts at 0. We'd like you to replace this with a conditional test that stops the loop when i is no longer less than the products array's length. Just below the // number 3 comment we want you to write a line of code that splits the current array item (name:price) into two separate items, one containing just the name and one containing just the price. If you are not sure how to do this, consult the Useful string methods article for some help, or even better, look at the Converting between strings and arrays section of this article. ...
... // number 3 comment we want you to write a line of code that splits the current array item (name:price) into two separate items, one containing just the name and one containing just the price. If you are not sure how to do this, consult the Useful string methods article for some help, or even better, look at the Converting between strings and arrays section of this article. As part of the above line of code, you'll also want to convert the price from a string to a number. If you can't remember how to do this, check out the first strings article. There is a variable called total that is created and given a value of 0 at the top of the code. ...
...And 3 more matches
Silly story generator - Learn web development
mewhere on your computer, and do the assessment locally to begin with. This also has the CSS to style the example contained within it. Go to the page containing the raw text and keep this open in a separate browser tab somewhere. You'll need it later. Alternatively, you could use a site like JSBin or Glitch to do your assessment. You could paste the HTML, CSS and JavaScript into one of these online editors. If the online editor you are using doesn't have a separate JavaScript panel, feel free to put it inline in a <script> element inside the HTML page. Note: If you get stuck, then ask us for help -- see the Assessment or further help section at the bottom of this page. Project brief You have been provided with some raw HTML/CSS and a few text strings and JavaScript functions; you need ...
...derneath the heading "3. EVENT LISTENER AND PARTIAL FUNCTION DEFINITION" and paste it into the bottom of your main.js file. This: Adds a click event listener to the randomize variable so that when the button it represents is clicked, the result() function is run. Adds a partially-completed result() function definiton to your code. For the remainder of the assessment, you'll be filling in lines inside this function to complete it and make it work properly. Completing the result() function: Create a new variable called newStory, and set its value to equal storyText. This is needed so we can create a new random story each time the button is pressed and the function is run. If we made changes directly to storyText, we'd only be able to generate a new story once. Create three ne...
...ob in the story with that custom name." Inside the second if block, we are checking to see if the uk radio button has been selected. If so, we want to convert the weight and temperature values in the story from pounds and Fahrenheit into stones and centigrade. What you need to do is as follows: Look up the formulae for converting pounds to stone, and Fahrenheit to centigrade. Inside the line that defines the weight variable, replace 300 with a calculation that converts 300 pounds into stones. Concatenate ' stone' onto the end of the result of the overall Math.round() call. Inside the line that defines the temperature variable, replace 94 with a calculation that converts 94 Fahrenheit into centigrade. Concatenate ' centigrade' onto the end of the result of the overall Math.round() ...
...And 3 more matches
Test your skills: Math - Learn web development
If you get stuck, then ask us for help -- see the Assessment or further help section at the bottom of this page. ...
...rom the last two steps together, storing the result in a variable called finalResult. The product should be 48. If it isn't, you'll have to adjust some of the initial input values. Finally, write a calculation that checks whether finalResult is an even number. Store the result in a variable called evenOddResult. Download the starting point for this task to work in your own editor or in an online editor. Math 2 In the second task you are already provided with two calculations, with the results stored in the variables result and result2. But these results aren't what we want; you'll need to take the calculations and change them to give us what we want. What do we want? After multiplying the two results together and formatting the result to 2 decimal places, the final result should be 1...
...at we want. What do we want? After multiplying the two results together and formatting the result to 2 decimal places, the final result should be 10.42. Try updating the live code below to recreate the finished example, following these steps: Write a calculation that multiplies result and result2 together and assigns the result back to result. This will require assignment shorthand. Write a line of code that takes result and formats it to 2 decimal places, storing the result of this in a variable called finalResult. Check the data type of finalResult using typeof; you'll probably see that it is actually of string type! Write a line of code that converts it to a number type, storing the result in a variable called finalNumber. The value of finalNumber needs to be 10.42. Go back and upda...
...And 3 more matches
Test your skills: Strings - Learn web development
If you get stuck, then ask us for help -- see the Assessment or further help section at the bottom of this page. ...
...ther to make a single string containing the complete quote. Save the result inside a variable called finalQuote. You'll find that you get an error at this point. Can you fix the problem with quoteStart, so that the full quote displays correctly? Try updating the live code below to recreate the finished example: Download the starting point for this task to work in your own editor or in an online editor. Strings 2 In this task you are provided with two variables, quote and substring, which contain two strings. We would like you to: Retrieve the length of the quote, and store it in a variable called quoteLength. Find the index position where substring appears in quote, and store that value in a variable called index. Use a combination of the variables you have and available string...
...e that value in a variable called index. Use a combination of the variables you have and available string properties/methods to trim down the original quote to "I do not like green eggs and ham.", and store it in a variable called revisedQuote. Try updating the live code below to recreate the finished example: Download the starting point for this task to work in your own editor or in an online editor. Strings 3 In the next string task, you are given the same quote that you ended up with in the previous task, but it is somewhat broken! We want you to fix and update it, like so: Change the casing to correct sentence case (all lowercase, except for upper case first letter). Store the new quote in a variable called fixedQuote. In fixedQuote, replace "green eggs and ham" with another...
...And 3 more matches
Test your skills: variables - Learn web development
If you get stuck, then ask us for help -- see the Assessment or further help section at the bottom of this page. ...
...of this page. Note: In the examples below, if there is an error in your code it will be outputted into the results panel on the page, to help you try to figure out the answer (or into the browser's JavaScript console, in the case of the downloadable version). Variables 1 In this task we want you to: Declare a variable called myName. ...
...ge, to help you try to figure out the answer (or into the browser's JavaScript console, in the case of the downloadable version). Variables 1 In this task we want you to: Declare a variable called myName. Initialize myName with a suitable value, on a separate line (you can use your actual name, or something else). Declare a variable called myAge and initialize it with a value, on the same line. Try updating the live code below to recreate the finished example: Download the starting point for this task to work in your own editor or in an online editor. Variables 2 In this task you need to add a new line to correct the value stored in the existing myName variable to your own name. Try updating the live code below to recreate the finished example: Download the starting point...
...And 3 more matches
Ember Interactivity: Footer functionality, conditional rendering - Learn web development
, and correctly apply styling to completed todos (i.e. where the checkbox has been checked). We'll also wire up our "Clear completed" button. Along the way, we'll learn about using conditional rendering in our templates. Prerequisites: At minimum, it is recommended that you are familiar with the core HTML, CSS, and JavaScript languages, and have knowledge of the terminal/command line. A deeper understanding of modern JavaScript features (such as classes, modules, etc), will be extremely beneficial, as Ember makes heavy use of them. Objective: To continue our learning about components classes, start looking at conditional rendering, and wire up some of our footer functionality. Connecting the behavior in the footer To get the footer working, we nee...
..., add the following action underneath the existing add(text) action: @action clearCompleted() { this.todos = this.incomplete; } This is rather nice for clearing the todos -- we just need to set the todos array to equal the list of incomplete todos. Finally, we need to make use of this new functionality in our footer.hbs template. Go to this file now. ...
...ll that in our template. Add the following new getter to todo-data.js, just below the existing getters. Note that here we need this.incomplete.length, not this.todos.incomplete.length, because we are doing this inside the service, where the incomplete() getter is available directly (in the template, the contents of the service has been made available as todos via the @service('todo-data') todos; line inside the footer class, hence it being this.todos.incomplete.length there). get todoCountIsOne() { return this.incomplete.length === 1; } Then go back over to footer.hbs and update the previous template section we edited to the following: <strong>{{this.todos.incomplete.length}}</strong> {{#if this.todos.todoCountIsOne}} todo {{else}} todos {{/if}} left Now save and test,...
...And 3 more matches
Componentizing our React app - Learn web development
ore we can make it do things, we need to break it apart into manageable, descriptive components. React doesn't have any hard rules for what is and isn't a component - that's up to you! In this article we will show you a sensible way to break our app up into components. Prerequisites: Familiarity with the core HTML, CSS, and JavaScript languages, knowledge of the terminal/command line. Objective: To show a sensible way of breaking our todo list app into components. Defining our first component Defining a component can seem tricky until you have some practice, but the gist is: If it represents an obvious "chunk" of your app, it's probably a component If it gets reused often, it's probably a component. That second bullet is especially valuable: maki...
...ake a component, we should create a new file for it. In fact, we should make a directory just for our components. The following commands make a components directory and then, within that, a file called Todo.js. ...
...sure you're in the root of your app before you run these! mkdir src/components touch src/components/Todo.js Our new Todo.js file is currently empty! ...
...And 3 more matches
React interactivity: Events and state - Learn web development
a completely static UI to one that actually allows us to interact and change things. In this article we'll do this, digging into events and state along the way, and ending up with an app in which we can successfully add and delete tasks, and toggle tasks as completed. Prerequisites: Familiarity with the core HTML, CSS, and JavaScript languages, knowledge of the terminal/command line. Objective: To learn about handling events and state in React, and use those to start making the case study app interactive. Handling events If you've only written vanilla JavaScript before now, you might be used to having a separate JavaScript file, where you query for some DOM nodes and attach listeners to them. For example: const btn = document.querySelector('button');...
...s to them. For example: const btn = document.querySelector('button'); btn.addEventListener('click', () => { alert("hi!"); }); In React, we write event handlers directly on the elements in our JSX, like this: <button type="button" onClick={() => alert("hi!")} > Say hi! </button> Note: This may seem counter-intuitive regarding best-practice advice that tends to advise against use of inline event handlers on HTML, but remember that JSX is actually part of your JavaScript. In the above example, we're adding an onClick attribute to the <button> element. The value of that attribute is a function that triggers a simple alert. The onClick attribute has special meaning here: it tells React to run a given function when the user clicks on the button. There are a couple of other things to...
...ent receives; only to read them. React provides a variety of special functions that allow us to provide new capabilities to components, like state. These functions are called hooks, and the useState hook, as its name implies, is precisely the one we need in order to give our component some state. To use a React hook, we need to import it from the react module. In Form.js, change your very first line so that it reads like this: import React, { useState } from "react"; This allows us to import the useState() function by itself, and utilize it anywhere in this file. useState() creates a piece of state for a component, and its only parameter determines the initial value of that state. It returns two things: the state, and a function that can be used to update the state later. This is a lot t...
...And 3 more matches
Deployment and next steps - Learn web development
Previous Overview: Client-side JavaScript frameworks In the previous article we learning about Svelte's TypeScript support, and how to use it to make your application more robust. In this final article we will look at how to deploy your application and get it online, and also share some of the resources that you should go on to, to continue your Svelte learning journey. Prerequisites: At minimum, it is recommended that you are familiar with the core HTML, CSS, and JavaScript languages, and have knowledge of the terminal/command line. You'll need a terminal with node + npm installed to compile and build your app. Objective: Learn how to prepare our Svelte app for production, and what learning resources you should visit next. Note that our ap...
... fine. Once it has finished deploying, go to the "Production" URL in your browser, and you'll see the app deployed! You can also import a Svelte git project into Vercel from GitHub, GitLab, or BitBucket. Note: you can globally install Vercel with npm i -g vercel so you don't have to use npx to run it. Automatic deployment to GitLab pages For hosting static files there are several online services that allow you to automatically deploy your site whenever you push changes to a git repository. Most of them involve setting up a deployment pipeline that gets triggered on every git push, and takes care of building and deploying your web site. To demonstrate this, we will deploy our todos app to GitLab Pages. First you'll have to register at GitLab and then create a new project. ...
...cts: paths: - public only: - master Here we are telling GitLab to use an image with the latest version of node to build our app. Next we are declaring a pages job, to enable GitLab Pages. Whenever there's a push to our repo, GitLab will run npm install and npm run build to build our application. We are also telling GitLab to deploy the contents of the public folder. On the last line, we are configuring GitLab to redeploy our app only when there's a push to our master branch. Since our app will be published at a subdirectory (like https://your-user.gitlab.io/mdn-svelte-todo), we'll have to make the references to the JavaScript and CSS files in our public/index.html file relative. To do this, we just remove the leading slashes (/) from the /global.css, /build/bundle.css,...
...And 3 more matches
Handling common accessibility problems - Learn web development
e quick tests you can do to see if your sites are going in the right direction. Note: Accessibility is morally the right thing to do, and good for business (numbers of disabled users, users on mobile devices, etc. present significant market segments), but it is also a legal requirement in many parts of the world to make web content accessible to people with disabilities. Read Accessibility guidelines and the law for more information. HTML Semantic HTML (where the elements are used for their correct purpose) is accessible right out of the box -- such content is readable by sighted viewers (provided you don't do anything silly like make the text way too small or hide it using CSS), but will also be usable by assistive technologies like screen readers (apps that literally read out a web page...
...few testing techniques (like keyboard navigation and color contrast checkers), let's have a look at other tools you can make use of when doing accessibility testing. Auditing tools There are a number of auditing tools available that you can feed your web pages into. They will look over them and return a list of accessibility issues present on the page. Examples include: Wave: A rather nice online accessibility testing tool that accepts a web address and returns a useful annotated view of that page with accessibility problems highlighted. Tenon: Another nice online tool that goes through the code at a provided URL and returns results on accessibility errors including metrics, specific errors along with the WCAG criteria they affect, and suggested fixes. It requires a free trial signup to ...
...e of NVDA, the modifier can either be Insert (the default), or CapsLock (can be chosen by checking the first checkbox in the NVDA welcome dialog before pressing OK). Note: NVDA is more subtle than VoiceOver in terms of how it highlights where it is and what it is doing. When you are scrolling through headings, lists, etc., items you are selected on will generally be highlighted with a subtle outline, but this is not always the case for all things. If you get completely lost, you can press Ctrl + F5 to refresh the current page and begin from the top again. NVDA has many keyboard commands, and we won't list them all here. The basic ones you'll need for web page testing are in the following table. In the keyboard shortcuts, "NVDA" means "the NVDA modifier". Most common NVDA keyboard shortc...
...And 3 more matches
Deploying our app - Learn web development
pdate is made to the deployed code. The above tasks also break down into further tasks; note that most web development teams will have their own terms and processes for at least some part of the post-development phase. For this project, we're going to use Netlify's wonderful static hosting offering to host our project. Netlify gives us hosting or more specifically, a URL to view your project online and to share it with your friends, family, and colleagues. Deploying to hosting tends to be at the tail-end of the project life cycle, but with services such as Netlify bringing down the cost of deployments (both in financial terms and also the time required to actually deploy) it's possible to deploy during development to either share work in progress or to have a pre-release for some other pur...
... get into the habit of setting up -- across all our projects, we can then rely on npm run build to always do the complete build step, without needing to remember the specific build command arguments for each project. Open the package.json file in your project's root directory, and find the scripts property. We'll add a build command that we can run to build our code. Add the following line to your project now: "scripts": { ... "build": "parcel build src/index.html" } Note: If the scripts property already has a command inside it, put a comma at the end of it. Keep the JSON valid. 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)...
...src.84f2edd1.css 1.25 KB 1.53s dist/bg.084d3fd3.svg 795 B 147ms dist/index.html 354 B 944ms Try it now! For you to create your own instance of this project you will need to host this project's code in your own git repository. Our next step is to push the project to GitHub. Committing changes to GitHub This section will get you over the line to storing your code in a git repository, but it is a far cry from a git tutorial. There's many great tutorials and books available, and our Git and GitHub page is a good place to start. We initialized our working directory as a git working directory earlier on. A quick way to verify this is to run the following command: git status You should get a status report of what files are being tracked...
...And 3 more matches
Accessible Toolkit Checklist
r assistive technologies such as screen readers, screen magnifiers and voice dictation software to understand your software. Provide theme compatibility with the operating system, at least as an option. Some low vision users will be running your software with high contrast or large font themes. Go beyond section 508. Implement true usability for everyone, and make your toolkit follow the guidelines for each platform. The Approaches There are two basic kinds of toolkits, which each provide different challenges when implementing accessibility: Native widget toolkits , like Eclipse and wxWidgets, already have some accessibility built-in. These toolkits wrap the widgets implemented by the OS with a consistent API for each platform. Since the individual widgets predominately...
...senting what this IAccessible is used for, for example. is it a link, static text, editable text, a checkbox, or a table cell, etc. get_accState: a 32 bit field representing possible on/off states, such as focused, focusable, selected, selectable, visible, protected (for passwords), checked, etc. get_accKeyboardShortcut: What is the keyboard shortcut for this IAccessible (underlined alt+combo mnemonic) get_accFocus: Which child is focused? get_accSelection: Which children of this item are selected? accLocation: Get the x,y coordinates, and the height and width of this IAccessible node. accNavigate: Navigate to the first/last child, previous/next sibling, up, down, left or right from this IAccessible. [important, but no need to impleme...
... The ...
...And 3 more matches
Debugging on Mac OS X
left of the scheme editor window, and check that there is nothing listed under Targets (otherwise it may cause problems when you try to run the executable for debugging since you will get build errors). Click "Close" to close the scheme editor. 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. ...
...u pause or hit breakpoints it should show open the correct source file at the correct line. Setting up lldb lldb is the debugger XCode provides/uses. One important issue that the Mozilla .lldbinit file fixes is that by default some breakpoints will be listed as "pending", and XCode will not stop at them. If you don't include the Mozilla's .lldbinit, you must at least put settings set target.inline-breakpoint-strategy always in your $HOME/.lldbinit as recommended on Debugging Mozilla with lldb. The .lldbinit file in the source tree imports many useful Mozilla specific lldb settings, commands and formatters into lldb, but you may need to take one of the following steps to make sure this file is used. ...
...it, you must at least put settings set target.inline-breakpoint-strategy always in your $HOME/.lldbinit as recommended on Debugging Mozilla with lldb. The .lldbinit file in the source tree imports many useful Mozilla specific lldb settings, commands and formatters into lldb, but you may need to take one of the following steps to make sure this file is used. ...
...And 3 more matches
ESLint
It also runs on treeherder for every check-in. ...
..., you'll get an error similar to this: /gecko/toolkit/mozapps/installer/js-compare-ast.js 18:39 error 'snarf' is not defined. no-undef (eslint) If you don't understand a rule, you can look it up on eslint.org for more information about it. Mozilla Specific Rules There are some rules that are specific for the Mozilla code-base. These have the prefix mozilla/. More information: Outline details of the rules Rule Source Code Common issues and how to solve them My editor says that "mozilla/whatever" is unknown Run ./mach eslint --setup Restart your editor If that doesn't work, check that you have your editor pointing to the correct node_modules folder. Node.js is not recognized Add it to your PATH environment variable by running PATH="$PATH:/path/to/node.js/". For ...
...bling ESLint for a new directory Remove the directory from .eslintignore (in the base directory of the repository) Fix errors that occur when running ./mach eslint path/to/dir, see also the no-undef rules below. no-undef The no-undef rule is currently being enabled throughout the code base. Here are some common issues: My script is imported into the global browser.xul scope. ...
...And 3 more matches
Eclipse CDT
crease its memory limits. When Eclipse's indexer tries to process the Mozilla source, Eclipse will need considerably more memory than the limits imposed by its default configuration. You can increase Eclipse's memory limits using the eclipse.ini that lives alongside the eclipse binary. Set an initial heap space of 1 GB and max heap space of 5 GB, say, by modifying the values of the following two lines in eclipse.ini: -Xms1G -Xmx5G If you fail to increase these limits, then you will likely find that Eclipse either hangs when it tries to index the Mozilla source or else that the code intelligence is very broken after the indexing "completes". Express setup For the Eclipse indexer to work well you must first build Mozilla, so that it includes headers from the objdir etc. These can be found a...
...ject properties window. Now when you hit the Build button (the little hammer icon), you should see the source build in the Console tab at the bottom of the window. ...
...it of building from inside Eclipse is that build errors will appear in the Problems tab at the bottom of the window, and from there you can double click on the build error and it will take you straight to the source file and line where the problem occurred. For this to work reliably though, you still need to build using slow -j1 -w builds, so that make outputs non-interleaved "Entering"/"Leaving" lines. It also used to be necessary to add the following two lines to your mozconfig to make the compiler output errors all on a single line, but that may not be needed anymore: export CFLAGS="-fmessage-length=0" export CPPFLAGS="-fmessage-length=0" Debugging To create a debug configuration, open the project properties window, and select "Run/Debug Settings" on the left. Click "New", then select "...
...And 3 more matches
Performance best practices for Firefox front-end engineers
by using Services.tm.idleDispatchToMainThread. See the nsIThreadManager.idl file for more details. Hide your panels If you're adding a new XUL <xul:popup> or <xul:panel> to a document, set the hidden attribute to true by default. By doing so, you cause the binding applied on demand rather than at load time, which makes initial construction of the XUL document faster. Get familiar with the pipeline that gets pixels to the screen Learn how pixels you draw make their way to the screen. Knowing the path they will take through the various layers of the browser engine will help you optimize your code to avoid pitfalls. The rendering process goes through the following steps: The above image is used under Creative Commons Attribution 3.0, courtesy of this page from our friends at Google, which...
...e various layers of the browser engine will help you optimize your code to avoid pitfalls. The rendering process goes through the following steps: The above image is used under Creative Commons Attribution 3.0, courtesy of this page from our friends at Google, which itself is well worth the read. For a very down-to-earth explanation of the Style, Layout, Paint and Composite steps of the pipeline, this Hacks blog post does a great job of explaining it. To achieve a 60 FPS frame rate, all of the above has to happen in 16 milliseconds or less, every frame. Note that requestAnimationFrame() lets you queue up JavaScript to run right before the style flush occurs. This allows you to put all of your DOM writes (most importantly, anything that could change the size or position of things in th...
... To achieve a 60 FPS frame rate, all of the above has to happen in 16 milliseconds or less, every frame. Note that requestAnimationFrame() lets you queue up JavaScript to run right before the style flush occurs. This allows you to put all of your DOM writes (most importantly, anything that could change the size or position of things in the DOM) just before the style and layout steps of the pipeline, combining all the style and layout calculations into a single batch so it all happens once, in a single frame tick, instead of across multiple frames. See Detecting and avoiding synchronous reflow below for more information. This also means that requestAnimationFrame() is not a good place to put queries for layout or style information. Detecting and avoiding synchronous style flushes What are...
...And 3 more matches
Examples
Now replace the `alert(myVarIsC...
...{ try { //var myVarIsCommented = 'hi'; // I commented this out s oit is undefined, this will cause rejected alert(myVarIsCommented); return Promise.resolve('yay success'); // this makes the success function trigger with aSuccessReason being 'yay success' but because I commented out the var 2 lines above, it will error out on the alert(myVarIsCommented) and never get to this success line. uncommet the var 2 lines above to see the promise succesfully return } catch(ex) { return Promise.reject(ex); } } Copy and paste this code and the rejection will take place. Uncomment the line `//var myVarIsCommented.....` and the promise will complete succesfully. Now replace the `alert(myVarIsCommented)` with `throw new Error('i feel like rejecting this promise')` like this: Componen...
... This copy/paste code here will complete succesfully: Components.utils.import("resource://gre/modules/Promise.jsm"); ...
...And 3 more matches
SourceMap.jsm
es: An array of identifiers that can be referenced by individual mappings. sourceRoot: Optional. The URL root from which all sources are relative. mappings: A string of base64 VLQs which contain the actual mappings. file: The generated filename this source map is associated with. SourceMapConsumer.prototype.originalPositionFor(generatedPosition) Returns the original source, line, and column information for the generated source's line and column positions provided. The only argument is an object with the following properties: line: The line number in the generated source. column: The column number in the generated source. and an object is returned with the following properties: source: The original source file, or null if this information is not avai...
... column: The column number in the original source, or null if this information is not available. name: The original identifier, or null if this information is not available. ...
... column: The column number in the original source, or null if this information is not available. name: The original identifier, or null if this information is not available. ...
...And 3 more matches
Creating localizable web applications
calizers to localize English content, such as: text messages, number formats, date formats, word order and sentence structure. Note that some strings might be hidden in libraries' code (e.g. error messages), or in JavaScript libraries and scripts. If you are using pure HTML instead of gettext to localize your webapp, consider using an additional gettext-like format such as .lang to streamline localizers' work with repeating content. This is useful for strings occurring in the webapp multiple times, like "return to top", "comments", "click to see larger image" etc. Might be also helpful for headers and footers, if you're not using templates to display them. In most of the cases though, you should use gettext whenever technically possible (i.e. the server's PHP has been built with gett...
...riptor. You should take advantage of the printf() variable that will be substituted by the date upon interpretation of the code (snippet 7). Use gettext comments Use comments in the code to help localizers understand what they are translating. You can explain where the string will appear in the application, or what the variables used in the string will be replaced with. Put comments in the same line as the gettext function call (inline comments, in PHP these are /* ... */), or one line directly above the gettext function call (block comments, in PHP they start with # ... or // ...). In either way, use a consistent prefix for localization-related comments, e.g. "L10n". When extracting strings with xgettext you will be able to include only comments starting with this prefix using the --add-com...
.... Snippet 1. Bad: echo _("Long text\n"); echo _("Second part\n"); echo _("Third part\n"); Snippet 2. Still bad (but slightly better than snippet 1): # L10n: Long text example, part 1. echo _("Long text\n"); # L10n: Long text example, part 2. echo _("Second part\n"); # L10n: Long text example, part 3. echo _("Third part\n"); Snippet 3. Good: # L10n: No indentation is possible after the first line. echo _("Long text Second part Third part\n"); Snippet 4. Good (even better): # L10n: You can indent lines to your liking. echo _("Long text\n" . "Second part\n" . "Third part\n"); The solution in snippet 3 doesn't allow to use code indentation for "Second part" and "Third part". If you indent "Second part", the resulting string (interpreted by PHP and Gettext) will end up indented...
...And 3 more matches
MathML Demo: <mtable> - tables and matrices
As a visual aid, the examples deliberately draw attention to the math axis and the baseline: ----------------------- this is the math axis ..................... this is the baseline External vertical align is center ---... 1 22 333 4444 x 55555 666666 a b c 7777777 11 ...--- , cols arg is "|r|c|l|", \hline's above and below. When align="center" or align="baseline", the middle of the table coincides with the baseline. External vertical align is axis ---... 1 22 333 4444 x 55555 lim n->? f-1 ? i=1 n Ai rowspan=2 here xn + yn n columnspan=2 here 7777777 11 ...--- , columnlines="solid", rowlines="dashed solid dashed". By default -- when the align attribute is not set, or when align="axis", t...
... 1 55555 x + 1 c bottom ? + ? 1 4444 x c top ? + || 1 4444 4444 4444 x center || post text. Now for a display ---... 1 4444 4444 4444 x 7777777 text after displayed math. Do you see which vertical alignment is set on that table? Example of \begin{matrix} ---... 0 1 1 0 with 3 \hline's. Example of \begin{smallmatrix} ---... 1 2 3 4 5 obtained with scriptlevel="+1". Example of \begin{pmatrix} ---... ( 0 - i i 0 ) with an \hline after the first row. Example of \begin{bmatrix} ---... [ 1 0 0 - 1 ] Example of \begin{vmatrix} ---... | a b c d | Example of \begin{Vmatrix} ---... || 0 ...
... ] . A table with align="axis2" to anchor the table externally w.r.t. the axis of the second row ---... ab ? ? abx yab ? ? ab ...--- , but this is subject to variances due to style changes, e.g., from the scriptlevel. ---... ab ? ? abx yab ? ? ab ...--- . Anyway, this is buggy in Mozilla because what you see above is a fallback to the rendering code used for the baseline case (see below). A table with align="baseline -1" to anchor the table externally w.r.t. the baseline of the last row ---... d+p ( ? ? ? ? ) ...--- , neat isn't it? This would be pretty hard to obtain otherwise. Contrast it with the following which has align="bottom" ---... d+p ( ? ? ? ? ) ...--- , and with this one which has align="center -1" ---... d+p ( ? ? ? ? ...
...And 3 more matches
Utilities for nss samples
rn PRBool CheckPassword(char *cp); /* * GetPassword */ extern char * GetPassword(FILE *input, FILE *output, char *prompt, PRBool (*ok)(char *)); /* * FilePasswd extracts the password from a text file * * Storing passwords is often used with server environments * where prompting the user for a password or requiring it * to be entered in the commnd line is not a feasible option. * * This function supports password extraction from files with * multipe passwords, one for each token. In the single password * case a line would just have the passord whereas in the multi- * password variant they could be of the form * * token_1_name:its_password * token_2_name:its_password * */ extern char * FilePasswd(PK11SlotInfo * slot, PRBool ...
... Util.c /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #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. ...
...Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #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. ...
...And 3 more matches
Rhino Debugger
ipt Debugger can debug scripts running in multiple threads and provides facilities to set and clear breakpoints, control execution, view variables, and evaluate arbitrary JavaScript code in the current scope of an executing script. Console Window The debugger redirects the System.out, System.in, and System.err streams to an internal JavaScript console window which provides an editable command line for you to enter JavaScript code and view system output. The console window maintains a history of the commands you have entered. You may move backward and forward through the history list by pressing the Up/Down arrow keys on the keyboard. Opening Scripts You may select the File->Open menu item on the menu bar to load JavaScript scripts contained in files. This action will display a file-sele...
...olling Execution The debugger provides the following facilities for you to control the execution of scripts you are debugging: Step Into To single step entering any function calls, you may do any of the following: Select the Debug->Step Into menu item on the menu bar Press the Step Into button on the toolbar Press the F11 key on the keyboard Execution will resume. ...
...y function calls, you may do any of the following: Select the Debug->Step Into menu item on the menu bar Press the Step Into button on the toolbar Press the F11 key on the keyboard Execution will resume. If the current line in the script contains a function call control will return to the debugger upon entry into the function. Otherwise control will return to the debugger at the next line in the current function. Step Over To single step to the next line in the current function, you may do any of the following: Select the Debug->Step Over menu item on the menu bar Press the Step Over button on the toolbar Press the F7 key on the keyboard Execution will resume but control will return to the debugger at the next line in the current function or top-level script. ...
...And 3 more matches
Getting SpiderMonkey source code
You can get the SpiderMonkey source code in gzipped form or directly from the Mercurial repository. Downloading gzipped SpiderMonkey source code You can download gzipped SpiderMonkey source code from the following URLs: http://ftp.mozilla.org/pub/spidermonkey/releases/ http://ftp.mozilla.org/pub/spidermonkey/prereleases/ Here is a command-line example of downloading and unzipping SpiderMonkey source code version 59.0: mkdir mozilla cd mozilla wget http://ftp.mozilla.org/pub/spidermonkey/prereleases/59/pre1/mozjs-59.0a1.0.tar.bz2 tar xvf mozjs-59.0a1.0.tar.bz2 These commands should work on most platforms including Windows, as long as on Windows you are using the MozillaBuild bash shell. Getting the latest SpiderMonkey source code from Mercurial The Mercurial repository at https://hg.mo...
...59.0a1.0.tar.bz2 tar xvf mozjs-59.0a1.0.tar.bz2 These commands should work on most platforms including Windows, as long as on Windows you are using the MozillaBuild bash shell. Getting the latest SpiderMonkey source code from Mercurial The Mercurial repository at https://hg.mozilla.org/mozilla-central/ hosts the latest SpiderMonkey sources. Mercurial is also known as hg. The following command line downloads the entire Mozilla repository, including the full change history and a lot of Gecko and Firefox source code that isn't part of SpiderMonkey. It also changes to the SpiderMonkey directory (js/src). hg clone https://hg.mozilla.org/mozilla-central/ cd js/src To avoid getting the full change history, click the zip or gz links at https://hg.mozilla.org/index.cgi/mozilla-central/file/tip. ...
...ndex.cgi/mozilla-central/file/tip. This fetches a snapshot of the current Mozilla tree. If you have problems with the instructions above, you can read the full details of using Mercurial to get Mozilla code here. That page also contains links to several bundles, which can be useful if you have a poor network connection. Getting the latest SpiderMonkey source code from Git The following command line downloads the entire Mozilla repository, including the full change history and a lot of Gecko and Firefox source code that isn't part of SpiderMonkey. It also changes to the SpiderMonkey directory (js/src). git clone https://github.com/mozilla/gecko-dev.git cd gecko-dev/js/src If you want a faster (about 5 times as of January 2015) download, try doing a shallow clone (no version control histor...
...And 3 more matches
JSErrorReport
escribes the format of a JS error that is used either by the internal error reporting mechanism or by a user-defined error-reporting mechanism. Syntax JSErrorReport(); Properties Name Type Description filename const char * Indicates the source file or URL that produced the error condition. If NULL, the error is local to the script in the current HTML page. lineno unsigned Line number in the source that caused the error. column unsigned zero-based column index in line in the source that caused the error. isMuted bool The Web Platform allows scripts to be loaded from arbitrary cross-origin sources. This allows an attack by which a malicious website loads a sensitive file (say, a bank statement) cross-origin (using ...
...rrors (via a window.onerror handler) for juicy morsels of its contents. To counter this attack, HTML5 specifies that script errors should be sanitized ("muted") when the script is not same-origin with the global for which it is loaded. Callers should set this flag for cross-origin scripts, and it will be propagated appropriately to child scripts and passed back in JSErrorReports. linebuf const char * Text of the line that caused the error, minus the trailing newline character. tokenptr const char * Pointer to the error token in *linebuf. uclinebuf const char16_t * Unicode line buffer. This is the buffer that contains the original data. uctokenptr const char16_t * Pointer to the error token in *uclinebuf. flags unsi...
...the error message. exnType int16_t One of the JSExnType constants. Description JSErrorReport describes a single error that occurs in the execution of script. In the event of an error, filename will either contain the name of the external source file or URL containing the script (SCRIPT SRC=) or NULL, indicating that a script embedded in the current HTML page caused the error. ...
...And 3 more matches
JS_EvaluateScriptForPrincipals
JSAPI 30This feature is obsolete. Although it may still work in some browsers, its use is discouraged since it could be removed at any time. Try to avoid using it. Compile and execute a security-enabled script. ...
...bled script. ...
...Requires request. In a...
...And 3 more matches
Parser API
TE: This page describes SpiderMonkey-specific behavior and might be incomplete. Visit ESTree spec for a community AST standard that includes latest ECMAScript features and is backward-compatible with SpiderMonkey format. ...
...piderMonkey-specific behavior and might be incomplete. Visit ESTree spec for a community AST standard that includes latest ECMAScript features and is backward-compatible with SpiderMonkey format. ...
... Boolean Default: true When loc is true, the parser includes source location information in the returned AST nodes. source String Default: null A description of the input source; typically a filename, path, or URL. This string is not meaningful to the parsing process, but is produced as part of the source location information in the returned AST nodes. line Number Default: 1 The initial line number to use for source location information. builder Builder Default: null A builder object, which can be used to produce AST nodes in custom data formats. The expected callback methods are described under Builder Objects. target String Default: script A type of the parsing target, ca...
...And 3 more matches
Web Replay
therwise the tab will probably crash. This feature has had little testing or polishing and there is not yet a good definition of 'reasonably similar'. Time Travel Features This section describes extensions to the developer tools that use time travel to help debug a recording/replaying tab. Step Back When paused, the reverse step button in the Debugger developer tool will step to the previous line executed and allow inspecting program state there. It is the opposite of the normal forward step button. Rewind to Breakpoint When paused, if there are any breakpoints set then the rewind button will run back and stop at the last time a breakpoint was set. It is the opposite of the normal button for playing forward. Seek to Console Messages Errors and logged messages in the Console develo...
...nt was set. It is the opposite of the normal button for playing forward. Seek to Console Messages Errors and logged messages in the Console developer tool can be clicked on to cause the tab to seek to the point in the recording where the error was generated or the message was logged. The tab will pause at this point and allow state to be inspected, forward/reverse stepping, and so forth. ...
...t is the opposite of the normal button for playing forward. Seek to Console Messages Errors and logged messages in the Console developer tool can be clicked on to cause the tab to seek to the point in the recording where the error was generated or the message was logged. The tab will pause at this point and allow state to be inspected, forward/reverse stepping, and so forth. ...
...And 3 more matches
imgIContainer
eColormap(in unsigned long framenumber, [array, size_is(paletteLength)] out PRUint32 paletteData, out unsigned long paletteLength); Obsolete since Gecko 2.0 unsigned long getFrameImageDataLength(in unsigned long framenumber); Obsolete since Gecko 2.0 ImageContainer getImageContainer(); Native code only! ...
...] out PRUint32 paletteData, out unsigned long paletteLength); Obsolete since Gecko 2.0 unsigned long getFrameImageDataLength(in unsigned long framenumber); Obsolete since Gecko 2.0 ImageContainer getImageContainer(); Native code only! ...
... Obsolete since Gecko 2.0 void setDiscardable(in string aMimeType); Native code only! ...
...And 3 more matches
nsIAppShellService
tate(in long aWindowWidth, in long aWindowHeight); Obsolete since Gecko 1.8 nsIXULWindow createTopLevelWindow(in nsIXULWindow aParent, in nsIURI aUrl, in PRUint32 aChromeMask, in long aInitialWidth, in long aInitialHeight, in nsIAppShell aAppShell); nsIWebNav createWindowlessBrowser (in bool aIsChrome) void destroyHiddenWindow(); void doProfileStartup(in nsICmdLineService aCmdLineService, in boolean canInteract); Obsolete since Gecko 1.8 void ensure1Window(in nsICmdLineService aCmdLineService); Obsolete since Gecko 1.8 void enterLastWindowClosingSurvivalArea(); Obsolete since Gecko 1.8 void exitLastWindowClosingSurvivalArea(); Obsolete since Gecko 1.8 void getHiddenWindowAndJSContext(out nsIDOMWindow aHiddenDOMWindow, out...
...vice); Obsolete since Gecko 1.8 void enterLastWindowClosingSurvivalArea(); Obsolete since Gecko 1.8 void exitLastWindowClosingSurvivalArea(); Obsolete since Gecko 1.8 void getHiddenWindowAndJSContext(out nsIDOMWindow aHiddenDOMWindow, out JSContext aJSContext); Native code only! ...
...since Gecko 1.8 void enterLastWindowClosingSurvivalArea(); Obsolete since Gecko 1.8 void exitLastWindowClosingSurvivalArea(); Obsolete since Gecko 1.8 void getHiddenWindowAndJSContext(out nsIDOMWindow aHiddenDOMWindow, out JSContext aJSContext); Native code only! ...
...And 3 more matches
nsIAppStartup
se the service: var appStartup = Components.classes["@mozilla.org/toolkit/app-startup;1"] .getService(Components.interfaces.nsIAppStartup); Method overview void createHiddenWindow(); boolean createStartupState(in long aWindowWidth, in long aWindowHeight); Obsolete since Gecko 1.9.1 void destroyHiddenWindow(); void doProfileStartup(in nsICmdLineService aCmdLineService, in boolean canInteract); Obsolete since Gecko 1.9.1 void ensure1Window(in nsICmdLineService aCmdLineService); Obsolete since Gecko 1.9.1 void enterLastWindowClosingSurvivalArea(); void exitLastWindowClosingSurvivalArea(); void getStartupInfo(); void hideSplashScreen(); Obsolete since Gecko 1.9.1 void initialize(in nsIS...
... Value Description eConsiderQuit 0x01 Attempt to quit if all windows are closed. eAttemptQuit 0x02 Try to close all windows, then quit if successful. eForceQuit 0x03 Force all windows to close, then quit. eRestart 0x10 Restart the application after quitting. The application will be restarted with the same profile and an empty command line. eRestartNotSameProfile 0x100 Restart the application after quitting. The application will be restarted with an empty command line and the normal profile selection process will take place on startup. Methods createHiddenWindow() Create the hidden window. void createHiddenWindow(); Parameters None. createStartupState() Obsolete since Gecko 1.9.1 (Firef...
...w was opened. destroyHiddenWindow() Destroys the hidden window. This will have no effect if the hidden window has not yet been created. void destroyHiddenWindow(); Parameters None. doProfileStartup() Obsolete since Gecko 1.9.1 (Firefox 3.5 / Thunderbird 3.0 / SeaMonkey 2.0) Starts up the profile manager with the given arguments. void doProfileStartup( in nsICmdLineService aCmdLineService, in boolean canInteract ); Parameters aCmdLineService The arguments given to the program. canInteract If FALSE and UI is needed, will fail. ensure1Window() Obsolete since Gecko 1.9.1 (Firefox 3.5 / Thunderbird 3.0 / SeaMonkey 2.0) Ensures that at least one window exists after creating the startup state. If one has not been made, this w...
...And 3 more matches
nsISHEntry
clearChildShells(); nsISHEntry clone(); void create(in nsIURI URI, in AString title, in nsIInputStream inputStream, in nsILayoutHistoryState layoutHistoryState, in nsISupports cacheKey, in ACString contentType, in nsISupports owner, in unsigned long long docshellID, in boolean dynamicCreation); Native code only! ...
...g long docshellID, in boolean dynamicCreation); Native code only! nsDocShellEditorDataPtr forgetEditorData(); Violates the XPCOM interface guidelines nsIContentViewer getAnyContentViewer(out nsISHEntry ownerEntry); void getScrollPosition(out long x, out long y); void getViewerBounds(in nsIntRect bounds); Native code only! ...
... c...
...And 3 more matches
nsISelectionController
boolean checkVisibility(in nsIDOMNode node, in short startOffset, in short endOffset); void completeMove(in boolean forward, in boolean extend); void completeScroll(in boolean forward); boolean getCaretEnabled(); short getDisplaySelection(); nsISelection getSelection(in short type); void intraLineMove(in boolean forward, in boolean extend); void lineMove(in boolean forward, in boolean extend); void pageMove(in boolean forward, in boolean extend); void repaintSelection(in short type); void scrollHorizontal(in boolean left); void scrollLine(in boolean forward); void scrollPage(in boolean forward);...
...isplaySelection() Will get the display mode for the selection. short getDisplaySelection(); Parameters None. Return value OFF, ON, DISABLED. getSelection() Will return the selection that the presentation shell may implement. nsISelection getSelection( in short type ); Parameters type Will hold the type of selection. (SelectionType) Return value Will hold the return value. ...
...ection. short getDisplaySelection(); Parameters None. Return value OFF, ON, DISABLED. getSelection() Will return the selection that the presentation shell may implement. nsISelection getSelection( in short type ); Parameters type Will hold the type of selection. (SelectionType) Return value Will hold the return value. intraLineMove() Will move the selection to the front of the line or end of the line in the document. This will also have the effect of collapsing the selection if the extend = PR_FALSE the "point" of selection that is extended is considered the "focus" point, or the last point adjusted by the selection. void intraLineMove( in boolean forward, in boolean extend ); Parameters forward Forward or backward if PR_FALSE. extend Shoul...
...And 3 more matches
XPIDL Syntax
Mozilla › Tech › XPIDL › Syntax
n general. It is more focused on XPIDL syntax and grammar. See XPIDL Main Page for more links and introductory content. Simplifications, conventions and notation The syntax is specified according to ABNF as defined by RFC 5234, although a few productions use prose for clarity of understanding. ...
... content. Simplifications, conventions and notation The syntax is specified according to ABNF as defined by RFC 5234, although a few productions use prose for clarity of understanding. Lexically, tokens are delimited by whitespace (defined here as spaces, tabs, vertical tabs, form feeds, line feeds, and carriage returns, or [ \t\v\f\r\n] in regular expression form). LibIDL only considers a single line feed as a newline, and not carriage returns (although xpidl begs to differ). ...
...arity of understanding. Lexically, tokens are delimited by whitespace (defined here as spaces, tabs, vertical tabs, form feeds, line feeds, and carriage returns, or [ \t\v\f\r\n] in regular expression form). LibIDL only considers a single line feed as a newline, and not carriage returns (although xpidl begs to differ). Additionally, the use of both C-style (/* ... */) and C++-style (// ... end-of-line) comments are permitted between any two tokens. ...
...And 3 more matches
Examine and edit HTML - Firefox Developer Tools
apsed if it has larger contents. Now children are indicated in the tree with this icon: At the right side of some nodes there are markers shown indicating different pieces of information related to it: event The element has one or several event listeners attached to it. Clicking the marker opens a tooltip listing the event listeners and allows you for each listener to switch to the line of JavaScript code in the Debugger where the listener is defined. scroll The element is a scroll container, i.e. it has overflow: scroll or overflow: auto applied to it, and it has scrollable overflow. grid The element is a grid container, i.e. it has display: grid applied to it. Clicking the marker enables the grid highlighter. flex The element is a flex conta...
...ontainer, i.e. it has overflow: scroll or overflow: auto applied to it, and it has scrollable overflow. grid The element is a grid container, i.e. it has display: grid applied to it. Clicking the marker enables the grid highlighter. flex The element is a flex container, i.e. it has display: flex applied to it. Clicking the marker enables the flexbox highlighter. inline-grid The element is an inline grid container, i.e. it has display: inline-grid or display: inline grid applied to it. Clicking the marker enables the grid highlighter. inline-flex The element is an inline flex container, i.e. it has display: inline-flex or display: inline flex applied to it. Clicking the marker enables the flexbox highlighter. custom... The element is a...
... Note: There are some useful keyboard shortcuts that can be used in the HTML tree -- see the HTML pane keyboard shortcuts list. ...
...And 3 more matches
Work with animations - Firefox Developer Tools
It displays animations created using CSS transitions, CSS @keyframes rules, or the Web Animations API. ...
... It displays animations created using CSS transitions, CSS @keyframes rules, or the Web Animations API. ...
...ons are made using the Web Animations API. Let's use the animation inspector to see what's going on in this example. Right-click in the box and select "Inspect Element" Make sure the selected element is the <div class="channel"> Switch over to the "Animations" tab Play the animation Let's take a closer look at the contents of the animation inspector here: It shows a synchronized timeline for every animation applied to the selected element or its children. The timeline starts at the start of the first animation, ends at the end of the last animation, and is labeled with markers every 250 milliseconds (this depends on the time scale of the animations currently displayed). Animation bars Each animation or transition is shown as a horizontal bar laid across the timeline. The bar is...
...And 3 more matches
AudioBufferSourceNode - Web APIs
io which has particularly stringent timing accuracy requirements, such as for sounds that must match a specific rhythm and can be kept in memory rather than being played from disk or the network. To play sounds which require accurate timing but must be streamed from the network or played from disk, use a AudioWorkletNode to implement its playback. ...
...her than being played from disk or the network. To play sounds which require accurate timing but must be streamed from the network or played from disk, use a AudioWorkletNode to implement its playback. ...
...inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 140" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/AudioNode" target="_top"><rect x="151" y="1" width="90" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="196" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,mon...
...And 3 more matches
BaseAudioContext - Web APIs
The BaseAudioContext interface of the Web Audio API acts as a base definition for online and offline audio-processing graphs, as represented by AudioContext and OfflineAudioContext respectively. You wouldn't use BaseAudioContext directly -- you'd use its features via one of these two inheriting interfaces. A BaseAudioContext can be a target of events, therefore it implements the EventTarget interface. ...
... as a base definition for online and offline audio-processing graphs, as represented by AudioContext and OfflineAudioContext respectively. You wouldn't use BaseAudioContext directly -- you'd use its features via one of these two inheriting interfaces. A BaseAudioContext can be a target of events, therefore it implements the EventTarget interface. ...
...n't use BaseAudioContext directly -- you'd use its features via one of these two inheriting interfaces. A BaseAudioContext can be a target of events, therefore it implements the EventTarget interface. ...
...And 3 more matches
Drawing text - Web APIs
. There are some more properties which let you adjust the way the text gets displayed on the canvas: font = value The current text style being used when drawing text. This string uses the same syntax as the CSS font property. The default font is 10px sans-serif. textAlign = value Text alignment setting. Possible values: start, end, left, right or center. The default value is start. ...
...ore properties which let you adjust the way the text gets displayed on the canvas: font = value The current text style being used when drawing text. This string uses the same syntax as the CSS font property. The default font is 10px sans-serif. textAlign = value Text alignment setting. Possible values: start, end, left, right or center. The default value is start. textBaseline = value Baseline alignment setting. ...
...seline = value Baseline alignment setting. Possible values: top, hanging, middle, alphabetic, ideographic, bottom. The default value is alphabetic. direction = value Directionality. Possible values: ltr, rtl, inherit. The default value is inherit. These properties might be familiar to you, if you have worked with CSS before. The following diagram from the WHATWG demonstrates the various baselines supported by the textBaseline property. ...
...And 3 more matches
Comment - Web APIs
Web › API › Comment
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. Comments are represented in HTML and XML as content between '<!--' and '-->'. In XML, the character sequence '--' cannot be used within a comment. ...
... comments are available to be read in the source view. Comments are represented in HTML and XML as content between '<!--' and '-->'. In XML, the character sequence '--' cannot be used within a comment. ...
... inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 70" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monosp...
...And 3 more matches
Element - Web APIs
Web › API › Element
nherit from Element. For example, the HTMLElement interface is the base interface for HTML elements, while the SVGElement interface is the basis for all SVG elements. Most functionality is specified further down the class hierarchy. Languages outside the realm of the Web platform, like XUL through the XULElement interface, also implement Element. ...
... all SVG elements. Most functionality is specified further down the class hierarchy. Languages outside the realm of the Web platform, like XUL through the XULElement interface, also implement Element. ...
... inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 70" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monosp...
...And 3 more matches
HTMLDocument - Web APIs
The HTMLDocument interface, which may be accessed through the Window.HTMLDocument property, extends the Window.HTMLDocument property to include methods and properties that are specific to HTML documents. ...
...e HTMLDocument interface, which may be accessed through the Window.HTMLDocument property, extends the Window.HTMLDocument property to include methods and properties that are specific to HTML documents. ...
... inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 70" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monosp...
...And 3 more matches
Drag Operations - Web APIs
appear relative to the mouse pointer. It is also possible to use images and canvases that are not in a document. This technique is useful when drawing custom drag images using the canvas element, as in the following example: function dragWithCustomImage(event) { const canvas = document.createElement("canvas"); canvas.width = canvas.height = 50; const ctx = canvas.getContext("2d"); ctx.lineWidth = 4; ctx.moveTo(0, 0); ctx.lineTo(50, 50); ctx.moveTo(0, 50); ctx.lineTo(50, 0); ctx.stroke(); const dt = event.dataTransfer; dt.setData('text/plain', 'Data to Drag'); dt.setDragImage(canvas, 25, 25); } In this example, we make one canvas the drag image. As the canvas is 50x50 pixels, we use offsets of half of this (25) so that the image appears centered on the mouse point...
...lus sign icon will appear for a 'copy' for example, and a 'cannot drop here' icon will appear when a drop is not allowed. This mouse pointer feedback is sufficient in many cases. However, you can also update the user interface with an insertion point or highlight as needed. For simple highlighting, you can use the :-moz-drag-over CSS pseudoclass on a drop target. .droparea:-moz-drag-over { outline: 1px solid black; } In this example, the element with the class droparea will receive a 1 pixel black outline while it is a valid drop target, that is, if the preventDefault() method was called during the dragenter event. Note: You must cancel the dragenter event for this pseudoclass to apply, as this state is not checked for the dragover event. For more complex visual effects, you can also...
...browser's default handling is not triggered by the dropped data as well. For example, when a link is dragged to a web page, Firefox will open the link. By cancelling the event, this behavior will be prevented. You can retrieve other types of data as well. If the data is a link, it should have the type text/uri-list. You could then insert a link into the content. function doDrop(event) { const lines = event.dataTransfer.getData("text/uri-list").split("\n"); lines.filter(line => !line.startsWith("#")) .forEach(line => { const link = document.createElement("a"); link.href = line; link.textContent = line; event.target.appendChild(link); }) event.preventDefault(); } This example inserts a link from the dragged data. As the name implies, the text/uri-list ty...
...And 3 more matches
IDBDatabase - Web APIs
s. Note: Everything you do in IndexedDB always happens in the context of a transaction, representing interactions with data in the database. All objects in IndexedDB -- including object stores, indexes, and cursors -- are tied to a particular transaction. Thus, you cannot execute commands, access data, or open anything outside of a transaction. ...
...bjects in IndexedDB -- including object stores, indexes, and cursors -- are tied to a particular transaction. Thus, you cannot execute commands, access data, or open anything outside of a transaction. ...
... inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 70" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/IDBDatabase" target="_top"><rect x="151" y="1" width="110" height="50" fill="#F4F7F8" stroke="#D4DDE4" stroke-width="2px" /><text x="206" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mo...
...And 3 more matches
IDBOpenDBRequest - Web APIs
The IDBOpenDBRequest interface of the IndexedDB API provides access to the results of requests to open or delete databases (performed using IDBFactory.open and IDBFactory.deleteDatabase), using specific event handler attributes. Note: This feature is available in Web Workers. ...
...sults of requests to open or delete databases (performed using IDBFactory.open and IDBFactory.deleteDatabase), using specific event handler attributes. Note: This feature is available in Web Workers. ...
... inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 70" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/IDBRequest" target="_top"><rect x="151" y="1" width="100" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="201" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,m...
...And 3 more matches
ProcessingInstruction - Web APIs
tion is different from the XML declaration. User-defined processing instructions cannot begin with "xml", as xml-prefixed processing-instruction target names are reserved by the XML specification for particular, standard uses (see, for example, <?xml-stylesheet ?>). The ProcessingInstruction interface inherits methods and properties from Node. ...
...ng-instruction target names are reserved by the XML specification for particular, standard uses (see, for example, <?xml-stylesheet ?>). The ProcessingInstruction interface inherits methods and properties from Node. ...
... inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 700 70" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monosp...
...And 3 more matches
RTCPeerConnection: connectionstatechange event - Web APIs
n the RTCPeerConnectionState enumerated type. Bubbles No Cancelable No Interface Event Event handler onconnectionstatechange Examples For an RTCPeerConnection, pc, this example sets up a handler for connectionstatechange messages to handle changes to the connectivity of the WebRTC session. ...
...tionstatechange Examples For an RTCPeerConnection, pc, this example sets up a handler for connectionstatechange messages to handle changes to the connectivity of the WebRTC session. It simply calls an app-defined function called setOnlineStatus() to update a status display. ...
... sets up a handler for connectionstatechange messages to handle changes to the connectivity of the WebRTC session. It simply calls an app-defined function called setOnlineStatus() to update a status display. ...
...And 3 more matches
SVGGradientElement - Web APIs
The SVGGradient interface is a base interface used by SVGLinearGradientElement and SVGRadialGradientElement. <div id="interfaceDiagram" style="display: inline-block; position: relative; width: 100%; padding-bottom: 23.333333333333332%; vertical-align: middle; overflow: hidden;"><svg style="display: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 140" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4D...
...ink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">Node</text></a><polyline points="226,25 236,20 ...
...E4"/><a xlink:href="/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">Node</text></a><polyline points="226,25 236,20 236,30 226,25" stroke="#D4DDE4" fill="none"/><line x1="236" y1="25" x2="266" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Element" target="_top"><rect x="266" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="303.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">Element</text></a><polyline points="341,25 3...
...And 3 more matches
SVGPathSeg - Web APIs
None Properties unsigned short pathSegType DOMString pathSegTypeAsLetter Constants PATHSEG_UNKNOWN = 0 PATHSEG_CLOSEPATH = 1 PATHSEG_MOVETO_ABS = 2 PATHSEG_MOVETO_REL = 3 PATHSEG_LINETO_ABS = 4 PATHSEG_LINETO_REL = 5 PATHSEG_CURVETO_CUBIC_ABS = 6 PATHSEG_CURVETO_CUBIC_REL = 7 PATHSEG_CURVETO_QUADRATIC_ABS = 8 PATHSEG_CURVETO_QUADRATIC_REL = 9 PATHSEG_ARC_ABS = 10 PATHSEG_ARC_REL = 11 PATHSEG_LINETO_HORIZONTAL_ABS = 12 PATHSEG_LINETO_HORIZONTAL_REL = 13 PATHSE...
..._ABS = 4 PATHSEG_LINETO_REL = 5 PATHSEG_CURVETO_CUBIC_ABS = 6 PATHSEG_CURVETO_CUBIC_REL = 7 PATHSEG_CURVETO_QUADRATIC_ABS = 8 PATHSEG_CURVETO_QUADRATIC_REL = 9 PATHSEG_ARC_ABS = 10 PATHSEG_ARC_REL = 11 PATHSEG_LINETO_HORIZONTAL_ABS = 12 PATHSEG_LINETO_HORIZONTAL_REL = 13 PATHSEG_LINETO_VERTICAL_ABS = 14 PATHSEG_LINETO_VERTICAL_REL = 15 PATHSEG_CURVETO_CUBIC_SMOOTH_ABS = 16 PATHSEG_CURVETO_CUBIC_SMOOTH_REL = 17 PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS = 18 PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL = 19 Normative document SVG 1.1 (2nd Edition) ...
... PATHSEG_CLOSEPATH 1 Corresponds to a "closepath" (z) path data command. PATHSEG_MOVETO_ABS 2 Corresponds to an "absolute moveto" (M) path data command. PATHSEG_MOVETO_REL 3 Corresponds to a "relative moveto" (m) path data command. PATHSEG_LINETO_ABS 4 Corresponds to an "absolute lineto" (L) path data command. PATHSEG_LINETO_REL 5 Corresponds to a "relative lineto" (l) path data command. PATHSEG_CURVETO_CUBIC_ABS 6 Corresponds to an "absolute cubic Bezier curveto" (C) path data command. PA...
...And 3 more matches
Text - Web APIs
Web › API › Text
the element contains markup, it is parsed into information items and Text nodes that form its children. New documents have a single Text node for each block of text. Over time, more Text nodes may be created as the document's content changes. The Node.normalize() method merges adjacent Text objects back into a single node for each block of text. ...
...each block of text. Over time, more Text nodes may be created as the document's content changes. The Node.normalize() method merges adjacent Text objects back into a single node for each block of text. ...
... inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 70" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monosp...
...And 3 more matches
Advanced techniques: Creating and sequencing audio - Web APIs
n. We need to add a GainNode and connect that through our audio graph to actually apply amplitude variations to our sound. The gain node has one property: gain, which is of type AudioParam. This is really useful -- now we can start to harness the power of the audio param methods on the gain value. ...
...h to actually apply amplitude variations to our sound. The gain node has one property: gain, which is of type AudioParam. This is really useful -- now we can start to harness the power of the audio param methods on the gain value. We can set a value at a certain time, or we can change it over time with methods such as AudioParam.linearRampToValueAtTime. For our attack and release, we'll use the linearRampToValueAtTime method as mentioned above. It takes two parameters -- the value you want to set the parameter you are changing to (in this case the gain) and when you want to do this. In our case when is controlled by our inputs. So in the example below the gain is being increased to 1, at a linear rate, over the time the attack range input has been set to. Similarly, for our release, the gain...
...d as mentioned above. It takes two parameters -- the value you want to set the parameter you are changing to (in this case the gain) and when you want to do this. In our case when is controlled by our inputs. So in the example below the gain is being increased to 1, at a linear rate, over the time the attack range input has been set to. Similarly, for our release, the gain is being set to 0, at a linear rate, over the time the release input has been set to. let sweepLength = 2; function playSweep() { let osc = audioCtx.createOscillator(); osc.setPeriodicWave(wave); osc.frequency.value = 440; let sweepEnv = audioCtx.createGain(); sweepEnv.gain.cancelScheduledValues(audioCtx.currentTime); sweepEnv.gain.setValueAtTime(0, audioCtx.currentTime); // set our attack s...
...And 3 more matches
Web Audio API - Web APIs
o a specific value or a change in value, and can be scheduled to happen at a specific time and following a specific pattern. AudioParamMap Provides a maplike interface to a group of AudioParam interfaces, which means it provides the methods forEach(), get(), has(), keys(), and values(), as well as a size property. BaseAudioContext The BaseAudioContext interface acts as a base definition for online and offline audio-processing graphs, as represented by AudioContext and OfflineAudioContext respectively. You wouldn't use BaseAudioContext directly -- you'd use its features via one of these two inheriting interfaces. The ended event The ended event is fired when playback has stopped because the end of the media was reached. Defining audio sources Interfaces that define audio sources for us...
...ning effects that you want to apply to your audio sources. BiquadFilterNode The BiquadFilterNode interface represents a simple low-order filter. It is an AudioNode that can represent different kinds of filters, tone control devices, or graphic equalizers. A BiquadFilterNode always has exactly one input and one output. ConvolverNode The ConvolverNode interface is an AudioNode that performs a Linear Convolution on a given AudioBuffer, and is often used to achieve a reverb effect. DelayNode The DelayNode interface represents a delay-line; an AudioNode audio-processing module that causes a delay between the arrival of an input data and its propagation to the output. DynamicsCompressorNode The DynamicsCompressorNode interface provides a compression effect, which lowers the volume of the l...
...nal in order to help prevent clipping and distortion that can occur when multiple sounds are played and multiplexed together at once. GainNode The GainNode interface represents a change in volume. It is an AudioNode audio-processing module that causes a given gain to be applied to the input data before its propagation to the output. WaveShaperNode The WaveShaperNode interface represents a non-linear distorter. It is an AudioNode that use a curve to apply a waveshaping distortion to the signal. Beside obvious distortion effects, it is often used to add a warm feeling to the signal. PeriodicWave Describes a periodic waveform that can be used to shape the output of an OscillatorNode. IIRFilterNode Implements a general infinite impulse response (IIR) filter; this type of filter can be use...
...And 3 more matches
XMLDocument - Web APIs
The XMLDocument interface represents an XML document. It inherits from the generic Document and does not add any specific methods or properties to it: nevertheless, several algorithms behave differently with the two types of documents. ...
...ts an XML document. It inherits from the generic Document and does not add any specific methods or properties to it: nevertheless, several algorithms behave differently with the two types of documents. ...
... inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 70" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monosp...
...And 3 more matches
XMLHttpRequest - Web APIs
XMLHttpRequest (XHR) objects are used to interact with servers. You can retrieve data from a URL without having to do a full page refresh. This enables a Web page to update just part of a page without disrupting what the user is doing. XMLHttpRequest is used heavily in AJAX programming. ...
...from a URL without having to do a full page refresh. This enables a Web page to update just part of a page without disrupting what the user is doing. XMLHttpRequest is used heavily in AJAX programming. ...
...inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 650 150" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/XMLHttpRequestEventTarget" target="_top"><rect x="151" y="1" width="250" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="276" y="30" font-size="12px" font-family="Consolas,Monac...
...And 3 more matches
Implementing a Microsoft Active Accessibility (MSAA) Server - Accessibility
ommands or browser commands, and the two pieces of software must remain in sync. Some screen readers can even show information on a refreshable braille display. Screen magnifiers will zoom to the focus, keeping it on the screen at all times, or even allow the user to enter a special low vision document reading mode, with a variety of features such as ticker mode where text is streamed on a single line. Finally, voice dictation software needs to know what's in the current document or UI in order to implement "say what you see" kinds of features. On Microsoft Windows, these kinds of assistive technology acquire this necessary information via a combination of hacks, MSAA and proprietary DOMs. MSAA is supposed to be the "right way" for accessibility aids to get information, but sometimes the hack...
... to implement "say what you see" kinds of features. On Microsoft Windows, these kinds of assistive technology acquire this necessary information via a combination of hacks, MSAA and proprietary DOMs. MSAA is supposed to be the "right way" for accessibility aids to get information, but sometimes the hacks are more effective. For example, screen readers look for screen draws of a vertical blinking line, to determine the location of the caret. Without doing this, screen readers would not be able to let the user know where there caret has moved to in most programs, because so many applications do not use the system caret (Gecko does not). This is so commonly done, that no one even bothers to support the MSAA caret, after all the hack is general solution works with pretty much all applications. M...
...State: a 32 bit field representing possible on/off states, such as focused, focusable, selected, selectable, visible, protected (for passwords), checked, etc. [important] get_accHelp: Get context sensitive help for the IAccessible. get_accHelpTopic: We don't use this, it's only if the Windows help system is used. get_accKeyboardShortcut: What is the keyboard shortcut for this IAccessible (underlined alt+combo mnemonic) get_accFocus: Which child is focused? [important] get_accSelection: Which children of this item are selected? get_accDefaultAction: Get a description or name of the default action for this component, such as "jump" for links. accSelect: Select the item associated with this IAccessible. [important] accLocation: Get the x,y coordinates, and the height and width of this IAc...
...And 3 more matches
additive-symbols - CSS: Cascading Style Sheets
m-ident>where <image> = <url> | <image()> | <image-set()> | <element()> | <paint()> | <cross-fade()> | <gradient>where <image()> = image( <image-tags>? [ <image-src>? , <color>? ]! ...
...<image()> | <image-set()> | <element()> | <paint()> | <cross-fade()> | <gradient>where <image()> = image( <image-tags>? [ <image-src>? , <color>? ]! ...
... | <repeating-radial-gradient()> | <conic-gradient()>where <image-tags> = ltr | rtl<image-src> = <url> | <string><color> = <rgb()> | <rgba()> | <hsl()> | <hsla()> | <hex-color> | <named-color> | currentcolor | <deprecated-system-color><image-set-option> = [ <image> | <string> ] <resolution><id-selector> = <hash-token><cf-mixing-image> = <percentage>? && <image><cf-final-image> = <image> | <color><linear-gradient()> = linear-gradient( [ <angle> | to <side-or-corner> ]? , <color-stop-list> )<repeating-linear-gradient()> = repeating-linear-gradient( [ <angle> | to <side-or-corner> ]? , <color-stop-list> )<radial-gradient()> = radial-gradient( [ <ending-shape> | <size> ]? [ at <position> ]? , <color-stop-list> )<repeating-radial-gradient()> = repeating-radial-gradient( [ <ending-shape> | <size> ]?
...And 3 more matches
negative - CSS: Cascading Style Sheets
m-ident>where <image> = <url> | <image()> | <image-set()> | <element()> | <paint()> | <cross-fade()> | <gradient>where <image()> = image( <image-tags>? [ <image-src>? , <color>? ]! ...
...<image()> | <image-set()> | <element()> | <paint()> | <cross-fade()> | <gradient>where <image()> = image( <image-tags>? [ <image-src>? , <color>? ]! ...
... | <repeating-radial-gradient()> | <conic-gradient()>where <image-tags> = ltr | rtl<image-src> = <url> | <string><color> = <rgb()> | <rgba()> | <hsl()> | <hsla()> | <hex-color> | <named-color> | currentcolor | <deprecated-system-color><image-set-option> = [ <image> | <string> ] <resolution><id-selector> = <hash-token><cf-mixing-image> = <percentage>? && <image><cf-final-image> = <image> | <color><linear-gradient()> = linear-gradient( [ <angle> | to <side-or-corner> ]? , <color-stop-list> )<repeating-linear-gradient()> = repeating-linear-gradient( [ <angle> | to <side-or-corner> ]? , <color-stop-list> )<radial-gradient()> = radial-gradient( [ <ending-shape> | <size> ]? [ at <position> ]? , <color-stop-list> )<repeating-radial-gradient()> = repeating-radial-gradient( [ <ending-shape> | <size> ]?
...And 3 more matches
pad - CSS: Cascading Style Sheets
m-ident>where <image> = <url> | <image()> | <image-set()> | <element()> | <paint()> | <cross-fade()> | <gradient>where <image()> = image( <image-tags>? [ <image-src>? , <color>? ]! ...
...<image()> | <image-set()> | <element()> | <paint()> | <cross-fade()> | <gradient>where <image()> = image( <image-tags>? [ <image-src>? , <color>? ]! ...
... | <repeating-radial-gradient()> | <conic-gradient()>where <image-tags> = ltr | rtl<image-src> = <url> | <string><color> = <rgb()> | <rgba()> | <hsl()> | <hsla()> | <hex-color> | <named-color> | currentcolor | <deprecated-system-color><image-set-option> = [ <image> | <string> ] <resolution><id-selector> = <hash-token><cf-mixing-image> = <percentage>? && <image><cf-final-image> = <image> | <color><linear-gradient()> = linear-gradient( [ <angle> | to <side-or-corner> ]? , <color-stop-list> )<repeating-linear-gradient()> = repeating-linear-gradient( [ <angle> | to <side-or-corner> ]? , <color-stop-list> )<radial-gradient()> = radial-gradient( [ <ending-shape> | <size> ]? [ at <position> ]? , <color-stop-list> )<repeating-radial-gradient()> = repeating-radial-gradient( [ <ending-shape> | <size> ]?
...And 3 more matches
prefix - CSS: Cascading Style Sheets
m-ident>where <image> = <url> | <image()> | <image-set()> | <element()> | <paint()> | <cross-fade()> | <gradient>where <image()> = image( <image-tags>? [ <image-src>? , <color>? ]! ...
...<image()> | <image-set()> | <element()> | <paint()> | <cross-fade()> | <gradient>where <image()> = image( <image-tags>? [ <image-src>? , <color>? ]! ...
... | <repeating-radial-gradient()> | <conic-gradient()>where <image-tags> = ltr | rtl<image-src> = <url> | <string><color> = <rgb()> | <rgba()> | <hsl()> | <hsla()> | <hex-color> | <named-color> | currentcolor | <deprecated-system-color><image-set-option> = [ <image> | <string> ] <resolution><id-selector> = <hash-token><cf-mixing-image> = <percentage>? && <image><cf-final-image> = <image> | <color><linear-gradient()> = linear-gradient( [ <angle> | to <side-or-corner> ]? , <color-stop-list> )<repeating-linear-gradient()> = repeating-linear-gradient( [ <angle> | to <side-or-corner> ]? , <color-stop-list> )<radial-gradient()> = radial-gradient( [ <ending-shape> | <size> ]? [ at <position> ]? , <color-stop-list> )<repeating-radial-gradient()> = repeating-radial-gradient( [ <ending-shape> | <size> ]?
...And 3 more matches
suffix - CSS: Cascading Style Sheets
m-ident>where <image> = <url> | <image()> | <image-set()> | <element()> | <paint()> | <cross-fade()> | <gradient>where <image()> = image( <image-tags>? [ <image-src>? , <color>? ]! ...
...<image()> | <image-set()> | <element()> | <paint()> | <cross-fade()> | <gradient>where <image()> = image( <image-tags>? [ <image-src>? , <color>? ]! ...
... | <repeating-radial-gradient()> | <conic-gradient()>where <image-tags> = ltr | rtl<image-src> = <url> | <string><color> = <rgb()> | <rgba()> | <hsl()> | <hsla()> | <hex-color> | <named-color> | currentcolor | <deprecated-system-color><image-set-option> = [ <image> | <string> ] <resolution><id-selector> = <hash-token><cf-mixing-image> = <percentage>? && <image><cf-final-image> = <image> | <color><linear-gradient()> = linear-gradient( [ <angle> | to <side-or-corner> ]? , <color-stop-list> )<repeating-linear-gradient()> = repeating-linear-gradient( [ <angle> | to <side-or-corner> ]? , <color-stop-list> )<radial-gradient()> = radial-gradient( [ <ending-shape> | <size> ]? [ at <position> ]? , <color-stop-list> )<repeating-radial-gradient()> = repeating-radial-gradient( [ <ending-shape> | <size> ]?
...And 3 more matches
symbols - CSS: Cascading Style Sheets
m-ident>where <image> = <url> | <image()> | <image-set()> | <element()> | <paint()> | <cross-fade()> | <gradient>where <image()> = image( <image-tags>? [ <image-src>? , <color>? ]! ...
...<image()> | <image-set()> | <element()> | <paint()> | <cross-fade()> | <gradient>where <image()> = image( <image-tags>? [ <image-src>? , <color>? ]! ...
... | <repeating-radial-gradient()> | <conic-gradient()>where <image-tags> = ltr | rtl<image-src> = <url> | <string><color> = <rgb()> | <rgba()> | <hsl()> | <hsla()> | <hex-color> | <named-color> | currentcolor | <deprecated-system-color><image-set-option> = [ <image> | <string> ] <resolution><id-selector> = <hash-token><cf-mixing-image> = <percentage>? && <image><cf-final-image> = <image> | <color><linear-gradient()> = linear-gradient( [ <angle> | to <side-or-corner> ]? , <color-stop-list> )<repeating-linear-gradient()> = repeating-linear-gradient( [ <angle> | to <side-or-corner> ]? , <color-stop-list> )<radial-gradient()> = radial-gradient( [ <ending-shape> | <size> ]? [ at <position> ]? , <color-stop-list> )<repeating-radial-gradient()> = repeating-radial-gradient( [ <ending-shape> | <size> ]?
...And 3 more matches
@media - CSS: Cascading Style Sheets
Web › CSS › @media
nment Added in Media Queries Level 5. monochrome Bits per pixel in the output device's monochrome frame buffer, or zero if the device isn't monochrome orientation Orientation of the viewport overflow-block How does the output device handle content that overflows the viewport along the block axis? Added in Media Queries Level 4. overflow-inline Can content that overflows the viewport along the inline axis be scrolled? Added in Media Queries Level 4. pointer Is the primary input mechanism a pointing device, and if so, how accurate is it? Added in Media Queries Level 4. prefers-color-scheme Detect if the user prefers a light or dark color scheme Added in Media Queries Level 5. prefers-contrast ...
...-value> [ '<' | '>' ]? '='? <mf-name> | <mf-value> '<' '='? <mf-name> '<' '='? <mf-value> | <mf-value> '>' '='? <mf-name> '>' '='? ...
... Specifications ...
...And 3 more matches
Flow Layout and Writing Modes - CSS: Cascading Style Sheets
ment link to more writing modes resources. The Writing Modes Specification The CSS Writing Modes Level 3 Specification defines the impact a change the document writing mode has on flow layout. In the writing modes introduction, the specification says, "A writing mode in CSS is determined by the writing-mode, direction, and text-orientation properties. It is defined primarily in terms of its inline base direction and block flow direction." The specification defines the inline base direction as the direction in which content is ordered on a line. This defines the start and end of the inline direction. The start is where sentences start and the end is where a line of text ends before it would begin to wrap onto a new line. The block flow direction is the direction in which boxes, for examp...
... While certain languages will use a particular writing mode or text direction, we can also use these properties for creative effect, such as running a heading vertically. The writing-mode property and block flow The writing-mode property accepts the values horizontal-tb, vertical-rl and vertical-lr. ...
...ction, we can also use these properties for creative effect, such as running a heading vertically. The writing-mode property and block flow The writing-mode property accepts the values horizontal-tb, vertical-rl and vertical-lr. These values control the direction that blocks flow on the page. The initial value is horizontal-tb, which is a top to bottom block flow direction with a horizontal inline direction. Left to right languages, such as English, and Right to left languages. such as Arabic, are all horizontal-tb. 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. The final example demonstrates the third possible value for writing-mode -- vertic...
...And 3 more matches
OpenType font features guide - CSS: Cascading Style Sheets
gs. This article provides you with all you need to know about using OpenType font features in CSS. Some fonts will have one or more of these features enabled by default (kerning and default ligatures are common examples), while others are left to the designer or developer to choose to enable in specific scenarios. In addition to broad feature sets like ligatures or lining figures (numerals that line up evenly as opposed to 'oldstyle', which look more like lower-case letters), there are also very specific ones such as stylistic sets (which might include several specific variants of glyphs meant to be used together), alternates (which might be one or more variants of the letter 'a'), or even language-specific alterations for East Asian languages. In the latter case, these alterations are actua...
... that will make a site more useful, readable, and polished: Ligatures like 'ff' or 'fi' make letter spacing and reading more even and smooth. Fractions can make home improvement and recipe sites much easier to read and understand. Numerals within paragraphs of text set as 'oldstyle' sit more comfortably between lower-case letters, and likewise setting them as 'tabular numbers' will make them line up better when setting a list of costs in a table say. 'lining' figures on the other hand sit more uniformly on their own or in front of capitalized words. While none of these features individually will render a site useless due to their absence, each of them in turn can make a site easier to use and more memorable for its attention to detail. OpenType features are like secret compartments in...
...fined per font family. This way you can create a named option that applies to only a single font, or one that is shared and can be applied more generally In this case, @stylistic(alternates) will show all the alternate characters for either font). Applying this to just the word 'My' alters the way the 'M' renders, and applying @styleset(alt-a) only changes the lower case 'a'. Try changing the line font-variant-alternates: styleset(alt-a); to font-variant-alternates: styleset(alt-g); and notice that the lower case 'a' reverts to its regular form and the lower case 'g' changes instead. More about alternates https://www.w3.org/TR/css-fonts-4/#propdef-font-variant-alternates /docs/Web/CSS/font-variant-alternates Ligatures (font-variant-ligatures) Ligatures are glyphs that replace ...
...And 3 more matches
Realizing common layouts using CSS Grid Layout - CSS: Cascading Style Sheets
to the browsers that visit your site. A flexible 12-column layout If you have been working with one of the many frameworks or grid systems you may be accustomed to laying out your site on a 12- or 16-column flexible grid. We can create this type of system using CSS Grid Layout. As a simple example, I am creating a 12-column flexible grid that has 12 1fr-unit column tracks, they all have a start line named col-start. This means that we will have twelve grid lines named col-start. .wrapper { max-width: 1024px; margin: 0 auto; font: 1.2em Helvetica, arial, sans-serif; } .wrapper > * { border: 2px solid #f08c00; background-color: #ffec99; border-radius: 5px; padding: 10px; } .wrapper { display: grid; grid-template-columns: repeat(12, [col-start] 1fr); grid-gap: 20px; } ...
...m Helvetica, arial, sans-serif; } .wrapper > * { border: 2px solid #f08c00; background-color: #ffec99; border-radius: 5px; padding: 10px; } .wrapper { display: grid; grid-template-columns: repeat(12, [col-start] 1fr); grid-gap: 20px; } To demonstrate how this grid system works I have four child elements inside my wrapper. <div class="wrapper"> <div class="item1">Start column line 1, span 3 column tracks.</div> <div class="item2">Start column line 6, span 4 column tracks. 2 row tracks.</div> <div class="item3">Start row 2 column line 2, span 2 column tracks.</div> <div class="item4">Start at column line 3, span to the end of the grid (-1).</div> </div> I can then place these on the grid using the named lines, and also the span keyword. .item1 { grid-column: col-...
... end of the grid (-1).</div> </div> I can then place these on the grid using the named lines, and also the span keyword. .item1 { grid-column: col-start / span 3; } .item2 { grid-column: col-start 6 / span 4 ; grid-row: 1 / 3; } .item3 { grid-column: col-start 2 / span 2; grid-row: 2; } .item4 { grid-column: col-start 3 / -1; grid-row: 3; } As described in the guide to named lines, we are using the named line to place our item. As we have 12 lines all with the same name we use the name, and then the index of the line. You could also use the line index itself if you prefer and avoid using named lines at all. Rather than setting the end line number, I have chosen to say how many tracks this element should span, using the span keyword. I like this approach as when working w...
...And 3 more matches
Relationship of grid layout to other layout methods - CSS: Cascading Style Sheets
x solid #ffa94d; border-radius: 5px; background-color: #ffd8a8; padding: 1em; color: #d9480f; } <div class="wrapper"> <div>One</div> <div>Two</div> <div>Three</div> <div>Four</div> <div>Five</div> </div> .wrapper { width: 500px; display: flex; flex-wrap: wrap; } .wrapper > div { flex: 1 1 150px; } In the image, you can see that two items have wrapped onto a new line. These items are sharing the available space and not lining up underneath the items above. This is because when you wrap flex items, each new row (or column when working by column) becomes a new flex container. Space distribution happens across the row. A common question then is how to make those items line up. This is where you want a two-dimensional layout method: You want to control the align...
...to the one-dimensional versus two-dimensional distinction, there is another way to decide if you should use flexbox or grid for a layout. Flexbox works from the content out. An ideal use case for flexbox is when you have a set of items and want to space them out evenly in a container. You let the size of the content decide how much individual space each item takes up. If the items wrap onto a new line, they will work out their spacing based on their size and the available space on that line. Grid works from the layout in. When you use CSS Grid Layout you create a layout and then you place items into it, or you allow the auto-placement rules to place the items into the grid cells according to that strict grid. It is possible to create tracks that respond to the size of the content, however, th...
...es to place the items into the grid cells according to that strict grid. It is possible to create tracks that respond to the size of the content, however, they will also change the entire track. If you are using flexbox and find yourself disabling some of the flexibility, you probably need to use CSS Grid Layout. An example would be if you are setting a percentage width on a flex item to make it line up with other items in a row above. In that case, a grid is likely to be a better choice. Box alignment The feature of flexbox that was most exciting to many of us was that it gave us proper alignment control for the first time. It made it easy to center a box on the page. Flex items can stretch to the height of the flex container, meaning that equal height columns were possible. These were thi...
...And 3 more matches
Pseudo-elements - CSS: Cascading Style Sheets
Syntax selector::pseudo-element { property: value; } You can use only one pseudo-element in a selector. It must appear after the simple selectors in the statement. ...
... Syntax selector::pseudo-element { property: value; } You can use only one pseudo-element in a selector. It must appear after the simple selectors in the statement. ...
... Syntax selector::pseudo-element { property: value; } You can use only one pseudo-element in a selector. It must appear after the simple selectors in the statement. ...
...And 3 more matches
Using CSS custom properties (variables) - CSS: Cascading Style Sheets
ecifying your custom property name inside the var() function, in place of a regular property value: element { background-color: var(--main-bg-color); } First steps with custom properties Let's start with this simple CSS that applies the same color to elements of different classes: .one { color: white; background-color: brown; margin: 10px; width: 50px; height: 50px; display: inline-block; } .two { color: white; background-color: black; margin: 10px; width: 150px; height: 70px; display: inline-block; } .three { color: white; background-color: brown; margin: 10px; width: 75px; } .four { color: white; background-color: brown; margin: 10px; width: 100px; } .five { background-color: brown; } We'll apply it to this HTML: <div> <div class="one"...
...his problem naturally. For non-trivial projects, this is not always possible. ...
...do-class and using it where needed throughout the document, a CSS author can reduce the need for repetition: :root { --main-bg-color: brown; } .one { color: white; background-color: var(--main-bg-color); margin: 10px; width: 50px; height: 50px; display: inline-block; } .two { color: white; background-color: black; margin: 10px; width: 150px; height: 70px; display: inline-block; } .three { color: white; background-color: var(--main-bg-color); margin: 10px; width: 75px; } .four { color: white; background-color: var(--main-bg-color); margin: 10px; width: 100px; } .five { background-color: var(--main-bg-color); } <div> <div class="one"></div> <div class="two">Text <span class="five">- more text</span></div> <input class="three"> ...
...And 3 more matches
animation-timing-function - CSS: Cascading Style Sheets
oject, please clone https://github.com/mdn/interactive-examples and send us a pull request. It is often convenient to use the shorthand property animation to set all animation properties at once. ...
... the next keyframe specifying that property, or until the end of the animation if there is no subsequent keyframe specifying that property. As a result, an animation-timing-function specified on the 100% or to keyframe will never be used. Values <timing-function> The timing function that corresponds to a given animation, as determined by animation-name. The non-step keyword values (ease, linear, ease-in-out, etc.) each represent cubic Bezier curve with fixed four point values, with the cubic-bezier() function value allowing for a non-predefined value. The step timing functions divides the input time into a specified number of intervals that are equal in length. It is defined by a number of steps and a step position. ease Equal to cubic-bezier(0.25, 0.1, 0.25, 1.0), the default val...
...e cubic-bezier() function value allowing for a non-predefined value. The step timing functions divides the input time into a specified number of intervals that are equal in length. It is defined by a number of steps and a step position. ease Equal to cubic-bezier(0.25, 0.1, 0.25, 1.0), the default value, increases in velocity towards the middle of the animation, slowing back down at the end. linear Equal to cubic-bezier(0.0, 0.0, 1.0, 1.0), animates at an even speed. ease-in Equal to cubic-bezier(0.42, 0, 1.0, 1.0), starts off slowly, with the speed of the transition of the animating properting increasing until complete. ease-out Equal to cubic-bezier(0, 0, 0.58, 1.0), starts quickly, slowing down the animation continues. o ease-in-out Equal to cubic-bezier(0.42, 0, 0.58, 1.0), wit...
...And 3 more matches
animation - CSS: Cascading Style Sheets
Web › CSS › animation
ory. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...PLAY"></button> </div> <div class="cell flx"> <div class="overlay">animation: 3s ease-in 1s 2 reverse both paused slidein;</div> <div class="animation a1"></div> </div> </div> <div class="row"> <div class="cell"> <button class="pause" title="PAUSE"></button> </div> <div class="cell flx"> <div class="overlay">animation: 3s linear 1s slidein;</div> <div class="animation a2"></div> </div> </div> <div class="row"> <div class="cell"> <button class="pause" title="PAUSE"></button> </div> <div class="cell flx"> <div class="overlay">animation: 3s slidein;</div> <div class="animation a3"></div> </div> </div> </div> </div> html,body { height: 100%; b...
...: #FFF; overflow: hidden; text-align: left; } .flx { flex: 1 0; } .note { background: #fff3d4; padding: 1em; margin: .5em; font: .8em sans-serif; text-align: left; flex: none; } .overlay { padding: .5em; } @keyframes slidein { from { transform: scaleX(0); } to { transform: scaleX(1); } } .a1 { animation: 3s ease-in 1s 2 reverse both paused slidein; } .a2 { animation: 3s linear 1s slidein; } .a3 { animation: 3s slidein; } .animation { background: #3F87A6; width: 100%; height: calc(100% - 1.5em); transform-origin: left center; } window.addEventListener('load', function () { var ANIMATION = Array.from(document.querySelectorAll('.animation')); var BUTTON = Array.from(document.querySelectorAll('button')); function toggleButton (btn, type) { btn.cla...
...And 3 more matches
clear - CSS: Cascading Style Sheets
Web › CSS › clear
f you want it to always be able to resize, so that it contains floating elements inside it, you need to self-clear its children. This is called clearfix, and one way to do it is to add clear to a replaced ::after pseudo-element on it. #container::after { content: ""; display: block; clear: both; } Syntax /* Keyword values */ clear: none; clear: left; clear: right; clear: both; clear: inline-start; clear: inline-end; /* Global values */ clear: inherit; clear: initial; clear: unset; Values none Is a keyword indicating that the element is not moved down to clear past floating elements. left Is a keyword indicating that the element is moved down to clear past left floats. right Is a keyword indicating that the element is moved down to clear past right floats. both Is a keyw...
...t; Values none Is a keyword indicating that the element is not moved down to clear past floating elements. left Is a keyword indicating that the element is moved down to clear past left floats. right Is a keyword indicating that the element is moved down to clear past right floats. both Is a keyword indicating that the element is moved down to clear past both left and right floats. inline-start Is a keyword indicating that the element is moved down to clear floats on start side of its containing block, that is the left floats on ltr scripts and the right floats on rtl scripts. inline-end Is a keyword indicating that the element is moved down to clear floats on end side of its containing block, that is the right floats on ltr scripts and the left floats on rtl scripts. Formal ...
...Phasellus sit amet diam. Duis mattis varius dui. ...
...And 3 more matches
initial-letter - CSS: Cascading Style Sheets
The initial-letter CSS property sets styling for dropped, raised, and sunken initial letters. /* Keyword values */ initial-letter: normal; /* Numeric values */ initial-letter: 1.5; /* Initial letter occupies 1.5 lines */ initial-letter: 3.0; /* Initial letter occupies 3 lines */ initial-letter: 3.0 2; /* Initial letter occupies 3 lines and sinks 2 lines */ /* Global values */ initial-letter: inherit; initial-letter: initial; initial-letter: unset; Syntax The keyword value normal, or a <number> optionally followed by an <integer>. Values normal No special initial-letter effect. Text behaves as normal. <number> Defines the size of the initial letter, in terms of how many lines it occupies. Negative values are not allowed. <integer> Defines the n...
... */ initial-letter: inherit; initial-letter: initial; initial-letter: unset; Syntax The keyword value normal, or a <number> optionally followed by an <integer>. Values normal No special initial-letter effect. Text behaves as normal. <number> Defines the size of the initial letter, in terms of how many lines it occupies. Negative values are not allowed. <integer> Defines the number of lines the initial letter should sink when the size of it is given. ...
... initial letter, in terms of how many lines it occupies. Negative values are not allowed. <integer> Defines the number of lines the initial letter should sink when the size of it is given. Values must be greater than zero. If omitted, it duplicates the size value, floored to the nearest positive whole number. ...
...And 3 more matches
place-items - CSS: Cascading Style Sheets
the align-items and justify-items properties) in a relevant layout system such as Grid or Flexbox. If the second value is not set, the first value is also used for it. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
... align-items justify-items Syntax /* Keyword values */ place-items: auto center; place-items: normal start; /* Positional alignment */ place-items: center normal; place-items: start auto; place-items: end normal; place-items: self-start auto; place-items: self-end normal; place-items: flex-start auto; place-items: flex-end normal; place-items: left auto; place-items: right normal; /* Baseline alignment */ place-items: baseline normal; place-items: first baseline auto; place-items: last baseline normal; place-items: stretch auto; /* Global values */ place-items: inherit; place-items: initial; place-items: unset; Values auto The value used is the value of the justify-items property of the parents box, unless the box has no parent, or is absolutely positioned, in these cases, auto...
...he appropriate axis. self-end The item is packed flush to the edge of the alignment container of the end side of the item, in the appropriate axis. center The items are packed flush to each other toward the center of the of the alignment container. left The items are packed flush to each other toward the left edge of the alignment container. ...
...And 3 more matches
resize - CSS: Cascading Style Sheets
Web › CSS › resize
ement is resizable, and if so, in which directions. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Syntax /* Keyword values */ resize: none; resize: both; resize: horizontal; resize: vertical; resize: block; resize: inline; /* Global values */ resize: inherit; resize: initial; resize: unset; The resize property is specified as a single keyword value from the list below. Values none The element offers no user-controllable method for resizing it. both The element displays a mechanism for allowing the user to resize it, which may be resized both horizontally and vertically. horizontal The element displays...
...tal The element displays a mechanism for allowing the user to resize it in the horizontal direction. vertical The element displays a mechanism for allowing the user to resize it in the vertical direction. block The element displays a mechanism for allowing the user to resize it in the block direction (either horizontally or vertically, depending on the writing-mode and direction value). ...
...ontal direction. vertical The element displays a mechanism for allowing the user to resize it in the vertical direction. block The element displays a mechanism for allowing the user to resize it in the block direction (either horizontally or vertically, depending on the writing-mode and direction value). ...
...And 3 more matches
transition-delay - CSS: Cascading Style Sheets
/div> </div> .parent { width: 250px; height:125px;} .box { width: 100px; height: 100px; background-color: red; font-size: 20px; left: 0px; top: 0px; position:absolute; -webkit-transition-property: width height background-color font-size left top color; -webkit-transition-duration:2s; -webkit-transition-delay:0.5s; -webkit-transition-timing-function: linear; transition-property: width height background-color font-size left top color; transition-duration:2s; transition-delay:0.5s; transition-timing-function: linear; } .box1{ width: 50px; height: 50px; background-color: blue; color: yellow; font-size: 18px; left: 150px; top:25px; position:absolute; -webkit-transition-property: width height backgro...
...nsition-timing-function: linear; } .box1{ width: 50px; height: 50px; background-color: blue; color: yellow; font-size: 18px; left: 150px; top:25px; position:absolute; -webkit-transition-property: width height background-color font-size left top color; -webkit-transition-duration:2s; -webkit-transition-delay:0.5s; -webkit-transition-timing-function: linear; transition-property: width height background-color font-size left top color; transition-duration:2s; transition-delay:0.5s; transition-timing-function: linear; } function updateTransition() { var el = document.querySelector("div.box"); if (el) { el.className = "box1"; } else { el = document.querySelector("div.box1"); el.className = "box"; } return el; ...
...</div> </div> .parent { width: 250px; height:125px;} .box { width: 100px; height: 100px; background-color: red; font-size: 20px; left: 0px; top: 0px; position:absolute; -webkit-transition-property: width height background-color font-size left top color; -webkit-transition-duration:2s; -webkit-transition-delay:1s; -webkit-transition-timing-function: linear; transition-property: width height background-color font-size left top color; transition-duration:2s; transition-delay:1s; transition-timing-function: linear; } .box1{ width: 50px; height: 50px; background-color: blue; color: yellow; font-size: 18px; left: 150px; top:25px; position:absolute; -webkit-transition-property: width height background...
...And 3 more matches
transition-timing-function - CSS: Cascading Style Sheets
of values until there is one for each transition property. If there are more timing functions, the list is simply truncated to the right size. In both cases, the CSS declaration stays valid. ...
...function: ease, step-start, cubic-bezier(0.1, 0.7, 1.0, 0.1); /* Global values */ transition-timing-function: inherit; transition-timing-function: initial; transition-timing-function: unset; Values <timing-function> Each <timing-function> represents the timing function to link to the corresponding property to transition, as defined in transition-property. The non-step keyword values (ease, linear, ease-in-out, etc.) each represent cubic Bezier curve with fixed four point values, with the cubic-bezier() function value allowing for a non-predefined value. The step timing functions divides the input time into a specified number of intervals that are equal in length. It is defined by a number of steps and a step position. ease Equal to cubic-bezier(0.25, 0.1, 0.25, 1.0), the default ...
...ic-bezier() function value allowing for a non-predefined value. The step timing functions divides the input time into a specified number of intervals that are equal in length. It is defined by a number of steps and a step position. ease Equal to cubic-bezier(0.25, 0.1, 0.25, 1.0), the default value, increases in velocity towards the middle of the transition, slowing back down at the end. linear Equal to cubic-bezier(0.0, 0.0, 1.0, 1.0), transitions at an even speed. ease-in Equal to cubic-bezier(0.42, 0, 1.0, 1.0), starts off slowly, with the transition speed increasing until complete. ease-out Equal to cubic-bezier(0, 0, 0.58, 1.0), starts transitioning quickly, slowing down the transition continues. o ease-in-out Equal to cubic-bezier(0.42, 0, 0.58, 1.0), starts transi...
...And 3 more matches
<audio>: The Embed Audio element - HTML: Hypertext Markup Language
Web › HTML › Element › audio
ge, the time at which playback will begin. Otherwise, setting currentTime sets the current playback position to the given time and seeks the media to that position if the media is currently loaded. If the audio is being streamed, it's possible that the user agent may not be able to obtain some parts of the resource if that data has expired from the media buffer. ...
...eks the media to that position if the media is currently loaded. If the audio is being streamed, it's possible that the user agent may not be able to obtain some parts of the resource if that data has expired from the media buffer. Other audio may have a media timeline that doesn't start at 0 seconds, so setting currentTime to a time before that would fail. For example, if the audio's media timeline starts at 12 hours, setting currentTime to 3600 would be an attempt to set the current playback position well before the beginning of the media, and would fail. The getStartDate() method can be used to determine the beginning point of the media timeline's reference frame. disableRemotePlayback A Boolean attribute used to disable the capability of remote playback in devices that are attached...
...k in devices that are attached using wired (HDMI, DVI, etc.) and wireless technologies (Miracast, Chromecast, DLNA, AirPlay, etc). See this proposed specification for more information. In Safari, you can use x-webkit-airplay="deny" as a fallback. duration Read only A double-precision floating-point value which indicates the duration (total length) of the audio in seconds, on the media's timeline. If no media is present on the element, or the media is not valid, the returned value is NaN. If the media has no known end (such as for live streams of unknown duration, web radio, media incoming from WebRTC, and so forth), this value is +Infinity. loop A Boolean attribute: if specified, the audio player will automatically seek back to the start upon reaching the end of the audio. muted A Bo...
...And 3 more matches
<input>: The Input (Form Input) element - HTML: Hypertext Markup Language
Web › HTML › Element › input
month A control for entering a month and year, with no time zone. <input type="month" name="month"/> HTML5 number A control for entering a number. Displays a spinner and adds default validation when supported. Displays a numeric keypad in some devices with dynamic keypads. <input type="number" name="number"/> HTML5 password A single-line text field whose value is obscured. Will alert user if site is not secure. <input type="password" name="password"/> radio A radio button, allowing a single value to be selected out of multiple choices with the same name value. <input type="radio" name="radio"/> range A control for entering a number whose exact value is not important. Displa...
...ot important. Displays as a range widget defaulting to the middle value. Used in conjunction min and max to define the range of acceptable values. <input type="range" name="range" min="0" max="25"/> HTML5 reset A button that resets the contents of the form to default values. Not recommended. <input type="reset" name="reset"/> search A single-line text field for entering search strings. Line-breaks are automatically removed from the input value. May include a delete icon in supporting browsers that can be used to clear the field. Displays a search icon instead of enter key on some devices with dynamic keypads. <input type="search" name="search"/> HTML5 submit A button that submits the form. <input type="...
...amic keypads. <input type="search" name="search"/> HTML5 submit A button that submits the form. <input type="submit" name="submit"/> tel A control for entering a telephone number. Displays a telephone keypad in some devices with dynamic keypads. <input type="tel" name="tel"/> HTML5 text The default value. A single-line text field. Line-breaks are automatically removed from the input value. <input type="text" name="text"/> time A control for entering a time value with no time zone. <input type="time" name="time"/> HTML5 url A field for entering a URL. Looks like a text input, but has validation parameters and relevant keyboard in supporting browsers and dev...
...And 3 more matches
<video>: The Video Embed element - HTML: Hypertext Markup Language
Web › HTML › Element › video
, the time offset at which it will begin is returned. Setting currentTime sets the current playback position to the given time and seeks the media to that position if the media is currently loaded. If the media is being streamed, it's possible that the user agent may not be able to obtain some parts of the resource if that data has expired from the media buffer. Other media may have a media timeline that doesn't start at 0 seconds, so setting currentTime to a time before that would fail. The getStartDate() method can be used to determine the beginning point of the media timeline's reference frame. disablePictureInPicture Prevents the browser from suggesting a Picture-in-Picture context menu or to request Picture-in-Picture automatically in some cases. disableRemotePlayback A Boolea...
...ibute used to disable the capability of remote playback in devices that are attached using wired (HDMI, DVI, etc.) and wireless technologies (Miracast, Chromecast, DLNA, AirPlay, etc). In Safari, you can use x-webkit-airplay="deny" as a fallback. duration Read only A double-precision floating-point value which indicates the duration (total length) of the media in seconds, on the media's timeline. If no media is present on the element, or the media is not valid, the returned value is NaN. If the media has no known end (such as for live streams of unknown duration, web radio, media incoming from WebRTC, and so forth), this value is +Infinity. height The height of the video's display area, in CSS pixels (absolute values only; no percentages.) intrinsicsize This attribute tells the bro...
.... Explainer, examples loop A Boolean attribute; if specified, the browser will automatically seek back to the start upon reaching the end of the video. muted A Boolean attribute that indicates the default setting of the audio contained in the video. If set, the audio will be initially silenced. Its default value is false, meaning that the audio will be played when the video is played. playsinline A Boolean attribute indicating that the video is to be played "inline", that is within the element's playback area. Note that the absence of this attribute does not imply that the video will always be played in fullscreen. poster A URL for an image to be shown while the video is downloading. If this attribute isn't specified, nothing is displayed until the first frame is available, then the fi...
...And 3 more matches
CSP: base-uri - HTTP
default-src fallback No. Not setting this allows any URL. Syntax One or more sources can be allowed for the base-uri policy: Content-Security-Policy: base-uri <source>; Content-Security-Policy: base-uri <source> <source>; Sources While this directive uses the same arguments as other CSP directives, some of them don't make sense for `<base>`, such as the keywords 'unsafe-inline' and 'strict-dynamic' <source> can be one of the following: <host-source> Internet hosts by name or IP address, as well as an optional URL scheme and/or port number. The site's address may include an optional leading wildcard (the asterisk character, '*'), and you may use a wildcard (again, '*') as the port number, indicating that all legal ports are valid for the source. Examples: htt...
... scheme and port number. You must include the single quotes. Some browsers specifically exclude blob and filesystem from source directives. Sites needing to allow these content types can specify them using the Data attribute. 'unsafe-eval' Allows the use of eval() and similar methods for creating code from strings. You must include the single quotes. 'unsafe-hashes' Allows enabling specific inline event handlers. If you only need to allow inline event handlers and not inline <script> elements or javascript: URLs, this is a safer method than using the unsafe-inline expression. 'unsafe-inline' Allows the use of inline resources, such as inline <script> elements, javascript: URLs, inline event handlers, and inline <style> elements. The single quotes are required. 'none' Refers to the empt...
..., this is a safer method than using the unsafe-inline expression. 'unsafe-inline' Allows the use of inline resources, such as inline <script> elements, javascript: URLs, inline event handlers, and inline <style> elements. The single quotes are required. 'none' Refers to the empty set; that is, no URLs match. The single quotes are required. 'nonce-<base64-value>' An allow-list for specific inline scripts using a cryptographic nonce (number used once). The server must generate a unique nonce value each time it transmits a policy. It is critical to provide an unguessable nonce, as bypassing a resource's policy is otherwise trivial. See unsafe inline script for an example. ...
...And 3 more matches
CSP: form-action - HTTP
scheme and port number. You must include the single quotes. Some browsers specifically exclude blob and filesystem from source directives. Sites needing to allow these content types can specify them using the Data attribute. 'unsafe-eval' Allows the use of eval() and similar methods for creating code from strings. You must include the single quotes. 'unsafe-hashes' Allows enabling specific inline event handlers. If you only need to allow inline event handlers and not inline <script> elements or javascript: URLs, this is a safer method than using the unsafe-inline expression. 'unsafe-inline' Allows the use of inline resources, such as inline <script> elements, javascript: URLs, inline event handlers, and inline <style> elements. The single quotes are required. 'none' Refers to the empt...
..., this is a safer method than using the unsafe-inline expression. 'unsafe-inline' Allows the use of inline resources, such as inline <script> elements, javascript: URLs, inline event handlers, and inline <style> elements. The single quotes are required. 'none' Refers to the empty set; that is, no URLs match. The single quotes are required. 'nonce-<base64-value>' An allow-list for specific inline scripts using a cryptographic nonce (number used once). The server must generate a unique nonce value each time it transmits a policy. It is critical to provide an unguessable nonce, as bypassing a resource's policy is otherwise trivial. See unsafe inline script for an example. ...
... '<hash-algorithm>-<base64-value>' A sha256, sha384 or sha512 hash of scripts or styles. The use of this source consists of two portions separated by a dash: the encryption algorithm used to create the hash and the base64-encoded hash of the script or style. ...
...And 3 more matches
CSP: script-src-attr - HTTP
CSP version 3 Directive type Fetch directive default-src fallback Yes. If this directive is absent, the user agent will look for the script-src directive, and if both of them are absent, fallback to default-src directive. ...
... scheme and port number. You must include the single quotes. Some browsers specifically exclude blob and filesystem from source directives. Sites needing to allow these content types can specify them using the Data attribute. 'unsafe-eval' Allows the use of eval() and similar methods for creating code from strings. You must include the single quotes. 'unsafe-hashes' Allows enabling specific inline event handlers. If you only need to allow inline event handlers and not inline <script> elements or javascript: URLs, this is a safer method than using the unsafe-inline expression. 'unsafe-inline' Allows the use of inline resources, such as inline <script> elements, javascript: URLs, inline event handlers, and inline <style> elements. The single quotes are required. 'none' Refers to the empt...
..., this is a safer method than using the unsafe-inline expression. 'unsafe-inline' Allows the use of inline resources, such as inline <script> elements, javascript: URLs, inline event handlers, and inline <style> elements. The single quotes are required. 'none' Refers to the empty set; that is, no URLs match. The single quotes are required. 'nonce-<base64-value>' An allow-list for specific inline scripts using a cryptographic nonce (number used once). The server must generate a unique nonce value each time it transmits a policy. It is critical to provide an unguessable nonce, as bypassing a resource's policy is otherwise trivial. See unsafe inline script for an example. ...
...And 3 more matches
CSP: script-src-elem - HTTP
CSP version 3 Directive type Fetch directive default-src fallback Yes. If this directive is absent, the user agent will look for the script-src directive, and if both of them are absent, fallback to default-src directive. ...
... scheme and port number. You must include the single quotes. Some browsers specifically exclude blob and filesystem from source directives. Sites needing to allow these content types can specify them using the Data attribute. 'unsafe-eval' Allows the use of eval() and similar methods for creating code from strings. You must include the single quotes. 'unsafe-hashes' Allows enabling specific inline event handlers. If you only need to allow inline event handlers and not inline <script> elements or javascript: URLs, this is a safer method than using the unsafe-inline expression. 'unsafe-inline' Allows the use of inline resources, such as inline <script> elements, javascript: URLs, inline event handlers, and inline <style> elements. The single quotes are required. 'none' Refers to the empt...
..., this is a safer method than using the unsafe-inline expression. 'unsafe-inline' Allows the use of inline resources, such as inline <script> elements, javascript: URLs, inline event handlers, and inline <style> elements. The single quotes are required. 'none' Refers to the empty set; that is, no URLs match. The single quotes are required. 'nonce-<base64-value>' An allow-list for specific inline scripts using a cryptographic nonce (number used once). The server must generate a unique nonce value each time it transmits a policy. It is critical to provide an unguessable nonce, as bypassing a resource's policy is otherwise trivial. See unsafe inline script for an example. ...
...And 3 more matches
A typical HTTP session - HTTP
Web › HTTP › Session
ping the server periodically via the XMLHTTPRequest, Fetch APIs, using the WebSockets API, or similar protocols. Sending a client request Once the connection is established, the user-agent can send the request (a user-agent is typically a web browser, but can be anything else, a crawler, for example). ...
..., Fetch APIs, using the WebSockets API, or similar protocols. Sending a client request Once the connection is established, the user-agent can send the request (a user-agent is typically a web browser, but can be anything else, a crawler, for example). ...
...browser, but can be anything else, a crawler, for example). A client request consists of text directives, separated by CRLF (carriage return, followed by line feed), divided into three blocks: The first line contains a request method followed by its parameters: the path of the document, i.e. an absolute URL without the protocol or domain name the HTTP protocol version Subsequent lines represent an HTTP header, giving the server information about what type of data is appropriate (e.g., what language, what MIME types), or other data altering its behavior (e.g., not sending an answer if it is already cached). These HTTP headers form a block which ends with an empty line. The final block is an optional data block, which may contain further data mainly used by the POST method. ...
...And 3 more matches
Assertions - JavaScript
Assertions include boundaries, which indicate the beginnings and endings of lines and words, and other patterns indicating in some way that a match is possible (including look-ahead, look-behind, and conditional expressions). Types The following section is also duplicated on this cheatsheet. Do not forget to edit it as well, thanks! ...
... endings of lines and words, and other patterns indicating in some way that a match is possible (including look-ahead, look-behind, and conditional expressions). Types The following section is also duplicated on this cheatsheet. Do not forget to edit it as well, thanks! ...
...in some way that a match is possible (including look-ahead, look-behind, and conditional expressions). Types The following section is also duplicated on this cheatsheet. Do not forget to edit it as well, thanks! Boundary-type assertions Characters Meaning ^ Matches the beginning of input. If the multiline flag is set to true, also matches immediately after a line break character. For example, /^A/ does not match the "A" in "an A", but does match the first "A" in "An A". This character has a different meaning when it appears at the start of a group. $ Matches the end of input. If the multiline flag is set to true, also matches immediately before a line break character. For example, /t$/ does not match the "t" in "eater",...
...And 3 more matches
Regular expression syntax cheatsheet - JavaScript
f you need more information on a specific topic, please follow the link on the corresponding heading to access the full article or head to the guide. Character classes If you are looking to contribute to this document, please also edit the original article Characters Meaning . ...
...riginal article Characters Meaning . Has one of the following meanings: Matches any single character except line terminators: \n, \r, \u2028 or \u2029. For example, /.y/ matches "my" and "ay", but not "yes", in "yes make my day". Inside a character set, the dot loses its special meaning and matches a literal dot. Note that the m multiline flag doesn't change the dot behavior. So to match a pattern across multiple lines, the character set [^] can be used -- it will match any character including newlines. ES2018 added the s "dotAll" flag, which allows the dot to also match line terminators. \d Matches any digit (Arabic numeral). Equivalent to [0-9]. For example, /\d/ or /[0-9]/ matches "2" in "B2 is the sui...
...core. Equivalent to [A-Za-z0-9_]. For example, /\w/ matches "a" in "apple", "5" in "$5.28", and "3" in "3D". \W Matches any character that is not a word character from the basic Latin alphabet. Equivalent to [^A-Za-z0-9_]. For example, /\W/ or /[^A-Za-z0-9_]/ matches "%" in "50%". \s Matches a single white space character, including space, tab, form feed, line feed, and other Unicode spaces. Equivalent to [ \f\n\r\t\v\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]. For example, /\s\w*/ matches " bar" in "foo bar". \S Matches a single character other than white space. Equivalent to [^ \f\n\r\t\v\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]. For example, /\S\w*/ matches "foo" in "foo bar". ...
...And 3 more matches
Web video codec guide - Web media technologies
3GP, Ogg, WebM VP9 Video Processor 9 MP4, Ogg, WebM Factors affecting the encoded video As is the case with any encoder, there are two basic groups of factors affecting the size and quality of the encoded video: specifics about the source video's format and contents, and the characteristics and configuration of the codec used while encoding the video. The simplest guideline is this: anything that makes the encoded video look more like the original, uncompressed, video will generally make the resulting data larger as well. Thus, it's always a tradeoff of size versus quality. In some situations, a greater sacrifice of quality in order to bring down the data size is worth that lost quality; other times, the loss of quality is unacceptable and it's necessary to accept a...
... Wagon-wheel effect The wagon-wheel effect (or stroboscopic effect) is the visual effect that's commonly seen in film, in which a turning wheel appears to rotate at the wrong speed, or even in reverse, due to an interaction between the frame rate and the compression algorithm. The same effect can occur with any repeating pattern that moves, such as the ties on a railway line, posts along the side of a road, and so forth. This is a temporal (time-based) aliasing issue; the speed of the rotation interferes with the frequency of the sampling performed during compression or encoding. Color edging Color edging is a type of visual artifact that presents as spurious colors introduced along the edges of colored objects within the scene. These colors have no i...
...) standard is specified by the identical ITU H.264 specification and the MPEG-4 Part 10 specification. It's a motion compensation based codec that is widely used today for all sorts of media, including broadcast television, RTP videoconferencing, and as the video codec for Blu-Ray discs. AVC is highly flexible, with a number of profiles with varying capabilities; for example, the Constrained Baseline Profile is designed for use in videoconferencing and mobile scenarios, using less bandwidth than the Main Profile (which is used for standard definition digital TV in some regions) or the High Profile (used for Blu-Ray Disc video). Most of the profiles use 8-bit color components and 4:2:0 chroma subsampling; The High 10 Profile adds support for 10-bit color, and advanced forms of High 10 add 4:2:...
...And 3 more matches
The "codecs" parameter in common media types - Web media technologies
ximum video dimensions are supported. AVC profiles The following are the AVC profiles and their profile numbers for use in the codecs parameter, as well as the value to specify for the constraints component, CC. Specifying an AVC profiles using the profile ID and constraints components of the codecs parameter Profile Number (Hex) Constraints byte Constrained Baseline Profile (CBP) CBP is primarily a solution for scenarios in which resources are constrained, or resource use needs to be controlled to minimize the odds of the media performing poorly. 42 40 Baseline Profile (BP) Similar to CBP but with more data loss protections and recovery capabilities. This is not as widely used as it was before CBP was introduced. All CBP streams are co...
...ofessional apps. 6E 10 High 4:2:2 Intra Profile The Hi422 Profile with all-intra-frame use. 7A 10 High 4:4:4 Intra Profile The High 4:4:4 Profile constrained to use only intra frames. F4 10 CAVLC 4:4:4 Intra Profile The High 4:4:4 Profile constrained to all-intra use, and to using only CAVLC entropy coding. 44 00 Scalable Baseline Profile Intended for use with video conferencing as well as surveillance and mobile uses, the SVC Baseline Profile is based on AVC's Constrained Baseline profile. The base layer within the stream is provided at a high quality level, with some number of secondary substreams that offer alternative forms of the same video for use in various constrained environments. These may include any combina...
...Not yet supported by WebRTC, but an extension to the WebRTC API to allow SVC is in development. 53 04 Scalable High Profile Meant mostly for use in broadcast and streaming applications. The base (or highest quality) layer must conform to the AVC High Profile. ...
...And 3 more matches
Performance fundamentals - Web Performance
draw to canvases using either a familiar 2D drawing API, or WebGL, a "close to the metal" binding that mostly follows OpenGL ES 2.0. Gecko rendering The Gecko JavaScript engine supports just-in-time (JIT) compilation. This enables application logic to perform comparably to other virtual machines -- such as Java virtual machines -- and in some cases even close to "native code". The graphics pipeline in Gecko that underpins HTML, CSS, and Canvas is optimized in several ways. The HTML/CSS layout and graphics code in Gecko reduces invalidation and repainting for common cases like scrolling; developers get this support "for free". Pixel buffers painted by both Gecko "automatically" and applications to canvas "manually" minimize copies when being drawn to the display framebuffer. This is done by ...
...tion hardware, while the GPU idles or turns off. Fully static content is the exception rather than the rule for rich applications. Rich applications use dynamic content with animation and transition effects. Transitions and animations are particularly important to applications: developers can use CSS to declare complicated behaviour with a simple, high-level syntax. In turn, Gecko's graphics pipeline is highly optimized to render common animations efficiently. Common-case animations are "offloaded" to the system compositor, which can render them in a performant, power-efficient fashion. An app's startup performance matters just as much as its runtime performance. Gecko is optimized to load a wide variety of content efficiently: the entire Web! Many years of improvements targeting this conten...
...tion doesn't have to wait. Note: For much more information on improving startup performance, read Optimizing startup performance. On the same note, notice that locally-cached, static resources can be loaded much faster than dynamic data fetched over high-latency, low-bandwidth mobile networks. Network requests should never be on the critical path to early application startup. Local caching/offline apps can be achieved via Service Workers. See Making PWAs work offline with Service workers for a guide as to how. Framerate The first important thing for high framerate is to choose the right tool. Use HTML and CSS to implement content that's mostly static, scrolled, and infrequently animated. Use Canvas to implement highly dynamic content, like games that need tight control over rendering and...
...And 3 more matches
Progressive web app structure - Progressive web apps (PWAs)
page load is quick because of the SSR, and the navigation between pages is smooth because the client can re-render the page with only the parts that have changed. PWAs can be built using any approach you like, but some will work better than the others. ...
...That way, the next time someone visits the app from the device, the UI loads from the cache immediately and any new content is requested from the server (if it isn't available in the cache already). ...
...e contents of the app. That way, the next time someone visits the app from the device, the UI loads from the cache immediately and any new content is requested from the server (if it isn't available in the cache already). This structure is fast, and also feels fast as the user sees "something" instantly, instead of a loading spinner or a blank page. It also allows the website to be accessible offline if the network connection is not available. We can control what is requested from the server and what is retrieved from the cache with a service worker, which will be explained in detail in the next article -- for now let's focus on the structure itself. Why should I use it? This architecture allows a website to benefit the most from all the PWA features -- it caches the app shell and manages ...
...And 3 more matches
Introduction to progressive web apps - Progressive web apps (PWAs)
eatures. For example, web apps are more discoverable than native apps; it's a lot easier and faster to visit a website than to install an application, and you can also share web apps by simply sending a link. On the other hand, native apps are better integrated with the operating system and therefore offer a more seamless experience for the users. You can install a native app so that it works offline, and users love tapping their icons to easily access their favorite apps, rather than navigating to it using a browser. PWAs give us the ability to create web apps that can enjoy these same advantages. It's not a brand new concept--such ideas have been revisited many times on the web platform with various approaches in the past. Progressive Enhancement and responsive design already allow us to ...
... What makes an app a PWA? As we hinted at above, PWAs are not created with a single technology. They represent a new philosophy for building web apps, involving some specific patterns, APIs, and other features. It's not that obvious if a web app is a PWA or not from first glance. An app could be considered a PWA when it meets certain requirements, or implements a set of given features: works offline, is installable, is easy to synchronize, can send push notifications, etc. In addition, there are tools to measure how complete (as a percentage) a web app is, such as Lighthouse. By implementing various technological advantages, we can make an app more progressive, thus ending up with a higher Lighthouse score. But this is only a rough indicator. There are some key principles a web app should ...
...hthouse score. But this is only a rough indicator. There are some key principles a web app should try to observe to be identified as a PWA. It should be: Discoverable, so the contents can be found through search engines. Installable, so it can be available on the device's home screen or app launcher. Linkable, so you can share it by simply sending a URL. Network independent, so it works offline or with a poor network connection. Progressive, so it's still usable on a basic level on older browsers, but fully-functional on the latest ones. Re-engageable, so it's able to send notifications whenever there's new content available. Responsive, so it's usable on any device with a screen and a browser--mobile phones, tablets, laptops, TVs, refrigerators, etc. Safe, so the connections betwee...
...And 3 more matches
color-interpolation - SVG: Scalable Vector Graphics
The color-interpolation attribute specifies the color space for gradient interpolations, color animations, and alpha compositing. Note: For filter effects, the color-interpolation-filters property controls which color space is used. The color-interpolation property chooses between color operations occurring in the sRGB color space or in a (light energy linear) linearized RGB color space. Having chosen the appropriate color space, component-wise linear interpolation is used. When a child element is blended into a background, the value of the color-interpolation property on the child determines the type of blending, not the value of the color-interpolation on the parent. For gradients which make use of the href or the deprecated xlink:href attribute to reference another gradient, the gradi...
...to the value of the color-interpolation property on the element being animated. Note: As a presentation attribute, color-interpolation can be used as a CSS property. ...
...alue of the color-interpolation property on the element being animated. Note: As a presentation attribute, color-interpolation can be used as a CSS property. ...
...And 3 more matches
stroke-dasharray - SVG: Scalable Vector Graphics
The stroke-dasharray attribute is a presentation attribute defining the pattern of dashes and gaps used to paint the outline of the shape; Note: As a presentation attribute, stroke-dasharray can be used as a CSS property. ...
... The stroke-dasharray attribute is a presentation attribute defining the pattern of dashes and gaps used to paint the outline of the shape; Note: As a presentation attribute, stroke-dasharray can be used as a CSS property. ...
...sharray attribute is a presentation attribute defining the pattern of dashes and gaps used to paint the outline of the shape; Note: As a presentation attribute, stroke-dasharray can be used as a CSS property. ...
...And 3 more matches
Content type - SVG: Scalable Vector Graphics
the functional notation <FuncIRI> is used. This is simply an IRI delimited with a functional notation. Note: For historical reasons, the delimiters are "url(" and ")", for compatibility with the CSS specifications. The FuncIRI form is used in presentation attributes . SVG makes extensive use of IRI references, both absolute and relative, to other objects. ...
...used. This is simply an IRI delimited with a functional notation. Note: For historical reasons, the delimiters are "url(" and ")", for compatibility with the CSS specifications. The FuncIRI form is used in presentation attributes . SVG makes extensive use of IRI references, both absolute and relative, to other objects. ...
...al notation. Note: For historical reasons, the delimiters are "url(" and ")", for compatibility with the CSS specifications. The FuncIRI form is used in presentation attributes . SVG makes extensive use of IRI references, both absolute and relative, to other objects. ...
...And 3 more matches
SVG 2 support in Mozilla - SVG: Scalable Vector Graphics
unknown overflow: hidden; on <hatch> in UA style sheet Implementation status unknown 0 0 as default value of transform-origin except root <svg> and <svg> children of <foreign> Implementation status unknown Use of white-space instead of deprecated xml:space attribute in UA style sheet Implementation status unknown @font-face, ::first-letter and ::first-line on <text> Implementation status unknown SVG and HTML style sheets in HTML document with inline SVG applying to whole document content Implementation status unknown Presentation attributes on any SVG namespaced element Implementation status unknown Display behavior of <style> defined via UA style sheet Implementation status unknown !important user ag...
...lementation status unknown Consider clip and overflow on SVG document referenced by <image> Implementation status unknown Paths Change Notes B and b path commands Implementation status unknown Z and z path commands to add path coordinate data to previous command Implementation status unknown Not render <path>, <polygon> and <polyline> with no data Implementation status unknown SVGPathSeg*, SVGAnimatedPathData and related methods removed from SVGPathElement Implementation status unknown d attribute as CSS property Implementation status unknown Basic Shapes Change Notes pathLength attribute for all basic shapes Implementation status unknown SVGAnimatedPoint...
... basic shapes Implementation status unknown SVGAnimatedPoints.animatedPoints as alias of SVGAnimatedPoints.points Implementation status unknown Auto behavior for rx and ry in <ellipse> Implementation status unknown Text Change Notes text-decoration-fill and text-decoration-stroke properties Not implemented yet (bug 1303569) inline-size attribute for <text> Implementation status unknown shape-inside property Inplementation status unknown shape-subtract property Inplementation status unknown white-space Implementation status unknown Deprecated xml:space attribute Implementation status unknown kerning property removed Implementation status unknown path at...
...And 3 more matches
JavaScript Debugger Service - Archive of obsolete content
ervice till firefox 3.6, for 4.x use asyncOn if (jsd.isOn) jsd.off(); // disables the service Hooks JSD operates using the events hook mechanism. Next, we add code to the various hooks. ...
...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. Note that onError is called for every exception. ...
...led 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. Note that onError is called for every exception. ...
...And 2 more matches
Creating custom Firefox extensions with the Mozilla build system - Archive of obsolete content
xperienced developer or team, and you know that you are going to build a large, complex extension, you would do well to consider the approach described in this article. One final note: I've only tried these techniques inside Firefox, but they'll probably work more or less unchanged on other Gecko-based platforms like Thunderbird or Seamonkey. If someone can confirm this and/or provide guidelines for what's different, I'll update the article to incorporate this information. Bambi Meets Mozilla None of this is for the faint of heart. In particular, the initial step involves building Mozilla, which is a huge - nay, gargantuan! - project. Many intelligent developers have been driven to the brink of insanity trying to build it for the first time. If you're not an experienced C+...
... Public Interfaces The public/ directory contains any interfaces that need to be accessed by other modules. These can be IDL files describing XPCOM interfaces, which are used to generate normal C++ header files for inclusion in your source files. They can also be normal C++ header files that are to be used directly by other modules. The easiest way to accomplish the latter is to use inline implementations for all methods so you don't have any additional linking dependencies. Otherwise you will have to link statically to your module if you use these public headers in other modules. Personally I would discourage this practice (among other things, static linking means the same code gets loaded more than once into memory, and the code won't be available from JavaScript or other non-C++...
...plementations. I'm assuming that you've already built Firefox successfully. If not, return immediately to the beginning of this article and don't come back til you have a functioning firefox.exe. Do not pass go. Do not collect $200. Still here? Okay, now we have to modify your .mozconfig (in the /mozilla/ root directory) so that your extension is built along with Mozilla. Add the following line at the end of the file: ac_add_options --enable-extensions=default,myextension Now launch make from the Mozilla root: make -f client.mk build Even if you have an up-to-date Firefox build, you'll have to wait a while for make to recurse over the entire Mozilla source tree looking for new stuff (on my machine, which is pretty fast, this takes a good 10-15 minutes). Event...
...And 2 more matches
Adding Events and Commands - Archive of obsolete content
and XUL can be found in the Interaction between privileged and non-privileged pages code snippets, which describe and provide examples of this sort of communication. Broadcasters Keeping a consistent UI is another important aspect of extension behavior. ...
...n be found in the Interaction between privileged and non-privileged pages code snippets, which describe and provide examples of this sort of communication. Broadcasters Keeping a consistent UI is another important aspect of extension behavior. Maybe your extension needs to disable or enable a series of controls when the user logs in or out of a service, or when Firefox detects it's online or offline. ...
...It is recommended that you have them at the top of the XUL code, along with script declarations and other invisible elements with as popupset and commandset. ...
...And 2 more matches
The Box Model - Archive of obsolete content
rings may be significantly longer in other languages, specially much longer than English strings. You should avoid using long blocks text, and also avoid designing your UI so that everything fits just right around text. You should always keep in mind that the text can be much longer, and your UI should adapt to it. Labels should generally be short, and they should always be displayed in a single line. ...
...ould avoid using long blocks text, and also avoid designing your UI so that everything fits just right around text. You should always keep in mind that the text can be much longer, and your UI should adapt to it. Labels should generally be short, and they should always be displayed in a single line. Descriptions may be longer, and in general you should plan it so that they can wrap into multiple lines. In order to have wrapping descriptions, you need to set the text as a child node instead of using the value attribute: <description>&xulschoolhello.description.label;</description> Even then, the text will extend as much as it can in a single line, so you need to add some CSS limits in order to make it wrap inside a XUL dialog or window. You can use the CSS property width to restrict the ...
...This makes localization much harder, or even impossible in some cases. ...
...And 2 more matches
Tabbed browser - Archive of obsolete content
ed, it is good practice to try to re-use an existing tab which already displays the desired URL--if one is already open. Following this practice minimizes the proliferation of tabs and browsers created by your extension. Reusing by URL/URI A common feature found in many extensions is to point the user to chrome:// URIs in a browser window (for example, help or about information) or external (on-line http(s)://) HTML documents when the user clicks an extension's button or link. The following code demonstrates how to re-use an existing tab that already displays the desired URL/URI. If no such tab exists, a new one is opened with the specified URL/URI. function openAndReuseOneTabPerURL(url) { var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"] .getServ...
... function examplePageLoad(event) { if (event.originalTarget instanceof Components.interfaces.nsIDOMHTMLDocument) { var win = event.originalTarget.defaultView; if (win.frameElement) { // Frame within a tab was loaded. win should be the top window of // the frameset. If you don't want do anything when frames/iframes // are loaded in this web page, uncomment the following line: // return; // Find the root document: win = win.top; } } } // do not try to add a callback until the browser window has // been initialised. We add a callback to the tabbed browser // when the browser's window gets loaded. window.addEventListener("load", function () { // Add a callback to be run every time a document loads. // note that this includes frames/iframes w...
...ification (example code updated for loadContext) Here an example of the previous section is shown. The previous section was left intact so people can see the old way of doing things. ...
...And 2 more matches
Inner-browsing extending the browser navigation paradigm - Archive of obsolete content
g because is optimized to access contextual data instead reloading full web pages. This article discusses the concept of inner-browsing and possible approaches for its implementation. It also provides two implementation examples using the model. The first one looks like a traditional DHTML ticker application and uses hidden IFRAMES and JavaScript to provide updates inside the webpage's ticker headlines section. This sample was made using IFRAMEs to illustrate a possible implementation. An implementation can also use other transport technologies such as SOAP-based remote procedure calls, XMLHTTPRequest interfaces, or DOM 3 Load. The second example shows a tabbed menu that dynamically loads news headlines into the current web page. This implementation uses XMLHTTPRequest. Extending Traditional H...
... modified to periodically reload the tickerdata.html. What is important is that new information can be dynamically loaded into the main web page's context. Though the inner-browsing model is mostly appropriate for web applications, it also can be used to improve accessibility to information in traditional web pages. Example Using JavaScript's XMLHTTPRequest and DOM Interfaces: Tabbed menu for Headlines This example demonstrates an implementation using XMLHTTPRequest interfaces. Both Netscape 7 and recent versions of Internet Explorer provide XMLHTTPRequest interfaces that allow JavaScript to dynamically load an XML document given a data source URL. In this case, the content that is updated on the page is a set of headlines for DevEdge articles. This example uses the actual XML datasources from...
...XMLHTTPRequest interface returns the DOM for the document that was passed. var x = new XMLRemoteRequest(); doc=x.getRemoteDocument(loaddata); Note: the above code snippet shows an object being instanciated based on a class named XMLRemoteRequest. ...
...And 2 more matches
List of Mozilla-Based Applications - Archive of obsolete content
Celtx media tool Cenzic Hailstorm vulnerability assessment and management tool Uses Gecko ChatZilla IRC client Standalone version (XULRunner) Chromium and Google Chrome web browser Uses Mozilla NSS and NPAPI libraries Chromeless browser with HTML-based interface Classilla Mozilla browser for Mac OS 9 Clines a clone of Color Lines (game) Standalone version Cloud web operating system Cloud Browse iPhone/iPad/iPod Touch browser Seems to be Firefox running remotely on servers that people access through device Conkeror keyboard-oriented browser Convertigo Enterprise Mashup Server server tool for transactional web scraping and for web clipp...
...tting temporal tags in audio documents JsDoc Toolkit documentation tool Uses Mozilla Rhino K-Meleon Gecko-based web browser for Windows Embeds Gecko in MFC KaiRo.at Mandelbrot creates images of Mandelbrot sets XULRUnner application Kazehakase Gecko-based web browser for Unix Kirix Strata data browser Kiwix offline version of Wikipedia Kneemail prayer, praise, and journal application Komodo and Komodo Edit and Open Komodo development tools Mozilla-based application (pre-XULRunner style), XUL UI KompoZer wysiwyg HTML editor unofficial bug-fix release of NVu Kylo video browser Uses Gecko BioFortis Labmatrix web-accessible software ap...
...ce suite Uses NSS Openswan implementation of IPsec for Linux Uses NSS Orca Browser web browser Gecko-based version of Avant browser Pale Moon web browser Optimized browser developed by Moonchild Productions for GNU/Linux & Windows platforms, originally forked from Firefox Palo Suite Excel extension Uses Prism PartyGaming online gaming product Uses Gecko Pencil tool for making diagrams and GUI prototyping Available as a firefox extension or a standalone app Pentaho BI Suite commercial open source business intelligence Uses XUL and Mozilla Rhino Persevere tools for persistence and distributed computing Uses Mozilla Rhino Phloneme publishing tool for Vocab Collab ...
...And 2 more matches
Getting Started - Archive of obsolete content
make some changes and run Mozilla as it is, you will not see them because it's still set to look at the files in the Jar files. To point Mozilla at the correct files we need to open up \mozilla\chrome\installed-chrome.txt in a text editor. You should probably make a backup of this file now, just in case you make a mistake. In the file you'll see a list. Do a search for classic.jar</cde>. On every line that references <code>classic.jar we need to make some changes (There are about 5 lines). Delete the bolded text: Original skin,install,url,jar:resource:/chrome/classic.jar!/skin/classic/global/ Modified skin,install,url,resource:/chrome/classic/skin/classic/global/ Once you have made these modifications, save them and run mozilla. If mozilla runs fine, that means that it worked. If i...
...riginal skin,install,url,jar:resource:/chrome/classic.jar!/skin/classic/global/ Modified skin,install,url,resource:/chrome/classic/skin/classic/global/ Once you have made these modifications, save them and run mozilla. If mozilla runs fine, that means that it worked. If it doesn't appear as you expected, then go back into the installed-chrome.txt file and double check that you modified the lines correctly. Changing Borders and Colours This is the part where knowing CSS comes in handy. To find all of the CSS files that we're going to be modifying, we must first understand the directory structure. Directories In \mozilla\chrome\classic\skin\classic there are a number of different directories which contain the skin information for the default packages that come with Mozilla. The most impor...
...ant your theme called and then its version number. Then scroll down to the next section. <RDF:Description about="urn:mozilla:skin:mySkin/1.0" chrome:displayName="My Skin" chrome:accessKey="M" chrome:author="Me" chrome:description="This is my custom skin for mozilla" chrome:name="mySkin/1.0" chrome:image="preview.png"> The blue areas are explained below. ...
...And 2 more matches
New Skin Notes - Archive of obsolete content
Cavendish Skin --Callek I can probably pull-off this patch if needed (quickly), so dria or others do not have to hunt up "how". --Callek Add "what not to do" css class to stylesheet, as discussed on Talk:Core JavaScript 1.5 Reference. What's the class called? --Maian 21:08, 1 Sep 2005 (PDT) In the new MW1.5 skin (not the one currently available here) there's class "wrong" and class "wrong-inline". Those will be available after we do the wiki upgrades in the near future. --dria Headers need a little padding. H1 could be smaller. --dria Is it just me or visited links are not marked as such? --Nickolay 07:16, 29 Aug 2005 (PDT) Imho the visited color looks horrible. We're a documentation site. There's no real reason for user to give him info that he already visited XML main page. It's...
...ntiate them from internal links, so I think we'll just leave the internal/external links colours the same. ==dria You've got to be kidding me, the colors are clearly different (rgb(0,51,153) vs rgb(51,102,187)). --Nickolay 09:19, 25 Aug 2005 (PDT) (moving this to a new item) On the contrary, the list of categories current page belongs to, should be near the footer (see MDC:Policies_and_guidelines page) (dria: fix catlinks style) The arrows that appear if you select "Enhanced recent changes" in your preferences have an ugly border around them. --Nickolay 04:43, 25 Aug 2005 (PDT) The radio buttons on history page are jumping in a weird way because the selected row becomes bold. --Nickolay 04:46, 25 Aug 2005 (PDT) The sidebar overrides content on diff pages --Nickolay Turns out this...
... The radio buttons on history page are jumping in a weird way because the selected row becomes bold. --Nickolay 04:46, 25 Aug 2005 (PDT) The sidebar overrides content on diff pages --Nickolay Turns out this was fixed for 1.5 already. --dria the buttons in the upper-right of the horizontal nav-bar don't really feel like buttons; maybe add a pseudo-class for onHover that gives them an underline? --beltzner the "+" item under the "Views" menu of a discussion page looks really out of place. Can we replace it with "Add section" or something? --beltzner I'll look into it, but I think this is one of those "don't hold your breath" things because that's not managed by the skin. I could probably just eliminate it entirely. that'd work, too; you'd mentioned that it was very rarely used --bel...
...And 2 more matches
Code Samples - Archive of obsolete content
You can launch an executable file or some other file that your operating system knows how to open. ...
...perating systems that use forward-slash characters, specify the file in the normal way. const path = "C:\\WINDOWS\\CHARMAP.EXE" var file = Components .classes["@mozilla.org/file/local;1"] .createInstance(Components.interfaces.nsILocalFile) file.initWithPath(path) file.launch() Open a web page If your button is in Firefox or SeaMonkey, use code like this to open a web page. ...
...() Open a web page If your button is in Firefox or SeaMonkey, use code like this to open a web page. Change the first line to specify the page that you want to open: const url = "http://www.mozilla.org/" document .getElementById("content") .webNavigation .loadURI(url, 0, null, null, null) If your button is in Thunderbird or Sunbird, use code like this to open a web page. ...
...And 2 more matches
Custom toolbar button - Archive of obsolete content
em:minVersion="0.2.9" em:maxVersion="99" /> </em:targetApplication> <em:file> <Description about="urn:mozilla:extension:custombutton" em:package="content/custombutton/" /> </em:file> </Description> </RDF> Optionally customize the file by changing the name, description and creator. Change the text between double-quote characters on these three lines. Optionally remove the sections for target applications that you do not want. Save the file. Explanation: This file contains information used by the application's extension manager. Sections for target applications specify the versions where the extension works. The last section in the file specifies that this extension adds content to the application. 4. Create a plain text file named chro...
...palette> <!-- button details --> <toolbarbutton id="custom-button-1" label="Custom" tooltiptext="My custom toolbar button" oncommand="CustomButton[1]()" class="toolbarbutton-1 chromeclass-toolbar-additional custombutton" /> </overlay> Optionally customize the file by changing the label and tooltiptext in the last section. Change the text between double-quote characters on these two lines. Optionally remove the sections for toolbars that you do not need. Save the file. Explanation: This XUL file adds the button to the application's toolbar customization palette. It also links to the stylesheet and JavaScript code that the button uses. The last section specifies details of the button. 7. Create a plain text file named button.css. Copy the following content, making sure that ...
... Note: The preference setting javascript.options.strict imposes restrictions that are not appropriate for the simple scripts in this tutorial. If you choose to use this setting, either ignore the warnings that it generates, or change the coding style to keep it quiet. Programming the button To make your button do something useful, edit the file button.js that you created in step 8. ...
...And 2 more matches
MacFAQ - Archive of obsolete content
plication.ini; you should NOT reference application.ini in this command. This command will place a copy of your application in /Applications/(Vendor)/(Name) , where (Vendor) is the Vendor field in your application.ini and (Name) is the Name field. Opening Your Application For ordinary work, you can just navigate via Finder to /Applications/(Vendor)/(Name).app and open the application. For command-line work, you would call on: /Applications/(Vendor)/(Name).app/Contents/MacOS/xulrunner UI notes Menus To enable your application quit command to work with the application menu (the one to the right of the blue apple), you need to give your quit menu item an ID of "menu_FileQuitItem". To enable the Mac "About" menu make sure that you use "aboutName" as the id for your menu item To enable the Mac "P...
... your menu item To enable the Mac "Preferences" menu make sure that you use "menu_preferences" as the id for your options/preferences menu item Toolbars Mac windows have a small "jelly bean" button in the top right corner. This button is used to show/hide the toolbar. The toolkit will automatically enable this behavior if you add class="chromeclass-toolbar" to your <toolbar> element. Commandline Support Commandline handlers work great on the Mac IF it's a cold start. Here's how to implement command-line trapping when the app is already running, without getting into AppleEvents or c++ code. This is implemented in a pseudo "hidden window" technique and parsing the window arguments instead of command-line handlers and some of the toolkit singleton window code. Taking advantage of the core ...
...work great on the Mac IF it's a cold start. Here's how to implement command-line trapping when the app is already running, without getting into AppleEvents or c++ code. This is implemented in a pseudo "hidden window" technique and parsing the window arguments instead of command-line handlers and some of the toolkit singleton window code. ...
...And 2 more matches
Table Reflow Internals - Archive of obsolete content
avail size. This is equivalent to preferred size if the avail size is not constrained. Review of Reflow The reflowee sets various sizes in the reflow metrics after (possibly) reflowing some or all of its children which reflows it children, etc. The reflowee returns a reflow status which indicates if it is complete, and thus not have to continue (split) breaking status (in the case of some inline frames) if there is truncation (it can't fit in the space and can't split). This is just a convience mechanism. Kinds of reflows Initial - reflowee's first reflow must be of this type (reflower's responsibility). Resize - reflowee gets a change in available space only. Similar to initial, except it can reoccur. Incremental - has a reflow path (tree) where each node has a command with a target...
...de a target (e.g. it gains, loses children) style changed - a target changed stylisticly (recall, size is a style property) content changed - a target's content changed (e.g. ...
...d Intro to paginated reflow The page sequence starts with one page and reflows it. If the page is incomplete then the page sequence creates a continuation for the page and sets it as the page's next sibling (it is also the page's nextInFlow). The page was incomplete because the page content was incomplete because the doc root was incomplete The doc root was incomplete because it contained lines that didn't fit (or if it was mapped to a table, because the table didn't fit) becacause a line contained something that didn't fit, etc. Intro to paginated reflow If the reflowee is incomplete, the reflower has the responsiblity to: Create a continuation for the reflowee Ensure that the continuation gets put in the frame hierarchy at the right place and gets reflowed at the right time. Typic...
...And 2 more matches
Using workers in extensions - Archive of obsolete content
Then it sets the worker's onmessage event handler to a function which looks at the event passed into it, and does one of two things: If there is a data field on the event, the stock symbol being tracked is set to the upper case version of that value. This is used...
... true); httpRequest.onload = infoReceived; httpRequest.send(null); } setInterval(function() { refreshInformation(); }, 10*60*1000); onmessage = function(event) { if (event.data) { symbol = event.data.toUpperCase(); } refreshInformation(); } When the worker thread is started, the main body of this code (in lines 26-35) is executed. It starts by setting up an interval handler (in lines 26-28) that calls refreshInformation() every 10 minutes. Then it sets the worker's onmessage event handler to a function which looks at the event passed into it, and does one of two things: If there is a data field on the event, the stock symbol being tracked is set to the upper case version of that value. This is used to initialize the worker, and to change which stock is being monitored. ...
...() method is called to fetch the latest information about the stock and pass it back to the main thread. This provides a way for the main thread to specifically request that the worker update the stock information at once. The refreshInformation() method is fairly similar to the previous versions, with two notable exceptions: If the ticker symbol has not been set yet, an exception is thrown (lines 4-6). When the result is received from XMLHttpRequest, instead of immediately updating the displayed information in the status bar, a message is sent to the main thread using the worker's postMessage() method. This is because only the main thread is allowed to access the user interface. The main thread The changes here are also relatively minor, but crucial. The startup() method This metho...
...And 2 more matches
E4X for templating - Archive of obsolete content
ffering the power and readability of templating languages such as Smarty for PHP (though admittedly without the currently wider cross-browser support of XSLT or the strictly-XML approach of PHPTAL or Seethrough templating). ...
... /* The first two arguments are option...
...ne param (see below) ++it; } } else { for (k in arr) { if (it < min) { ++it; continue; } if (it > max) { break; } ret+=h(k, arr[k], it, lev); ++it; } } return ret; } The following 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/Fill...
...And 2 more matches
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). The message of the alert element can exist in instance data, in a remote document, or as inline text. If more than one source of message is specified in this element, the order of precedence is: single node binding attributes, linking attributes, inline text. Attributes Single-Node Binding Linking src - URL of a document whose contents will be retrieved by the alert element and used to provide the alert message for the containing form control. Type restrictions The alert element can be bound to any simple content. Representations Can be represented in two ways: modeless...
...estrictions The alert element can be bound to any simple content. Representations Can be represented in two ways: modeless window that contains the alert element's message (default representation). the alert element's message can also be displayed immediately after the containing form control element in the XForms document's layout. ...
... element in the XForms document's layout. This representation is used if the alert element has an inline display style. ...
...And 2 more matches
Styling Abbreviations and Acronyms - Archive of obsolete content
Summary: The HTML elements abbr and acronym are useful accessibility aids, but their styling can come as a surprise to authors. See how you can take control of their presentation without sacrificing the benefits these elements provide. Many authors are beginning to use the HTML elements abbr (abbreviation) and acronym in their Web pages. ...
...nd acronym are useful accessibility aids, but their styling can come as a surprise to authors. See how you can take control of their presentation without sacrificing the benefits these elements provide. Many authors are beginning to use the HTML elements abbr (abbreviation) and acronym in their Web pages. ...
... encouraged, and according to Guideline 4 of the Web Content Accessibility Guidelines, both elements should be given a title attribute to improve "readability of the Web for all people, including those with learning disabilities, cognitive disabilities, or people who are deaf." The Problem Authors have discovered that any abbr or acronym that has a title attribute is rendered with a dotted underline, per the following rule in resource://gre-resources/html.css abbr[title], acronym[title] { text-decoration: dotted underline; } The Solution If authors wish to remove the underline from abbr and acronym elements, this can be done with the following rule: abbr[title], acronym[title] { text-decoration: none; } It may be better to lessen the visual weight of the border without actually rem...
...And 2 more matches
Anatomy of a video game - Game development
window object (where all global variables are stored) and the example code did not leave us with a way to stop the loop unless the whole tab is closed or refreshed. For the first issue, if you want the main loop to just run and you do not need easy (direct) access to it, you could create it as an Immediately-Invoked Function Expression (IIFE). /* * Starting with the semicolon is in case whatever line of code above this example * relied on automatic semicolon insertion (ASI). The browser could accidentally * think this whole example continues from the previous line. The leading semicolon * marks the beginning of our new line if the previous one was not empty or terminated. */ ;(function () { function main() { window.requestAnimationFrame( main ); // Your main loop contents } m...
... cancel the call to main() with window.cancelAnimationFrame(). You will need to pass cancelAnimationFrame() the ID token given by requestAnimationFrame() when it was last called. Let us assume that your game's functions and variables are built on a namespace that you called MyGame. Expanding our last example, the main loop would now look like: /* * Starting with the semicolon is in case whatever line of code above this example * relied on automatic semicolon insertion (ASI). The browser could accidentally * think this whole example continues from the previous line. The leading semicolon * marks the beginning of our new line if the previous one was not empty or terminated. * * Let us also assume that MyGame is previously defined. */ ;(function () { function main() { MyGame.stopMain = wi...
...ar tNow = window.performance.now(); Back to the topic of the main loop. You will often want to know when your main function was invoked. Because this is common, window.requestAnimationFrame() always provides a DOMHighResTimeStamp to callbacks as an argument when they are executed. This leads to another enhancement to our previous main loops. /* * Starting with the semicolon is in case whatever line of code above this example * relied on automatic semicolon insertion (ASI). The browser could accidentally * think this whole example continues from the previous line. The leading semicolon * marks the beginning of our new line if the previous one was not empty or terminated. * * Let us also assume that MyGame is previously defined. */ ;(function () { function main( tFrame ) { MyGame.stopM...
...And 2 more matches
Explaining basic 3D theory - Game development
t vertices (points in space) and 6 different faces, each constructed out of 4 vertices. A normal defines which way the face is directed in. Also, by connecting the points we're creating the edges of the cube. The geometry is built from a vertex and the face, while material is a texture, which uses a color or an image. If we connect the geometry with the material we will get a mesh. ...
...ace) and 6 different faces, each constructed out of 4 vertices. A normal defines which way the face is directed in. Also, by connecting the points we're creating the edges of the cube. The geometry is built from a vertex and the face, while material is a texture, which uses a color or an image. If we connect the geometry with the material we will get a mesh. ...
...irected in. Also, by connecting the points we're creating the edges of the cube. The geometry is built from a vertex and the face, while material is a texture, which uses a color or an image. If we connect the geometry with the material we will get a mesh. Rendering pipeline The rendering pipeline is the process by which images are prepared and output onto the screen. The graphics rendering pipeline takes the 3D objects built from primitives described using vertices, applies processing, calculates the fragments and renders them on the 2D screen as pixels. Terminology used in the diagram above is as follows: A Primitive: An input to the pipeline -- it's built from vertices and can be a triangle, point or line. A Fragment: A 3D projection of a pixel, which has all the same attributes as...
...And 2 more matches
Move the ball - Game development
drawing on each frame, we need to define a drawing function that will run over and over again, with a different set of variable values each time to change sprite positions, etc. You can run a function over and over again using a JavaScript timing function such as setInterval() or requestAnimationFrame(). Delete all the JavaScript you currently have inside your HTML file except for the first two lines, and add the following below them. The draw() function will be executed within setInterval every 10 miliseconds: function draw() { // drawing code } setInterval(draw, 10); Thanks to the infinite nature of setInterval the draw() function will be called every 10 milliseconds forever, or until we stop it. Now, let's draw the ball -- add the following inside your draw() function: ctx.beginPat...
...uld be repainted on every frame. Making it move You won't notice the ball being repainted constantly at the moment, as it's not moving. Let's change that. First, instead of a hardcoded position at (50,50) we will define a starting point at the bottom center part of the Canvas in variables called x and y, then use those to define the position the circle is drawn at. ...
...arting point at the bottom center part of the Canvas in variables called x and y, then use those to define the position the circle is drawn at. First, add the following two lines above your draw() function, to define x and y: var x = canvas.width/2; var y = canvas.height-30; Next update the draw() function to use the x and y variables in the arc() method, as shown in the following highlighted 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. Let's define these small values as dx and dy and set their values to 2 and -2 respectively. Add the fol...
...And 2 more matches
Test your skills: CSS and JavaScript accessibility - Learn web development
If you get stuck, then ask us for help -- see the Assessment or further help section at the bottom of this page. CSS accessibility 1 In the first task you are presented with a list of links. ...
...t the existing ruleset with the a selector is supplied by some CMS, and that you can't change it -- instead, you need to create new rules to make the links look and behave like links, and for the user to be able to tell where they are in the list. Try updating the live code below to recreate the finished example: Download the starting point for this task to work in your own editor or in an online editor. CSS accessibility 2 In this next task you are presented with a simple bit of content -- just headings and paragraphs. There are accessibility issues with the colors and sizing of the text; we'd like you to: 1. Explain what the problems are, and what the guidelines are that state the acceptable values for color and sizing. 2. Select new values for the color and font-size that fix the...
... the color and font-size that fix the problem. 3. Update the CSS with these new values to fix the problem. 4. Test the code to make sure the problem is now fixed. Explain what tools or methods you used to select the new values and test the code. Try updating the live code below to recreate the finished example: Download the starting point for this task to work in your own editor or in an online editor. JavaScript accessibility 1 In our final task here, you have some JavaScripting to do. We have a simple app that presents a list of animal names. Clicking one of the animal names causes a further description of that animal to appear in a box below the list. But it is not very accessible -- in its current state you can only operate it with the mouse. We'd like you to add to the HTML and...
...And 2 more matches
HTML: A good basis for accessibility - Learn web development
aragraph, etc. It stops after each element, letting you go at whatever pace is comfortable for you. You can jump to the next/previous heading in many screen readers. You can also bring up a list of all headings in many screen readers, allowing you to use them as a handy table of contents to find specific content. People sometimes write headings, paragraphs, etc. using presentational HTML and line breaks, something like the following: <font size="7">My heading</font> <br><br> This is the first section of my document. <br><br> I'll add another paragraph here too. <br><br> 1. Here is <br><br> 2. a list for <br><br> 3. you to read <br><br> <font size="5">My subheading</font> <br><br> This is the first subsection of my document. I'd love people to be able to find this content! <br><br> <font ...
...g seems like a reasonable enough example: Fill in your name: <input type="text" id="name" name="name"> However, this is not so useful for disabled users. There is nothing in the above example to associate the label unambiguously with the form input and make it clear how to fill it in if you cannot see it. ...
...e accessible in appearance. They can improve accessibility by helping a user quickly navigate to different sections of a document. They can also harm accessibility if their accessible styling is removed or if JavaScript causes them to behave in unexpected ways. Link styling By default, links are visually different from other text in both color and text-decoration, with links being blue and underlined by default, purple and underlined if visited, and with a focus-ring when they receive keyboard focus. Color should not be used as the sole method of distinguishing links from non-linking content. Link text color, like all text, has to be significantly different from the background color (a 4.5:1 contrast). In addition, links should visually be significantly different from non-linking text. Wit...
...And 2 more matches
HTML: A good basis for accessibility - Learn web development
aragraph, etc. It stops after each element, letting you go at whatever pace is comfortable for you. You can jump to the next/previous heading in many screen readers. You can also bring up a list of all headings in many screen readers, allowing you to use them as a handy table of contents to find specific content. People sometimes write headings, paragraphs, etc. using presentational HTML and line breaks, something like the following: <font size="7">My heading</font> <br><br> This is the first section of my document. <br><br> I'll add another paragraph here too. <br><br> 1. Here is <br><br> 2. a list for <br><br> 3. you to read <br><br> <font size="5">My subheading</font> <br><br> This is the first subsection of my document. I'd love people to be able to find this content! <br><br> <font ...
...g seems like a reasonable enough example: Fill in your name: <input type="text" id="name" name="name"> However, this is not so useful for disabled users. There is nothing in the above example to associate the label unambiguously with the form input and make it clear how to fill it in if you cannot see it. ...
...e accessible in appearance. They can improve accessibility by helping a user quickly navigate to different sections of a document. They can also harm accessibility if their accessible styling is removed or if JavaScript causes them to behave in unexpected ways. Link styling By default, links are visually different from other text in both color and text-decoration, with links being blue and underlined by default, purple and underlined if visited, and with a focus-ring when they receive keyboard focus. Color should not be used as the sole method of distinguishing links from non-linking content. Link text color, like all text, has to be significantly different from the background color (a 4.5:1 contrast). In addition, links should visually be significantly different from non-linking text. Wit...
...And 2 more matches
Test your skills: WAI-ARIA - Learn web development
If you get stuck, then ask us for help -- see the Assessment or further help section at the bottom of this page. WAI-ARIA 1 In our first ARIA task, we present you with a section of non-semantic markup, which is obviously meant to be a list. ...
...I-ARIA 1 In our first ARIA task, we present you with a section of non-semantic markup, which is obviously meant to be a list. Assuming you are not able to change the elements used, how can you allow screenreader users to recognize this as a list? Try updating the live code below to recreate the finished example: Download the starting point for this task to work in your own editor or in an online editor. WAI-ARIA 2 In our second WAI-ARIA task, we present a simple search form, and we want you to add in a couple of WAI-ARIA features to improve its accessibility: How can you allow the search form to be called out as a separate landmark on the page by screenreaders, to make it easily findable? How can you give the search input a suitable label, without explicitly adding a visible text ...
... WAI-ARIA 3 For this final WAI-ARIA task, we return to an example we previously saw in the CSS and JavaScript skilltest. As before, we have a simple app that presents a list of animal names. Clicking one of the animal names causes a further description of that animal to appear in a box below the list. Here, we are starting with a mouse- and keyboard-accessible version. The problem we...
...And 2 more matches
Test your skills: Overflow - Learn web development
If you get stuck, then ask us for help -- see the Assessment or further help section at the bottom of this page. Task One The content is overflowing the box because it has a fixed height. Keep the height but cause the box to have scrollbars only if there is enough text to cause an overflow. ...
...ve scrollbars only if there is enough text to cause an overflow. Test by removing some of the text from the HTML, that if there is only a small amount of text that does not overflow, no scrollbar appears. ...
...You can write the code yourself, or use the starting point files linked to in the above sections. ...
...And 2 more matches
Test your skills: values and units - Learn web development
If you get stuck, then ask us for help -- see the Assessment or further help section at the bottom of this page. ...
...should use HSL color. The fourth should use RGB color but with the alpha channel set to .2. You can find conversions for the hex color at this link. You need to figure out how to use the values in CSS. Try updating the live code below to recreate the finished example: For assessment or further work purposes, download the starting point for this task to work in your own editor or in an online editor. Task Two In this task you need to set the size of various items of text. The <h1> should be 50 pixels. The <h2> should be 2em. All <p> elements should be 16 pixels. A <p> element that is directly after an <h1> should be 120%. Try updating the live code below to recreate the example as displayed in the image: For assessment or further work purposes, download the starting p...
...e of various items of text. The <h1> should be 50 pixels. The <h2> should be 2em. All <p> elements should be 16 pixels. A <p> element that is directly after an <h1> should be 120%. Try updating the live code below to recreate the example as displayed in the image: For assessment or further work purposes, download the starting point for this task to work in your own editor or in an online editor. Task Three In this task you need move the background image so that it is centered horizontally, and 20% from the top of the box. Try updating the live code below to recreate the example as displayed in the image: For assessment or further work purposes, download the starting point for this task to work in your own editor or in an online editor. Assessment or further help You ...
...And 2 more matches
Test your skills: Writing Modes and Logical Properties - Learn web development
The aim of this task is to help you check your understanding of Writing Modes and Logical Properties. The things you need to know to complete these tasks are covered in the lesson on Handling different text directions. Note: You can try out solutions in the interactive editors below, however it may be helpful to download the code and use an online tool such as CodePen, jsFiddle, or Glitch to work on the tasks. If you get stuck, then ask us for help -- see the Assessment or further help section at the bottom of this page. Task One The box in the example is displayed with a horizontal writing mode. Can you add a line of CSS to change it so it uses a vertical writing mode with right to left text? Your example should look like the image below. Try updating the live code below to recr...
... Task Two In the example below use logical properties to replace width and height in order to maintain the aspect ratio of the box as it is turned vertically. Your end result should look like the image below. ...
...ple below use logical properties to replace width and height in order to maintain the aspect ratio of the box as it is turned vertically. Your end result should look like the image below. Try updating the live code below to recreate the example as displayed in the image: For assessment or further work purposes, download the starting point for this task to work in your own editor or in an online editor. Task Three Use logical versions of the margin, border, and padding properties so that the edges of the box relate to the text rather than following top, left, bottom and right. You can see how this should look in the image below. Try updating the live code below to recreate the finished example: For assessment or further work purposes, download the starting point for this task t...
...And 2 more matches
Test your skills: Flexbox - Learn web development
The aim of this task is to get you working with Flexbox and demonstrate your understanding of how flex items behave. Below are four common design patterns which you might use Flexbox to create, your task is to build them. Note: You can try out solutions in the interactive editors below, however it may be helpful to download the code and use an online tool such as CodePen, jsFiddle, or Glitch to work on the tasks. If you get stuck, then ask us for help -- see the Assessment or further help section at the bottom of this page. Flex Layout One These list items are the navigation for a site. They should be laid out as a row, with an equal amount of space between each item. The finished example should look like the image below. Try updating the live code below to recreate the finished ...
... Flex Layout One These list items are the navigation for a site. They should be laid out as a row, with an equal amount of space between each item. The finished example should look like the image below. Try updating the live code below to recreate the finished example: For assessment or further work purposes, download the starting point for this task to work in your own editor or in an online editor. Flex Layout Two These list items are all different sizes, but we want them to be displayed as three equal sized columns, no matter what content is in each item. Try updating the live code below to recreate the finished example: Additional questions: Can you now make the first item twice the size of the other items? For assessment or further work purposes, download the start...
... sizes, but we want them to be displayed as three equal sized columns, no matter what content is in each item. Try updating the live code below to recreate the finished example: Additional questions: Can you now make the first item twice the size of the other items? For assessment or further work purposes, download the starting point for this task to work in your own editor or in an online editor. Flex Layout Three There are two elements in the HTML below, a div with a class of .parent which contains another div with a class of .child. Use Flexbox to center the child inside the parent. Try updating the live code below to recreate the finished example: For assessment or further work purposes, download the starting point for this task to work in your own editor or in an onl...
...And 2 more matches
Test your skills: floats - Learn web development
The aim of this task is to get you working with the CSS float and clear properties covered in our lesson on Floats. You will be working through three small tasks which use different elements of the material you have just covered. Note: You can try out solutions in the interactive editors below, however it may be helpful to download the code and use an online tool such as CodePen, jsFiddle, or Glitch to work on the tasks. If you get stuck, then ask us for help -- see the Assessment or further help section at the bottom of this page. Floats One In this task you need to float the two elements with a class of float1 and float2 left and right respectively. The text should then appear between the two boxes as in the image below. Try updating the live code below to recreate the finished...
... page. Floats One In this task you need to float the two elements with a class of float1 and float2 left and right respectively. The text should then appear between the two boxes as in the image below. Try updating the live code below to recreate the finished example: For assessment or further work purposes, download the starting point for this task to work in your own editor or in an online editor. Float Two In this example the element with a class of float should be floated left. Then we want the first line of text to display next to that element, but the following line of text (which has a class of .below) to display underneath it. You can see the desired result in this image. Try updating the live code below to recreate the finished example: For assessment or further wo...
... Float Three Finally, we have a floated element in this example. The box wrapping the float and text is displaying behind the float. Use the most up to date method available to cause the box background to extend to below the float as in the image. ...
...And 2 more matches
Test your skills: Multicol - Learn web development
king with the CSS column-count, column-width, column-gap, column-span and column-rule properties and values covered in our lesson on Multiple-column Layout. You will be working through three small tasks which use different elements of the material you have just covered. Note: You can try out solutions in the interactive editors below, however it may be helpful to download the code and use an online tool such as CodePen, jsFiddle, or Glitch to work on the tasks. If you get stuck, then ask us for help -- see the Assessment or further help section at the bottom of this page. Multicol One In this task you need to create three columns, with a 50px gap between each column. Try updating the live code below to recreate the finished example: For assessment or further work purposes, down...
...et stuck, then ask us for help -- see the Assessment or further help section at the bottom of this page. Multicol One In this task you need to create three columns, with a 50px gap between each column. Try updating the live code below to recreate the finished example: For assessment or further work purposes, download the starting point for this task to work in your own editor or in an online editor. Multicol Two Create columns which have a minimum width of 200px. Then, add a 5px, grey rule between each column, ensuring there is 10px of space between the edge of the rule and the column content. Try updating the live code below to recreate the finished example: For assessment or further work purposes, download the starting point for this task to work in your own editor or in...
...r. Multicol Two Create columns which have a minimum width of 200px. Then, add a 5px, grey rule between each column, ensuring there is 10px of space between the edge of the rule and the column content. Try updating the live code below to recreate the finished example: For assessment or further work purposes, download the starting point for this task to work in your own editor or in an online editor. Multicol Three Cause the element containing the heading and subheading to span across all columns so it looks like the image. Try updating the live code below to recreate the finished example: For assessment or further work purposes, download the starting point for this task to work in your own editor or in an online editor. Assessment or further help You can practice these e...
...And 2 more matches
Responsive design - Learn web development
As more diverse screen sizes became available, the concept of responsive web design (RWD) appeared, a set of practices that allows web pages to alter their layout and appearance to suit different screen widths, resolutions, etc. ...
...tions when designing a website: You could create a liquid site, which would stretch to fill the browser window or a fixed width site, which would be a fixed size in pixels. These two approaches tended to result in a website that looked its best on the screen of the person designing the site! The liquid site resulted in a squashed design on smaller screens (as seen below) and unreadably long line lengths on larger ones. Note: See this simple liquid layout: example, source code. When viewing the example, drag your browser window in and out to see how this looks at different sizes. The fixed-width site risked a horizontal scrollbar on screens smaller than the site width (as seen below), and lots of white space at the edges of the design on larger screens. Note: See this simple...
...ere is, and build a pixel perfect layout for it. That approach would be impossible given the vast number of differently-sized devices that exist, and the fact that on desktop at least, people do not always have their browser window maximized. By using a flexible grid, you only need to add in a breakpoint and change the design at the point where the content starts to look bad. For example, if the line lengths become unreadably long as the screen size increases, or a box becomes squashed with two words on each line as it narrows. In the early days of responsive design, our only option for performing layout was to use floats. Flexible floated layouts were achieved by giving each element a percentage width, and ensuring that across the layout the totals were not more than 100%. In his original p...
...And 2 more matches
Web fonts - Learn web development
s free fonts available for download (there may still be some license conditions, such as crediting the font creator). Examples include Font Squirrel, dafont, and Everything Fonts. A paid font distributor: This is a site that makes fonts available for a charge, such as fonts.com or myfonts.com. You can also buy fonts directly from font foundries, for example Linotype, Monotype, or Exljbris. An online font service: This is a site that stores and serves the fonts for you, making the whole process easier. See the Using an online font service section for more details. Let's find some fonts! Go to Font Squirrel and choose two fonts -- a nice interesting font for the headings (maybe a nice display or slab serif font), and slightly less flashy and more readable font for the paragraphs. When you fi...
...mo page with some nice fonts implemented on them. Because different fonts are created at different sizes, you may have to adjust the size, spacing, etc., to sort out the look and feel. Note: If you have any problems getting this to work, feel free to compare your version to our finished files -- see web-font-finished.html and web-font-finished.css (run the finished example live). Using an online font service Online font services generally store and serve fonts for you, so you don't have to worry about writing the @font-face code, and generally just need to insert a simple line or two of code into your site to make everything work. Examples include Adobe Fonts and Cloud.typography. Most of these services are subscription-based, with the notable exception of Google Fonts, a useful free se...
...rt.css as your starting point. Go to Google Fonts. Use the filters on the left-hand side to display the kinds of fonts you want to choose and choose a couple of fonts you like. To select a font family, press the ? button alongside it. When you've chosen the font families, press the [Number] Families Selected bar at the bottom of the page. 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. Put it above the existing <link> element, so that the font is imported before you try to use it in your CSS. You then need to copy the CSS declarations listed into your CSS as appropriate, to apply the custom fonts to your HTML. Note: You can find a completed version at google-font.html and google-font.css, if you need to check ...
...And 2 more matches
How do you upload your files to a web server? - Learn web development
In this article we'll discuss how to do that, using various available options such as SFTP clients, RSync and GitHub. SFTP There are several SFTP clients out there. ...
... Prerequisites: You must know what a web server is and how domain names work. You must also know how to set up a basic environment and how to write a simple webpage. Objective: Learn how to push files to a server using the various file transfer tools available. Summary If you have built a simple web page (see HTML basics for an example), you will probably want to put it online, on a web server. In this article we'll discuss how to do that, using various available options such as SFTP clients, RSync and GitHub. SFTP There are several SFTP clients out there. Our demo covers FileZilla, since it's free and available for Windows, macOS and Linux. To install FileZilla go to the FileZilla downloads page, click the big Download button, then install from the installer file in...
...e Public/htdocs directory." You need to navigate to the specified directory in your right pane. This directory is effectively the root of your website -- where your index.html file and other assets will go. Once you've found the correct remote directory to put your files in, to upload your files to the server you need to drag-and-drop them from the left pane to the right pane. Are they really online? So far, so good, but are the files really online? You can double-check by going back to your website (e.g. http://demozilla.examplehostingprovider.net/) in your browser: And voila! Our website is live! Rsync Rsync is a local-to-remote file synchronizing tool, which is generally available on most Unix-based systems (like macOS and Linux), but Windows versions exist too. It is seen as a mor...
...And 2 more matches
Client-side form validation - Learn web development
hing the :invalid UI pseudo-class. Add a required attribute to your input, as shown below. <form> <label for="choose">Would you prefer a banana or cherry? (required)</label> <input id="choose" name="i_like" required> <button>Submit</button> </form> Note the CSS that is included in the example file: input:invalid { border: 2px dashed red; } input:invalid:required { background-image: linear-gradient(to right, pink, lightgreen); } input:valid { border: 2px solid black; } This CSS causes the input to have a red dashed border when it is invalid and a more subtle solid black border when valid. We also added a background gradient when the input is required and invalid. Try out the new behavior in the example below: Note: You can find this example live on GitHub as fruit-validat...
...esence of the required attribute on any element that supports this attribute means the element matches the :required pseudoclass whether it has a value or not. If the <input> has no value, the input will match the :invalid pseudoclass. Note: For good user experience, indicate to the user when form fields are required. It isn't only good user experience, it is required by WCAG accessibility guidelines. Also, only require users to input data you actually need: For example, why do you really need to know someone's gender or title? Validating against a regular expression Another useful validation feature is the pattern attribute, which expects a Regular Expression as its value. A regular expression (regex) is a pattern that can be used to match character combinations in text strings, so regex...
... // There are many ways to pick a DOM node; here we get the form its...
...And 2 more matches
How to build custom form controls - Learn web development
equired styles The required styles are those necessary to handle the three states of our control. ...
... This will make our control become part of the text flow and sizable at the same time */ display : inline-block; } We need an extra class active to define the look and feel of our control when it is in its active state. Because our control is focusable, we double this custom style with the :focus pseudo-class in order to be sure they will behave the same. .select .active, .select:focus { outline: none; /* This box-shadow property is not exactly required, however it's imperative to ensure active state is visible, especially to keyboard users, that we use it as a default value. */ box-shadow: 0 0 3px 1px #227755; } Now, let's handle the list of options: /* The .select selector here helps to make we only select element inside our control. */ .select .optList { /* This will ...
...t for em value in this context */ font-family : Verdana, Arial, sans-serif; box-sizing : border-box; /* We need extra room for the down arrow we will add */ padding : .1em 2.5em .2em .5em; width : 10em; /* 100px */ border : .2em solid #000; border-radius : .4em; box-shadow : 0 .1em .2em rgba(0,0,0,.45); /* The first declaration is for browsers that do not support linear gradients. */ background : #F0F0F0; background : linear-gradient(0deg, #E3E3E3, #fcfcfc 50%, #f0f0f0); } .select .value { /* Because the value can be wider than our control, we have to make sure it will not change the control's width. If the content overflows, we display an ellipsis */ display : inline-block; width : 100%; overflow : hidden; white-space : nowrap; text-...
...And 2 more matches
Test your skills: Basic controls - Learn web development
If you get stuck, then ask us for help -- see the Assessment or further help section at the bottom of this page. ...
...assword, along with a submit button. Create appropriate inputs for user ID and password. You should also associate them with their text labels semantically. Create a submit button inside the remaining list item, with button text of "Log in". Try updating the live code below to recreate the finished example: Download the starting point for this task to work in your own editor or in an online editor. Basic controls 2 The next task requires you to create working sets of checkboxes and radio buttons, from the provided text labels. Turn the first <fieldset>'s contents into a set of radio buttons -- you should only be able to select one pony character at once. Make it so that the first radio button is selected upon page load. Turn the second <fieldset>'s content into a set of chec...
...ns -- you should only be able to select one pony character at once. Make it so that the first radio button is selected upon page load. Turn the second <fieldset>'s content into a set of checkboxes. Add a couple more hotdog choices of your own. Try updating the live code below to recreate the finished example: Download the starting point for this task to work in your own editor or in an online editor. Basic controls 3 The final task in this set requires you to create a file picker. Create a basic file picker. Allow the user to pick multiple files at once. Allow the file picker to accept JPG and PNG images only. Try updating the live code below to recreate the finished example: Download the starting point for this task to work in your own editor or in an online editor. A...
...And 2 more matches
Test your skills: Form validation - Learn web development
If you get stuck, then ask us for help -- see the Assessment or further help section at the bottom of this page. ...
...h of 15 characters, and the "Comment" field a maximum length of 200 characters. Try submitting your form -- it should refuse to submit until the above constaints are followed, and give suitable error messages. To help, you might want to consider adding some simple CSS to show when a form field is valid or invalid. Download the starting point for this task to work in your own editor or in an online editor. Form validation 2 Now we want you to take the same form you saw in the previous task (use your previous answer if you want to), and add some more specific pattern validation to the first three fields using regular expressions. All of the user names in our application consist of a single letter, followed by a dot, followed by three or more letters or numbers. All letters should be lo...
...go and see where you get to; there is no shame in asking for some help. You can find everything you need to answer these questions at our regular expression reference, and by searching on Stack Overflow. Again, to help you might want to consider adding some simple CSS to show when a form field is valid or invalid. Download the starting point for this task to work in your own editor or in an online editor. Form validation 3 In our final task for this set, we are providing you with a similar example to what you saw in the accompanying article -- a simple email address entry input. We would like you to use the constraint validation API, plus some form validation attributes, to program some custom error messages. Make the input mandatory to fill in, and give it a minimum length of 10 cha...
...And 2 more matches
Test your skills: Other controls - Learn web development
This aim of this skill test is to assess whether you've understood our Other form controls article. Note: You can try out solutions in the interactive editors below, however it may be helpful to download the code and use an online tool such as CodePen, jsFiddle, or Glitch to work on the tasks. If you get stuck, then ask us for help -- see the Assessment or further help section at the bottom of this page. Other controls 1 In our first "other controls" assessment, we'll get you to create a multi-line text input. Create a basic multi-line text input. Associate it semantically with the provided "Comment" label. Give the input 35 columns, and 10 rows of space in which to add comments. Give the comments a maximum length of 100 characters. Try updating the live code below to recreate...
... Other controls 2 Now it's time to have a go at implementing a drop-down select menu, to allow a user to pick their favourite food from the choices provided. Create your basic select box structure. Associate it semantically with the provided "Comment" label. Inside the list, split the choices up into 2 subgroups -- "mains" and "snacks". ...
...user to pick their favourite food from the choices provided. Create your basic select box structure. Associate it semantically with the provided "Comment" label. Inside the list, split the choices up into 2 subgroups -- "mains" and "snacks". Try updating the live code below to recreate the finished example: Download the starting point for this task to work in your own editor or in an online editor. Other controls 3 In our final task of this set, we start with much the same list of food choices. However, this time we want to do things differently: Create a basic text input that is semantically associated with the provided label. Put the food choices into a list that can be associated with a form input. Associate the list with your text input, so that when you type characters,...
...And 2 more matches
Debugging HTML - Learn web development
as been deleted altogether. The last list item looks like this: <li> <strong>Unclosed attributes: Another common source of HTML problems. Let's look at an example: </strong> </li> HTML validation So you can see from the above example that you really want to make sure your HTML is well-formed! But how? In a small example like the one seen above, it is easy to search through the lines and find the errors, but what about a huge, complex HTML document? The best strategy is to start by running your HTML page through the Markup Validation Service -- created and maintained by the W3C, the organization that looks after the specifications that define HTML, CSS, and other web technologies. This webpage takes an HTML document as an input, goes through it, and gives you a report to te...
...tion Service. Press the Check button. This should give you a list of errors and other information. Interpreting the error messages The error messages are usually helpful, but sometimes they are not so helpful; with a bit of practice you can work out how to interpret these to fix your code. Let's go through the error messages and see what they mean. You'll see that each message comes with a line and column number to help you to locate the error easily. "Consider adding a lang attribute to the html start tag to declare the language of this document.": This is not an error but a warning. The recommendation is to always define a language, and this warning explains how to do it. "End tag li implied, but there were open elements" (2 instances): These messages indicate that an element is o...
...ang attribute to the html start tag to declare the language of this document.": This is not an error but a warning. The recommendation is to always define a language, and this warning explains how to do it. "End tag li implied, but there were open elements" (2 instances): These messages indicate that an element is open that should be closed. The ending tag is implied, but not actually there. The line/column information points to the first line after the line where the closing tag should really be, but this is a good enough clue to see what is wrong. "Unclosed element strong": This is really easy to understand -- a <strong> element is unclosed, and the line/column information points right to where it is. "End tag strong violates nesting rules": This points out the incorrectly nested elements...
...And 2 more matches
From object to iframe — other embedding technologies - Learn web development
inside another one, as if it were an <img> or other such element, and is used regularly today. With the history lesson out of the way, let's move on and see how to use some of these. Active learning: classic embedding uses In this article we are going to jump straight into an active learning section, to immediately give you a real idea of just what embedding technologies are useful for. The online world is very familiar with Youtube, but many people don't know about some of the sharing facilities it has available. Let's look at how Youtube allows us to embed a video in any page we like using an <iframe>. First, go to Youtube and find a video you like. Below the video, you'll find a Share button -- select this to display the sharing options. Select the Embed button and you'll be given ...
...ll find a Share button -- select this to display the sharing options. Select the Embed button and you'll be given some <iframe> code -- copy this. Insert it into the Input box below, and see what the result is in the Output. For bonus points, you could also try embedding a Google Map in the example: Go to Google Maps and find a map you like. Click on the "Hamburger Menu" (three horizontal lines) in the top left of the UI. Select the Share or embed map option. Select the Embed map option, which will give you some <iframe> code -- copy this. Insert it into the Input box below, and see what the result is in the Output. If you make a mistake, you can always reset it using the Reset button. If you get really stuck, press the Show solution button to see an answer. Playable code <h2>L...
...nEntry = textarea.value; } updateCode(); }; Iframes in detail So, that was easy and fun, right? <iframe> elements are designed to allow you to embed other web documents into the current document. This is great for incorporating third-party content into your website that you might not have direct control over and don't want to have to implement your own version of -- such as video from online video providers, commenting systems like Disqus, maps from online map providers, advertising banners, etc. The live editable examples you've been using through this course are implemented using <iframe>s. There are some serious Security concerns to consider with <iframe>s, as we'll discuss below, but this doesn't mean that you shouldn't use them in your websites -- it just requires some knowledg...
...And 2 more matches
Test your skills: Multimedia and embedding - Learn web development
If you get stuck, then ask us for help -- see the Assessment or further help section at the bottom of this page. ...
... the page. The audio is called audio.mp3, and it is in a folder inside the current folder called media. Add an attribute to make browsers display some default controls. Add some appropriate fallback text for browsers that don't support <audio>. Try updating the live code below to recreate the finished example: Download the starting point for this task to work in your own editor or in an online editor. Multimedia and embedding 2 In this task we want you to mark up a slightly more complex video player, with multiple sources, subtitles, and other features besides. You need to: Add an attribute to make browsers display some default controls. Add some appropriate fallback text for browsers that don't support <video>. Add multiple sources, containing the paths to the video files. The...
... pixels). Make the video muted by default. Display the text tracks contained in the media folder, in a file called subtitles_en.vtt, when the video is playing. You must explicitly set the type as subtitles, and the subtitle language to English. Try updating the live code below to recreate the finished example: Download the starting point for this task to work in your own editor or in an online editor. Multimedia and embedding 3 For this final task you have two tasks to do: Embed a PDF into the page. The PDF is called mypdf.pdf, and is contained in the media folder. Go to a sharing site like YouTube or Google Maps, and embed a video or other media item into the page. Try updating the live code below to recreate the finished example: Download the starting point for this task...
...And 2 more matches
Test your skills: Events - Learn web development
If you get stuck, then ask us for help -- see the Assessment or further help section at the bottom of this page. ...
... our first events-related task, you need to create a simple event handler that causes the text inside the button (btn) to change when it is clicked on, and change back when it is clicked again. The HTML should not be changed; just the JavaScript. Try updating the live code below to recreate the finished example: Download the starting point for this task to work in your own editor or in an online editor. Events 2 Now we'll look at keyboard events. To pass this assessment you need to build an event handler that moves the circle around the provided canvas when the WASD keys are pressed on the keyboard. The circle is drawn with the function drawCircle(), which takes the folllowing parameters as inputs: x -- the x coordinate of the circle. y -- the y coordinate of the circle. size -- ...
...eys are pressed on the keyboard. The circle is drawn with the function drawCircle(), which takes the folllowing parameters as inputs: x -- the x coordinate of the circle. y -- the y coordinate of the circle. size -- the radius of the circle. Try updating the live code below to recreate the finished example: Download the starting point for this task to work in your own editor or in an online editor. Events 3 In our final events-related task, you need to set an event listener on the <button>s' parent element (<div class="button-bar"> ... </div>), which when invoked by clicking any of the buttons will set the background of the button-bar to the color contained in the button's data-color attribute. We want you to solve this without looping through all the buttons and giving each one...
...And 2 more matches
Test your skills: Functions - Learn web development
If you get stuck, then ask us for help -- see the Assessment or further help section at the bottom of this page. ...
...ace is our Manipulating documents tutorial. Functions 1 For the first task, you have to create a simple function -- chooseName() -- that prints a random name from the provided array (names) to the provided paragraph (para), and then run it once. Try updating the live code below to recreate the finished example: Download the starting point for this task to work in your own editor or in an online editor. Functions 2 For our second functions-related task, you need to create a function that draws a rectangle on the provided <canvas> (reference variable canvas, context available in ctx), based on the five provided input variables: x -- the x coordinate of the rectangle. y -- the y coordinate of the rectangle. width -- the width of the rectangle. height -- the height of the rectangle...
...-- the height of the rectangle. color -- the color of the rectangle. You'll want to clear the canvas before drawing, so that when the code is updated in the case of the live version, you don't get lots of rectangles drawn on top of one another. Try updating the live code below to recreate the finished example: Download the starting point for this task to work in your own editor or in an online editor. Functions 3 In this task, you return to the problem posed in Task 1, with the aim of improving it. The three improvements we want you to make are: Refactor the code that generates the random number into a separate function called random(), which takes as parameters two generic bounds that the random number should be between, and returns the result. Update the chooseName() function ...
...And 2 more matches
Test your skills: Loops - Learn web development
We didn't provide live editable versions of these tasks because of the risk of creating infinite loops and crashing the assessment page! If you get stuck, then ask us for help -- see the Assessment or further help section at the bottom of this page. ...
...ns. A good starting place is our Manipulating documents tutorial. Loops 1 In our first looping task we want you start by creating a simple loop that goes through all the items in the provided myArray and prints them out on the screen inside list items (i.e., <li> elements), which are appended to the provided list. Download the starting point for this task to work in your own editor or in an online editor. Loops 2 In this next task, we want you to write a simple program that, given a name, searches an array of objects containing names and phone numbers (phonebook) and, if it finds the name, outputs the name and phone number into the paragraph (para) and then exits the loop before it has run its course. You are given three variables to begin with: i -- starts off with a value of 0; i...
... are given three variables to begin with: i -- starts off with a value of 0; intended to be used as an iterator. name -- contains a name to search for para -- contains a reference to a paragraph, which will be used to report the results. You should use a type of loop that you've not used in the previous task. Download the starting point for this task to work in your own editor or in an online editor. Loops 3 In this final task, you are provided with the following: i -- starts off with a value of 500; intended to be used as an iterator. para -- contains a reference to a paragraph, which will be used to report the results. isPrime() -- a function that, when passed a number, returns true if the number is a prime number, and false if not. You need to use a loop to go through the...
...And 2 more matches
Test your skills: Arrays - Learn web development
If you get stuck, then ask us for help -- see the Assessment or further help section at the bottom of this page. ...
...variable called myArray. The items can be anything you want -- how about your favourite foods or bands? Next, modify the first two items in the array using simple bracket notation and assignment. Then add a new item to the beginning of the array. Try updating the live code below to recreate the finished example: Download the starting point for this task to work in your own editor or in an online editor. Arrays 2 Now let's move on to another task. Here you are provided with a string to work with. We'd like you to: Convert the string into an array, removing the + characters in the process. Save the result in a variable called myArray. Store the length of the array in a variable called arrayLength. Store the last item in the array in a variable called lastItem. Try updating the li...
...rt the string into an array, removing the + characters in the process. Save the result in a variable called myArray. Store the length of the array in a variable called arrayLength. Store the last item in the array in a variable called lastItem. Try updating the live code below to recreate the finished example: Download the starting point for this task to work in your own editor or in an online editor. Arrays 3 For this final array task, we provide you with a starting array, and you will work in somewhat the opposite direction. You need to: Remove the last item in the array. Add two new names to the end of the array. Go over each item in the array and add its index number after the name inside parentheses, for example Ryu (0). Note that we don't teach how to do this in the Array...
...And 2 more matches
Adding features to our bouncing balls demo - Learn web development
ension of JavaScript objects and object-oriented constructs Starting point To get this assessment started, make a local copy of index-finished.html, style.css, and main-finished.js from our last article in a new directory in your local computer. Alternatively, you could use a site like JSBin or Glitch to do your assessment. You could paste the HTML, CSS and JavaScript into one of these online editors. If the online editor you are using doesn't have separate JavaScript/CSS panels, feel free to put them inline <script>/<style> elements inside the HTML page. Note: If you get stuck, then ask us for help -- see the Assessment or further help section at the bottom of this page. Hints and tips A couple of pointers before you get started. This assessment is quite challenging. Read the...
...hods EvilCircle() should have four methods, as described below. draw() This method has the same purpose as Ball()'s draw() method: It draws the object instance on the canvas. It will work in a very similar way, so you can start by copying the Ball.prototype.draw definition. You should then make the following changes: We want the evil circle to not be filled in, but rather just have an outer line (stroke). You can achieve this by updating fillStyle and fill() to strokeStyle and stroke(). We also want to make the stroke a bit thicker, so you can see the evil circle a bit more easily. This can be achieved by setting a value for lineWidth somewhere after the beginPath() call (3 will do). checkBounds() This method will do the same thing as the first part of Ball()'s update() function -- l...
...omewhere after the beginPath() call (3 will do). checkBounds() This method will do the same thing as the first part of Ball()'s update() function -- look to see whether the evil circle is going to go off the edge of the screen, and stop it from doing so. Again, you can mostly just copy the Ball.prototype.update definition, but there are a few changes you should make: Get rid of the last two lines -- we don't want to automatically update the evil circle's position on every frame, because we will be moving it in some other way, as you'll see below. Inside the if() statements, if the tests return true we don't want to update velX/velY; we want to instead change the value of x/y so the evil circle is bounced back onto the screen slightly. Adding or subtracting (as appropriate) the evil circ...
...And 2 more matches
Working with JSON - Learn web development
some JSON data on a website. Getting started To begin with, make local copies of our heroes.html and style.css files. The latter contains some simple CSS to style our page, while the former contains some very simple body HTML: <header> </header> <section> </section> Plus a <script> element to contain the JavaScript code we will be writing in this exercise. At the moment it only contains two lines, which grab references to the <header> and <section> elements and store them in variables: const header = document.querySelector('header'); const section = document.querySelector('section'); We have made our JSON data available on our GitHub, at https://mdn.github.io/learning-area/javascript/oojs/json/superheroes.json. We are going to load it into our page, and use some nifty DOM manipulation...
... To start with, we store the URL of the JSON we want to retrieve in a variable. Add the following at the bottom of your JavaScript code: let requestURL = 'https://mdn.github.io/learning-area/javascript/oojs/json/superheroes.json'; To create a request, we need to create a new request object instance from the XMLHttpRequest constructor, using the new keyword. Add the following below your last line: let request = new XMLHttpRequest(); Now we need to open the request using the open() method. Add the following line: request.open('GET', requestURL); This takes at least two parameters -- there are other optional parameters available. We only need the two mandatory ones for this simple example: The HTTP method to use when making the network request. In this case GET is fine, as ...
...kes at least two parameters -- there are other optional parameters available. We only need the two mandatory ones for this simple example: The HTTP method to use when making the network request. In this case GET is fine, as we are just retrieving some simple data. The URL to make the request to -- this is the URL of the JSON file that we stored earlier. Next, add the following two lines -- here we are setting the responseType to JSON, so that XHR knows that the server will be returning JSON, and that this should be converted behind the scenes into a JavaScript object. Then we send the request with the send() method: request.responseType = 'json'; request.send(); The last bit of this section involves waiting for the response to return from the server, then dealing with it. ...
...And 2 more matches
Object-oriented JavaScript for beginners - Learn web development
rticle. A simple example Let's start by looking at how you could define a person with a normal function. ...
...me property will be equal to the name value passed to the constructor call, and the greeting() method will use the name value passed to the constructor call too. Note: A constructor function name usually starts with a capital letter -- this convention is used to make constructor functions easier to recognize in code. ...
...on name usually starts with a capital letter -- this convention is used to make constructor functions easier to recognize in code. ...
...And 2 more matches
Test your skills: Object-oriented JavaScript - Learn web development
If you get stuck, then ask us for help -- see the Assessment or further help section at the bottom of this page. ...
... to see whether it logs the calculation result to the browser DevTools' console as expected. Create a new instance of Shape called triangle, with a name of triangle and a sideLength of 3. Call triangle.calcPerimeter() to check that it works OK. Try updating the live code below to recreate the finished example: Download the starting point for this task to work in your own editor or in an online editor. OOJS 2 Next up we want you to take the Shape class you saw in Task #1 (including the calcPerimeter() method) and recreate it using ES class syntax instead. Test that it works by creating the square and triangle object instances as before (using new Shape() for both), and then calling their calcPerimeter() methods. Try updating the live code below to recreate the finished example: ...
... (including the calcPerimeter() method) and recreate it using ES class syntax instead. Test that it works by creating the square and triangle object instances as before (using new Shape() for both), and then calling their calcPerimeter() methods. Try updating the live code below to recreate the finished example: Download the starting point for this task to work in your own editor or in an online editor. OOJS 3 Finally, we'd like you to start with the ES Shape class you created in the last task. We'd like you to create a Square class that inherits from Shape, and adds a calcArea() method that calculates the square's area. Also set up the constructor so that the name property of Square object instances is automatically set to square, and the sides property is automatically set to 4. Wh...
...And 2 more matches
Test your skills: Object basics - Learn web development
If you get stuck, then ask us for help -- see the Assessment or further help section at the bottom of this page. ...
... to Store the value of the name property inside the catName variable, using bracket notation. Run the greeting() method using dot notation (it will log the greeting to the browser DevTools' console). Update the color property value to black. Try updating the live code below to recreate the finished example: Download the starting point for this task to work in your own editor or in an online editor. Object basics 2 In our next task, we want you to have a go at creating your own object literal to represent one of your favourite bands. The required members are: name: A string representing the band name. nationality: A string representing the country the band comes from. genre: What type of music the band plays. members: A number representing the number of members the band has.
...albums array. Once you've done this, you should then write a string to the variable bandInfo, which will contain a small biography detailing their name, nationality, years active, and style, and the title and release date of their first album. Try updating the live code below to recreate the finished example: Download the starting point for this task to work in your own editor or in an online editor. Object basics 3 Finally for our object basics assessment, we want you to return to the cat object literal from Task #1. We want you to rewrite the greeting() method so that it logs "Hello, said Bertie the Cymric." to the browser DevTools' console, but in a way that will work across any cat object of the same structure, regardless of its name or breed. When you are done, write your own...
...And 2 more matches
Introduction to client-side frameworks - Learn web development
It follows a similar pattern to the one we used to build a list item element: function buildDeleteButtonEl(id) { const button = document.createElement('button'); const textContent = document.createTextNode('Delete'); button.setAttribute('type',...
...); const span = document.createElement('span'); const textContent = document.createTextNode(name); span.appendChild(textContent) item.id = id; item.appendChild(span); item.appendChild(buildDeleteButtonEl(id)); return item; } Here, we use the document.createElement() method to make our <li>, and several more lines of code to create the properties and children it needs. The tenth line of this snippet references another build function: buildDeleteButtonEl(). It follows a similar pattern to the one we used to build a list item element: function buildDeleteButtonEl(id) { const button = document.createElement('button'); const textContent = document.createTextNode('Delete'); button.setAttribute('type', 'button'); button.appendChild(textContent); return button; } This ...
... Working directly with the DOM, as in this example, requires understanding many things about how the DOM works: how to make elements; how to change their properties; how to put elements inside of each other; how to get them on ...
...And 2 more matches
Vue conditional rendering: editing existing todos - Learn web development
will take advantage of Vue's conditional rendering capabilities -- namely v-if and v-else -- to allow us to toggle between the existing todo item view, and an edit view where you can update todo item labels. We'll also look at adding functionality to delete todo items. Prerequisites: Familiarity with the core HTML, CSS, and JavaScript languages, knowledge of the terminal/command line. Vue components are written as a combination of JavaScript objects that manage the app's data and an HTML-based template syntax that maps to the underlying DOM structure. For installation, and to use some of the more advanced features of Vue (like Single File Components or render functions), you'll need a terminal with node + npm installed. Objective: To learn how to do condi...
...This is a useful way...
...onent to display only one block or another, since Vue will only render one of these blocks at a time. We'll do this in our app, as it will allow us to replace the code that displays our to-do item with the edit form. ...
...And 2 more matches
Introduction to automated testing - Learn web development
permissions errors, Fixing npm permissions should sort you out. To start using Node/npm-based packages on your projects, you need to set up your project directories as npm projects. This is easy to do. For example, let's first create a test directory to allow us to play without fear of breaking anything. Create a new directory somewhere sensible using your file manager UI, or, on a command line, by navigating to the location you want and running the following command: mkdir node-test To make this directory an npm project, you just need to go inside your test directory and initialize it, with the following: cd node-test npm init This second command will ask you many questions to find out the information required to set up the project; you can just select the defaults for now. ...
...s in older browsers (see gulp-babel). See the links above for full instructions on the different gulp packages we are using. To use each plugin, you need to first install it via npm, then require any dependencies at the top of the gulpfile.js file, then add your test(s) to the bottom of it, and finally add the name of your task inside the default task. html-tidy Install using the following line: npm install --save-dev gulp-htmltidy Note: --save-dev adds the package as a dependency to your project. If you look in your project's package.json file, you'll see an entry for it in the devDependencies property. Add the following dependency to gulpfile.js: const htmltidy = require('gulp-htmltidy'); Add the following test to the bottom of gulpfile.js: function html(cb) { ...
... as we want. We first run htmltidy() on the source, which goes through and fixes errors in our file. The second pipe() function writes the output HTML file to the build directory. In the input version of the file, you may have noticed that we put an empty <p> element; htmltidy has removed this by the time the output file has been created. ...
...And 2 more matches
Commenting IDL for better documentation
d. Happily, following these recommendations will also help ensure your comments are extremely human-readable, too. Don't worry! You don't need to write perfect documentation. That is why Mozilla has a couple of writers on-staff as well as a horde of happy volunteers. We will take your comments and notes and turn them into beautiful, easy to search and read documentation. But by following the guidelines here, you can help make sure that our tools can generate a "good start" version of the documentation for your interfaces, and that the writers will be able to easily figure out what the tools are not able to do automatically. Comment format Doxygen supports several comment formats; for style and consistency reasons, we use the following: /** * */ Note the two asterisks ("**") on the first lin...
...ks remark A remark paragraph to be included in the Remarks section of the documentation. Note: This is not yet supported by our documentation tool. Using it will make it easier for documenters. @see description Either an interface or a HTML link. Note: This is not yet supported by our documentation tool. Using it will make it easier for documenters. - or . Used at the beginning of a comment line to indicate an unordered list item. There must be a space between the list marker and the item. Nested lists should be indented from the previous level by two spaces. -# Used at the beginning of a comment line to indicate an ordered list item. There must be a space between the list marker and the item. Nested lists should be indented from the previous level by two spaces. Other tips Some oth...
...Everything in the Doxygen comment before a method, attribute, constant, or whatnot will be used as part of its description when the automatic documentation generator tool scans your IDL, so if you don't want it in the docs, you probably shouldn't put it there. Use a different format of comment instead, such as simply /* ... ...
...And 2 more matches
Mozilla Quirks Mode Behavior
r font-family. Make TABLE borders gray rather than using the foreground color. Collapse top margin of BODY and TD and bottom margin of TD. Collapse the bottom or top margins of empty elements (bug 97361). Support <PRE wrap>, <PRE cols>, <PRE width>. Orphaned DD has generated content :before instead of margin (bug 5119). Indent nested DL elements (bug 8749). MAP acts like an inline, not a block. Give floated IMG a 3px margin (bug 58899). Residual style tags' size info does not take precedence over heading tags' size (bug 77352). Use box-sizing:border-box for most INPUT types and TEXTAREA. Give FORM a margin-bottom:1em (bug 41806). In quirks mode CSS class and id names are case insensitive. In standards mode they are case sensitive. (This also applies to ...
...In standards mode they are case sensitive. (This also applies to getElementsByClassName.) Stylesheets linked in the document with an advisory MIME type of text/css will still be treated as CSS even if the server gives a Content-Type header other than text/css. The CSS parser accepts colors not beginning with #, except in shorthands. The CSS parser interprets unitless numbers as px (except for line-height and any other properties where they have distinct meaning, and except in shorthands). In quirks mode, the CSS parser allows {} around the contents of style attributes (bug 99554). This behavior is being removed in Firefox 27, for interoperability. (bug 915053) An empty string for the background attribute sets the background URL to empty only in quirks mode. The topmargin, bottommargin, ...
...ently up to Gecko 1.9.2 (Firefox 3.6 / Thunderbird 3.1 / Fennec 1.0) (bug 121738). In quirks mode, the URL fragment #top scrolls to the top of the page when there is no such anchor. Obsolete since Gecko 10.0 However, HTML5 requires this behavior, and starting in Gecko 10.0 (Firefox 10.0 / Thunderbird 10.0 / SeaMonkey 2.7), this also works in standards mode (bug 80784, bug 93077). Block and Inline layout [This quirk is present in almost standards mode.] Line height (not line-height) calculations are different to fix bug 5821 and bug 24186 (some other issues are described in bug 22274). See almost standards mode for more details. There are a bunch of quirks to get percentage heights on images, tables, objects, and applets (etc.?) to "work" (the way they did in Netscape Navigator 4), ev...
...And 2 more matches
DMD
ing by going to about:memory and looking for "Save DMD Output". If DMD has been properly enabled, the "Save" button won't be grayed out. Look at the "Trigger" section below to see the full list of ways to get a DMD report once you have it activated. Note that stack information you get will likely be less detailed, due to being unable to symbolicate. You will be able to get function names, but not line numbers. Desktop Firefox (Linux) Build Build Firefox with these options: ac_add_options --enable-dmd If building via try server, modify browser/config/mozconfigs/linux64/common-opt or a similar file before pushing. Launch Use mach run --dmd; use --mode to choose the mode. Add --debug to run under gdb. Trigger There are three ways to trigger a DMD snapshot. Visit about:memory and clic...
...tmp/dmd-1414556492-5222.json.gz for writing DMD[5222] Dump 1 { DMD[5222] Constructing the heap block list... DMD[5222] Constructing the stack trace table... DMD[5222] Constructing the stack frame table... DMD[5222] } In an e10s-enabled build, you'll see separate output for each process. This step can take 10 or more seconds and may make Firefox freeze temporarily. If you see the "opened" line, it tells you where the file was saved. It's always in a temp directory, and the filenames are always of the form dmd-<pid>. Desktop Firefox (Mac) Build Build with these options: ac_add_options --enable-dmd If building via try server, modify browser/config/mozconfigs/macosx64/common-opt or a similar file before pushing. Launch Use mach run --dmd; use --mode to choose the mode. Add --debug...
...file before pushing. Launch Use mach run --dmd; use --mode to choose the mode. Add --debug to run under lldb. Trigger Follow the Trigger instructions for Linux. Note that on Mac this step can take 30+ seconds. Desktop Firefox (Windows) Build Build with these options: ac_add_options --enable-dmd If building via try server, modify browser/config/mozconfigs/win32/common-opt. Also, add this line to build/mozconfig.common: MOZ_CRASHREPORTER_UPLOAD_FULL_SYMBOLS=1 Launch On a local build, use mach run --dmd; use --mode to choose the mode. On a build done by the try server, follow these instructions instead. Trigger Follow the Trigger instructions for Linux. Fennec In order to use DMD on Fennec you will need root access on the Android device. Instructions on how to root your device...
...And 2 more matches
McCoy
ey are lost! Running McCoy To run McCoy simply run the mccoy executable (or the McCoy application on OS X). The first time it runs it will ask you to create a master password. It is strongly recommended that you use a password to protect your McCoy data. Once you have a password set you can change it from the Keys menu and you will have to enter it each time you run McCoy. ...
... executable (or the McCoy application on OS X). The first time it runs it will ask you to create a master password. It is strongly recommended that you use a password to protect your McCoy data. Once you have a password set you can change it from the Keys menu and you will have to enter it each time you run McCoy. ...
...rd to protect your McCoy data. Once you have a password set you can change it from the Keys menu and you will have to enter it each time you run McCoy. Signing from command line Currently there is no support to run McCoy from command line under Windows, but it is planned to add this support in the future. ...
...And 2 more matches
Midas
y demo of this here. Properties document.designMode By setting this property to "on", the document becomes editable. Notes Since an entire document becomes editable, authors often load the editable document into an IFRAME and do the bulk of the scripting in the parent document. According to standards, The IFRAME element has the contentDocument property that refers to the document in the inline frame. It also has a property called contentWindow that refers to the window object inside the inline frame. This also avoids problems with bug 198155. In addition to the built-in commands, advanced editing can be done by manipulating the Selection and range objects. It is beneficial to be familiar with these objects when working with an editable document. Examples This example shows the basic...
... around selection or at insertion point. indent Indent the block where the caret is located. If the caret is inside a list, that item becomes a sub-item one level deeper. insertbronreturn true/false Selects whether pressing return inside a paragraph creates another paragraph or just inserts a <br> tag. inserthorizontalrule null/string (when string is the Line's id) This command will insert a horizontal rule (line) at the insertion point. Does it delete the selection? Yes! inserthtml A string. This command will insert the given html into the <body> in place of the current selection or at the caret location. The given string is the HTML to insert. insertimage A URI. This command will insert an image (refe...
...ically trigger this command (typically accel-V) with or without the signed JS or any code on the page to handle it. redo This command will redo the previous undo action. If undo was not the most recent action, this command will have no effect. note: the shortcut key will automatically trigger this command (typically accel-shift-Z) removeformat Removes inline formatting from the current selection. selectall This command will select all of the contents within the editable area. note: the shortcut key will automatically trigger this command (typically accel-A) strikethrough If there is no selection, the insertion point will set strikethrough for subsequently typed characters. If there is a selection and all of...
...And 2 more matches
An overview of NSS Internals
ingly. The templates are usually closely aligned to definitions found in RFC documents. A data block described as DER is usually in ASN.1 format. You must know which data you are expecting, and use the correct template for parsing, based on the context of your software's interaction. Data described as PEM is a base64 encoded presentation of DER, usually wrapped between human readable BEGIN/END lines. NSS prefers the binary presentation, but is often capable to use base64 or ASCII presentations, especially when importing data from files. A recent development adds support for loading external PEM files that contain private keys, in a software library called nss-pem, which is separately available, but should eventually become a core part of NSS. Looking at the code level, NSS deals with blo...
...tion, you'll already have two layers, the basic NSPR layer and an SSL library layer. The Mozilla applications define a third layer where application specific processing is performed. You can find more details in the NSPR reference documents. NSS occassionally has to create outbound network connections, in addition to the connections requested by the application. Examples are retrieving OCSP (Online Certificate Status Protocol) information or downloading a CRL (Certificate Revocation List). However, NSS doesn't have an implementation to work with network proxies. If you must support proxies in your application, you are able to register your own implementation of an http request callback interface, and NSS can use your application code that supports proxies. When using hashing, encryption,...
...). Create a context handle while providing all the parameters required for the operation, then call an "update" function multiple times to pass subsets of the input to NSS. The data will be processed and either returned directly or sent to a callback function registered in the context. When done, you call a finalization function that will flush out any pending data and free the resources. This line is a placeholder for future sections that should explain how libpkix works and is designed. If you want to work with NSS, it's often helpful to use the command line utilities that are provided by the NSS developers. There are tools for managing NSS databases, for dumping or verifying certificates, for registering PKCS#11 modules with a database, for processing CMS encrypted/signed messages, et...
...And 2 more matches
NSS Sample Code Utilities_1
word 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. ...
...et 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. ...
...n = level; if (!len) { PR_fprintf(out, "(empty)\n"); return; } for (i = 0; i < len; i++) { if (i != len - 1) { PR_fprintf(out, "%02x:", data[i]); column += 3; } else { PR_fprintf(out, "%02x", data[i]); column += 2; break; } if (column > 76 || (i % 16 == limit)) { Newline(out); column = level; limit = i % 16; } } if (column != level) { Newline(out); } } /* * GetDigit */ int GetDigit(char c) { if (c == 0) { return -1; } if (c <= '9' && c >= '0') { return c - '0'; } if (c <= 'f' && c >= 'a') { return c - 'a' + 0xa; } if (c <= 'F' && c >= 'A') { return c...
...And 2 more matches
Rebranding SpiderMonkey (1.8.5)
ations. find ./ -type f -exec sed -i "s/$BRAND.pc/mozjs185.pc/" {} \; The last recursive search and replace, changes the file name of the static library: find ./ -type f -exec sed -i "s/js_static/$BRAND_static/" {} \; Allright, almost there. Now comes the manual editing. Using your favorite editor open up the file named Makefile for editing. ...
...exec sed -i "s/$BRAND.pc/mozjs185.pc/" {} \; The last recursive search and replace, changes the file name of the static library: find ./ -type f -exec sed -i "s/js_static/$BRAND_static/" {} \; Allright, almost there. Now comes the manual editing. Using your favorite editor open up the file named Makefile for editing. ...
... {} \; The last recursive search and replace, changes the file name of the static library: find ./ -type f -exec sed -i "s/js_static/$BRAND_static/" {} \; Allright, almost there. Now comes the manual editing. Using your favorite editor open up the file named Makefile for editing. ...
...And 2 more matches
Index
ll into the JSAPI but does not block. 192 JS_BindCallable JSAPI Reference, Reference, Reference(2), SpiderMonkey JS_BindCallable binds the given callable to use the given object as this. 193 JS_BufferIsCompilableUnit JSAPI Reference, SpiderMonkey Given a buffer, return false if the buffer might become a valid JavaScript statement with the addition of more lines. Otherwise return true. The intent is to support interactive compilation - accumulate lines in a buffer until JS_BufferIsCompilableUnit is true, then pass it to the compiler. 194 JS_CStringsAreUTF8 JSAPI Reference, Obsolete, SpiderMonkey By default, all C/C++ strings passed into the JSAPI are treated as ISO/IEC 8859-1, also known as ISO-Latin-1. That is, each byte is treated...
...r in which obj's properties were defined. Note also that while for..in includes properties inherited from prototypes, iterator objects do not.) 411 JS_NewRegExpObject JSAPI Reference, Reference, Reference(2), SpiderMonkey JS_NewRegExpObject and JS_NewUCRegExpObject create a new RegExp instance. The flags from the built-in RegExp constructor properties ignoreCase, global, multiline, and sticky are OR'd in with the provided flags parameter. 412 JS_NewRuntime JSAPI Reference, SpiderMonkey JS_NewRuntime initializes the JavaScript runtime environment. Call JS_NewRuntime before making any other API calls except JS_Init. JS_NewRuntime allocates memory for the JSRuntime and initializes certain internal runtime structures. maxbytes specifies the number of alloc...
...rily you set a prototype for an object when you create the object with JS_NewObject, but if you do not set a prototype at that time, you can later call JS_SetPrototype to do so. 475 JS_SetRegExpInput JSAPI Reference, Reference, Reference(2), SpiderMonkey JS_SetRegExpInput sets the pending input string of the built-in RegExp object to the specified input string. The JSREG_MULTILINE is set to multiline parameter, and other flags are all reset. 476 JS_SetScriptStackQuota JSAPI Reference, Obsolete, SpiderMonkey Set the quota on the number of bytes that stack-like data structures can use when the runtime compiles and executes scripts. These structures also consume heap space, so JS_SetThreadStackLimit does not bound their size. The default quota is 32MB whi...
...And 2 more matches
Bytecode Descriptions
t eval. Direct eval causes all bindings in enclosing non-global scopes to be marked "aliased". The optimization that puts bindings in stack slots has to prove that the bindings won't need to be captured by closures or accessed using JSOp::{Get,Bind,Set,Del}Name instructions. Direct eval makes that analysis impossible. The instruction immediately following any JSOp::*Eval instruction must be JSOp::Lineno. Implements: Function Call Evaluation, steps 5-7 and 9, when the syntactic critera for direct eval in step 6 are all met. Format: JOF_ARGC, JOF_INVOKE, JOF_TYPESET, JOF_CHECKSLOPPY, JOF_IC SpreadEval Stack: callee, this, args => rval Spread-call variant of JSOp::Eval. See JSOp::SpreadCall for restrictions on args. Format: JOF_INVOKE, JOF_SPREAD, JOF_TYPESET, JOF_CHECKSLOPPY, JOF_IC StrictE...
...suspended. The resume point indicated by resumeIndex must be the next instruction in the script, which must be AfterYield. Implements: GeneratorStart, steps 4-7. Format: JOF_RESUMEINDEX AfterYield Operands: (uint32_t icIndex) Bytecode emitted after yield expressions. This is useful for the Debugger and AbstractGeneratorObject::isAfterYieldOrAwait. It's treated as jump target op so that the Baseline Interpreter can efficiently restore the frame's interpreterICEntry when resuming a generator. The preceding instruction in the script must be Yield, InitialYield, or Await. Format: JOF_ICINDEX FinalYieldRval Stack: gen => Suspend and close the current generator, async function, or async generator. gen must be the generator object for the current frame. If the current function is a non-async ge...
... of %GeneratorPrototype%.next, .throw, and .return. gen must be a suspended generator object. resumeKind must be in range for GeneratorResumeKind. Format: JOF_INVOKE Control flow Jump targets JumpTarget Operands: (uint32_t icIndex) No-op instruction marking the target of a jump instruction. This instruction and a few others (see js::BytecodeIsJumpTarget) are jump target instructions. The Baseline Interpreter uses these instructions to sync the frame's interpreterICEntry after a jump. Ion uses them to find block boundaries when translating bytecode to MIR. Format: JOF_ICINDEX LoopHead Operands: (uint32_t icIndex, uint8_t depthHint) Marks the target of the backwards jump for some loop. This is a jump target instruction (see JSOp::JumpTarget). Additionally, it checks for interrupts and ha...
...And 2 more matches
JS_CompileScriptForPrincipals
ce JSAPI 28This feature is obsolete. Although it may still work in some browsers, its use is discouraged since it could be removed at any time. Try to avoid using it. Compile a security-enabled script for execution. ...
...y-enabled script for execution. ...
... *filename, unsigned int lineno); JSScript * JS_CompileUCScriptForPrincipals(JSContext *cx, JSObject *obj, JSPrincipals *principals, const jschar *src, size_t length, const char *filename, unsigned int lineno); JSObject * JS_CompileScriptForPrincipalsVersion(JSContext *cx, JSObject *obj, JSPrincipals *principals, const char *src, size_t length, const char *filename, unsigned int lineno, JSVersion version); // Obsoleted since JSAPI 19 JSObject * JS_CompileUCScriptForPrincipalsVersion(JSContext *cx, JSObject *obj, JSPrincipals *principals, const jschar *src, size_t length, const char *filename, unsigned int lineno, JSVersion version); // Obsoleted since JSAPI 19 Name Type Description cx JSContext * The context in which to compile the scr...
...And 2 more matches
Gecko object attributes
e actual markup tag used to create this element (also used in XUL). Applied to: any role xml-roles If a dynamic content accessibility role string is used, it is exposed here. This may provide more information than the mapped role, which is best-fit. The role string may be a space-delimited list of roles. Applied to: any role Group attributes level For headings, the heading level. For outline items, the indentation level. For diagrams with levels, each item can have its level specified. The level value is 1-based. Applied to: grid, heading, listitem, row, tablist Exposed in ARIA: aria-level posinset If this item is in a group, what is the item number within the group, where the size is defined by the setsize attribute. The first item should have posinset="1", and the last item sho...
...mines that it is a table that is probably used for layout, not for table. Value not set means it is probably a data table. Applied to: ROLE_TABLE table-cell-index The index of the table cell accessible. Use nsIAccessibleTable and nsIAccessibleTableCell instead. Applied to ROLE_CELL Hypertext attributes formatting "block" if the object uses block formatting, and thus starts on a new line and ends with a hard line break that is not visible in the actual text. For example, a heading, paragraph, or list item is typically formatted as a block, but there is no requirement to do so. Their formatting may have been changed with CSS. An example of this is often horizontal navigation bars with list items that are formatted with CSS display: inline. Applied to: any object that supports the...
.... For example, a heading, paragraph, or list item is typically formatted as a block, but there is no requirement to do so. Their formatting may have been changed with CSS. An example of this is often horizontal navigation bars with list items that are formatted with CSS display: inline. Applied to: any object that supports the hypertext interface Note: deprecated, use display attribute instead line-number The current line number of the caret, whether simply because the "browse with caret" option is on, or the caret used for editing text. The line number is relative to the top of the currently focused area (the document, a rich text editable area, or an input control). Applied to: any focusable accessible text object margin-bottom Specifies how much vertical space there will be after...
...And 2 more matches
XPCShell Reference
(Setting this option disables the "Interactive" mode) -f This option specifies a script file to execute. xpcshell terminates upon script completion. You can specify multiple JS files to execute by using multiple -f arguments, and the scripts will be executed in the order encountered. Furthermore, XPCShell looks for xpcshell.js in the current directory. If that file is found, it is executed before any other JS files specified. -g This option specifies which Gecko Runtime Environment directory (greDir) to use for XPCOM. ...
...ese are arguments to be passed to the script. These arguments are only passed to "scriptfile" and not the scripts designated by -f options. These arguments appear on the global property arguments. For instance, assume that you have a file called test.js with the following contents: for (prop in arguments) { print(prop + "=" + arguments[prop]); } Entering the following at the command line should produce the following output: $ xpcshell test.js This is a test 0=This 1=is 2=a 3=test XPCShell Extensions Once you execute XPCShell without a script you'll be at the JS> command line. The following are some useful functions that can be invoked from the command line: clear(object) clear() removes all properties from an object. For example, if you created anObject with a property n...
...le, if you created anObject with a property named value and then called clear(anObject), the property value would no longer exist. gc(heapDumpFilename) gc() will invoke garbage collection. It takes an optional argument that can be used to dump the heap to. If specified, it should equate to a valid filename. load(scriptFilename) load() allows you to load and run a script from the command line. For example, load("MyScript.js") will execute the script MyScript.js in the current directory. print(obj1, obj2, ...) print() is useful to print something to the screen. It dumps whatever is passed to the screen, putting spaces between arguments and appending a newline at the end. An example print(1, 2, 3) Will print 1 2 3<newline>. dump(object) dump() is almost like print. It only han...
...And 2 more matches
nsIApplicationCacheChannel
netwerk/base/public/nsIApplicationCacheChannel.idlScriptable This interface is implemented by communication channels that support application caches. 1.0 66 Introduced Gecko 1.9.1 Inherits from: nsIApplicationCacheContainer Last changed in Gecko 2.0 (Firefox 4 / Thunderbird 3.3 / SeaMonkey 2.1) Method overview void markOfflineCacheEntryAsForeign(); Attributes Attribute Type Description chooseApplicationCache boolean When true, the channel will choose an application cache if one was not explicitly provided and none is available from the notification callbacks. The default value is false. This attribute will not be transferred through a redirect. Exceptions thrown NS_ERROR_ALREADY_OPENED If set after calling AsyncOpen() on the channel. in...
...provided. The default value is true. Exceptions thrown NS_ERROR_ALREADY_OPENED If set after calling AsyncOpen() on the channel. loadedFromApplicationCache PRBool true if the resource was loaded from the application cache, otherwise false. This value may be false even if the resource is assigned to an application cache if, for example, it was loaded as a fallback. Read only. ...
...e application cache, otherwise false. This value may be false even if the resource is assigned to an application cache if, for example, it was loaded as a fallback. Read only. Methods markOfflineCacheEntryAsForeign() A shortcut method to mark the cache item of this channel as 'foreign'. See the 'cache selection algorithm' and CACHE_SELECTION_RELOAD action handling in nsContentSink. void markOfflineCacheEntryAsForeign(); Parameters None. ...
...And 2 more matches
nsIDebug
om: nsISupports Last changed in Gecko 1.7 Note: C/C++ consumers who are planning to use the nsIDebug interface with the @mozilla.org/xpcom;1 contract should use NS_DebugBreak() from XPCOM glue instead, or alternatively the NS_ABORT, NS_ASSERTION, NS_BREAK, and NS_WARNING macros, which also call NS_DebugBreak() if used in a debugging build. Method overview void abort(in string aFile, in long aLine); void assertion(in string aStr, in string aExpr, in string aFile, in long aLine); void break(in string aFile, in long aLine); void warning(in string aStr, in string aFile, in long aLine); Methods abort() Requests the process to trigger a fatal abort. void abort( in string aFile, in long aLine ); Parameters aFile File containing abort request. aLine Line number of abort request. a...
... break() Requests the software break into a debugger. If no debugger is running then this usually results in a program crash. ...
... break() Requests the software break into a debugger. ...
...And 2 more matches
nsIMsgIncomingServer
m: nsISupports Last changed in Gecko 1.9.1 (Firefox 3.5 / Thunderbird 3.0 / SeaMonkey 2.0) Method overview void clearAllValues(); void clearTemporaryReturnReceiptsFilter(); void closeCachedConnections(); void configureTemporaryFilters(in nsIMsgFilterList filterList); void configureTemporaryReturnReceiptsFilter(in nsIMsgFilterList filterList); Obsolete since Gecko 1.8 void displayOfflineMsg(in nsIMsgWindow aWindow); boolean equals(in nsIMsgIncomingServer server); void forgetPassword(); void forgetSessionPassword(); AString generatePrettyNameForMigration(); boolean getBoolAttribute(in string name); boolean getBoolValue(in string attr); ACString getCharAttribute(in string name); ACString getCharValue(in string attr); nsILocalFile getFileValue(in string relpref, in...
...wnloadOnBiff boolean downloadSettings nsIMsgDownloadSettings emptyTrashOnExit boolean filterScope nsMsgSearchScopeValue Read only. hostName ACString hostname of the server. incomingDuplicateAction long isDeferredTo boolean Read only. isSecure boolean isSecureServer boolean Read only. key ACString internal pref key - guaranteed to be unique across all servers. ...
...Otherwise, return true. ...
...And 2 more matches
MailNews fakeserver
lers. Writing a new fakeserver Since the number of protocols we use is very small, most people shouldn't have to write an entirely new daemon and handler setup by themselves. That said, someone writing a new test may have to take into account a new handler. A handler will contain the following methods: <caption> Handler methods </caption> Name Arguments Returns Notes [command] rest of sent line Server's response The name is normalized to be uppercase. onError command, rest of sent line Server's response Called if handler does not define the command function. onStartup none Server's response Called when a connection is made. onMultiline sent line Server's response or nothing Called when in multi-line mode. postCommand Server object none Called after every command. The server ...
...line sent line Server's response or nothing Called when in multi-line mode. postCommand Server object none Called after every command. The server is smart about the responses and will normalize all occurrences of '\n' (but not '\r') to '\r\n' for you, as well as append the '\r\n' to the response if not present. It will also properly queue all messages sent in pipelining mode and will present lines without any EOL characters. In addition, it uses UTF-8 as the transmission medium. The server presents the following API to the handler: <caption> Server API </caption> Name Arguments Returns Description closeSocket none nothing Closes the socket and stops the test. setMultiline the new value of multiline nothing The value is a boolean, with true invoking multiline mode. It is off by defa...
...I tend to like using 1024 + default port number myself. ...
...And 2 more matches
Set a conditional breakpoint - Firefox Developer Tools
You'll then see a textbox where you can enter the expression. ...
...You'll then see a textbox where you can enter the expression. ...
...You'll then see a textbox where you can enter the expression. ...
...And 2 more matches
Index - Firefox Developer Tools
t + Function + F5). 117 How to These articles describe how to use the debugger. 118 Access debugging in add-ons The following items are accessible in the context of chrome://browser/content/debugger.xul (or, in version 23 beta, chrome://browser/content/devtools/debugger.xul): 119 Breaking on exceptions When an exception occurs, the line where it occurs is highlighted in the source pane, with a squiggly red line under the problematic code. A tooltip describes the exception. Starting in Firefox 80, a disclosure triangle within the tooltip reveals a stack trace. 120 Debug eval sources You can debug JavaScript code that is evaluated dynamically, either as a string passed to eval() or as a string passed to the F...
...eakpoint There are many different types of breakpoint that can be set in the debugger; this article covers standard (unconditional) breakpoints and conditional breakpoints. 129 Set a conditional breakpoint Conditional, Debugger, Debugging, DevTools, Developer Tools, Firefox, Guide, JavaScript debugging, Tools, WM, breakpoint A normal breakpoint is just associated with a line: when the program reaches that line, the debugger pauses. A conditional breakpoint also has a condition associated with it, which is represented as an expression. When the program reaches the line, the debugger pauses only if the breakpoint's specified expression evaluates to true. 130 Set watch expressions When debugging code, sometimes it's useful to watch expressions as e...
... Firefox, Guide, Tools When debugging JavaScript code, it can be useful to know when properties on objects are read or modified. In a large, complex codebase, it's not always easy to know where in the code a given property is accessed. In the Firefox Debugger, this information can be provided by watchpoints. By setting a watchpoint on the property, rather than a breakpoint at a particular line, you can discover where that access occurs. 134 Set a logpoint Debugger, Debugging, Dev Tools, JavaScript debugging, Tools, breakpoint, logpoint Sometimes you want to view a value in your code but you don't want to pause execution. Rather than sprinkle console.log() statements throughout your code, you can use a special type of breakpoint, the logpoint. Logpoints print a mess...
...And 2 more matches
Network request details - Firefox Developer Tools
h governs which referrer information, sent in the Referer header, should be included with requests. (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. Response headers The response headers section shows details about the response. For each line in the response headers section, a question mark links to the documentation for that response header, if one is available. A Raw toggle button in the section heading controls whether the headers are shown with formatting, or as plain, unformatted text. Note that the keys in the response header are all in lowercase, while the request headers keys are not. HTTP/2 requires that all headers be low...
... { "name": "accept-ranges", "value": "bytes" }, { "name": "age", "value": "0" }, { "name": "backend-timing", "value": "D=74716 t=1560258099074460" }, { "name": "cache-control", "value": "private, must-revalidate, max-age=0" }, { "name": "content-disposition", "value": "inline; filename=api-result.js" }, { "name": "content-encoding", "value": "gzip" }, { "name": "content-length", "value": "673" }, { "name": "content-type", "value": "text/javascript; charset=utf-8" }, { "name": "date", "value": "Tue, 11 Jun 2019 13:01:39 GMT" }, { "name": "...
... "name": "Referer", "value": "https://www.wikipedia.org/" }, { "name": "TE", "value": "Trailers" }, { "name": "User-Agent", "value": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:68.0) Gecko/20100101 Firefox/68.0" } ] } } Request headers The Request headers section shows details about the request headers. For each line in the request headers section, a question mark links to the documentation for that request header, if one is available. A Raw toggle button in the section heading controls whether the headers are shown with formatting, or as plain, unformatted text. Cookies tab This tab lists full details of any cookies sent with the request or response: As with headers, you can filter the list of cookie...
...And 2 more matches
Network request list - Firefox Developer Tools
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 Localhost Indicates that the URL belongs to a known tracker that would be blocked with content blocking enabled. ...
...e request: Icon Meaning HTTPS Weak HTTPS (for example, a weak cipher was used) Failed HTTPS (for example, a certificate was invalid) HTTP Localhost Indicates that the URL belongs to a known tracker that would be blocked with content blocking enabled. Timeline The request list also displays a timeline for the different parts of each request. ...
...S Weak HTTPS (for example, a weak cipher was used) Failed HTTPS (for example, a certificate was invalid) HTTP Localhost Indicates that the URL belongs to a known tracker that would be blocked with content blocking enabled. Timeline The request list also displays a timeline for the different parts of each request. ...
...And 2 more matches
Style Editor - Firefox Developer Tools
is the editor pane. This is where the source for the selected style sheet is available for you to read and edit. Any changes you make are immediately applied to the page. This makes it easy to experiment with, revise, and test changes. Once you're satisfied with your changes, you can save a copy locally by clicking the Save button on the sheet's entry in the style sheet pane. The editor provides line numbers and syntax highlighting to help make it easier to read your CSS. It also supports a number of keyboard shortcuts. The Style Editor automatically de-minimizes style sheets that it detects, without affecting the original. This makes it much easier to work on pages that have been optimized. The Style Editor supports autocomplete. Just start typing, and it will offer you a list of suggestio...
... to work on pages that have been optimized. The Style Editor supports autocomplete. Just start typing, and it will offer you a list of suggestions. You can switch autocomplete off in the Style Editor settings. The media sidebar The Style Editor displays a sidebar on the right-hand side whenever the current sheet contains any @media rules. The sidebar lists the rules and provides a link to the line of the sheet where the rule is defined. Click an item to jump to that rule in the sheet. The condition text of the rule is greyed-out if the media query doesn't currently apply. The media sidebar works especially well with Responsive Design View for creating and debugging responsive layouts: From Firefox 46 onwards, if an @media rule contains a screen size in a condition, then it is made clic...
...from them: For this to work, you must: use a CSS preprocessor that understands the Source Map Revision 3 proposal. Currently this means Sass 3.3.0 or above or the 1.5.0 version of Less. Other preprocessors are actively working on adding support, or considering it. actually instruct the preprocessor to generate a source map, for example by passing the --source-map argument to the Lass command-line tool, but in some preprocessors like Sass, source maps are generated by default and you don't need to do anything. 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. From Firefox 35 onwards original sources are displayed by default. Editing origin...
...And 2 more matches
Web console keyboard shortcuts - Firefox Developer Tools
Command Windows macOS Linux Scroll to start of console output (only if the com...
...rl + F Open the object inspector pane Ctrl + Click Ctrl + Click Ctrl + Click Clear the object inspector pane Esc Esc Esc Focus on the command line Ctrl + Shift + K Cmd + Opt + K Ctrl + Shift + K Clear output Ctrl + Shift + L Ctrl + L From Firefox 67: Cmd + K Ctrl + Shift + L Command line interpreter These shortcuts apply when you're in the command line interpreter. ...
...trl + Shift + K Cmd + Opt + K Ctrl + Shift + K Clear output Ctrl + Shift + L Ctrl + L From Firefox 67: Cmd + K Ctrl + Shift + L Command line interpreter These shortcuts apply when you're in the command line interpreter. ...
...And 2 more matches
Attr - Web APIs
Web › API › Attr
The Attr interface represents one of a DOM element's attributes as an object. In most DOM methods, you will directly retrieve the attribute as a string (e.g., Element.getAttribute()), but certain functions (e.g., Element.getAttributeNode()) or means of iterating return Attr types. ...
... most DOM methods, you will directly retrieve the attribute as a string (e.g., Element.getAttribute()), but certain functions (e.g., Element.getAttributeNode()) or means of iterating return Attr types. ...
... inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 70" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monosp...
...And 2 more matches
AudioContext - Web APIs
t controls both the creation of the nodes it contains and the execution of the audio processing, or decoding. You need to create an AudioContext before you do anything else, as everything happens inside a context. ...
...on of the audio processing, or decoding. You need to create an AudioContext before you do anything else, as everything happens inside a context. It's recommended to create one AudioContext and reuse it instead of initializing a new one each time, and it's OK to use a single AudioContext for several different audio source and pipeline concurrently. ...
...s recommended to create one AudioContext and reuse it instead of initializing a new one each time, and it's OK to use a single AudioContext for several different audio source and pipeline concurrently. ...
...And 2 more matches
Using the CSS Typed Object Model - Web APIs
e property, which indicates how many properties are in the map. We iterate through the style map, creating a <dt> and <dd> for each property and value respectively. In browsers that support computedStyleMap(), you'll see a list of all the CSS properties and values. In other browsers, you'll just see a link. Did you realize how many default CSS properties a link had? Update the JavaScript on line 2 to select the <p> rather than the <a>. You'll notice a difference in the margin-top and margin-bottom default computed values. .get() method / custom properties Let's update our example to only retrieve a few properties and values. Let's start by adding some CSS to our example, including a custom property and an inhertable property: p { font-weight: bold; } a { --color: red; color: ...
...The link has inherited font-weight: bold; from the paragraph's styles, listing it as font-weight: 700. Custom properties, like our --color: red , are properties. As such, they are accessible via get(). You'll note that custom properties retain the value as written in the stylesheet, whereas computed styles will ...
...ds. Let's examine a CSS example with several custom properties, transforms, calc()s, and other features. ...
...And 2 more matches
CanvasRenderingContext2D.stroke() - Web APIs
Strokes are aligned to the center of a path; in other words, half of the stroke is drawn on the inner side, and half on the outer side. The stroke is drawn using the non-zero winding rule, which means that path intersections will still get filled. Syntax void ctx.stroke(); void ctx.stroke(path); Parameters path A Path2D path to stroke. Examples A simple stroked rectangle This example creates a rectangle using the rect() method, and then draws it to the canvas using stroke(). ...
...t of the current path, and get stroked every time you call the stroke() method. In some cases, however, this may be the desired effect. HTML <canvas id="canvas"></canvas> JavaScript This code strokes the first path three times, the second path two times, and the third path only once. ...
...e() method. In some cases, however, this may be the desired effect. HTML <canvas id="canvas"></canvas> JavaScript This code strokes the first path three times, the second path two times, and the third path only once. ...
...And 2 more matches
Compositing and clipping - Web APIs
a circular clipping path to restrict the drawing of a set of random stars to a particular region. ...
...Next, we create the circular clipping path by drawing an arc ...
...Next, we create the circular clipping path by drawing an arc and calling clip(). Clipping paths are also part of the canva...
...And 2 more matches
CharacterData - Web APIs
The CharacterData abstract interface represents a Node object that contains characters. This is an abstract interface, meaning there aren't any object of type CharacterData: it is implemented by other interfaces, like Text, Comment, or ProcessingInstruction which aren't abstract. ...
...racters. This is an abstract interface, meaning there aren't any object of type CharacterData: it is implemented by other interfaces, like Text, Comment, or ProcessingInstruction which aren't abstract. ...
... inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 70" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monosp...
...And 2 more matches
CompositionEvent - Web APIs
The DOM CompositionEvent represents events that occur due to the user indirectly entering text. ...
... The DOM CompositionEvent represents events that occur due to the user indirectly entering text. ...
...play: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 70" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/Event" target="_top"><rect x="1" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="38.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">Event</text></a><polyline points="76,25 86,20 86,30 76,25" stroke="#D4DDE4" fill="none"/><line x1="86" y1="25" x2="116" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/UIEvent" target="_top"><rect x="116" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="153.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fil...
...And 2 more matches
console - Web APIs
Web › API › Console
n the console object and gives a few Usage examples. Note: This feature is available in Web Workers. Note: The actual console interface is defined as all lower case (i.e. not Console), for historical reasons. Methods console.assert() Log a message and stack trace to console if the first argument is false. console.clear() Clear the console. console.count() Log the number of times this line has been called with the given label. console.countReset() Resets the value of the counter with the given label. console.debug() Outputs a message to the console with the log level debug. console.dir() Displays an interactive listing of the properties of a specified JavaScript object. This listing lets you use disclosure triangles to examine the contents of child objects. console.dirxml() ...
...gles to examine the contents of child objects. console.dirxml() Displays an XML/HTML Element representation of the specified object if possible or the JavaScript Object view if it is not possible. console.error() Outputs an error message. You may use string substitution and additional arguments with this method. console.exception() An alias for error(). console.group() Creates a new inline group, indenting all following output by another level. To move back out a level, call groupEnd(). console.groupCollapsed() Creates a new inline group, indenting all following output by another level. However, unlike group() this starts with the inline group collapsed requiring the use of a disclosure button to expand it. To move back out a level, call groupEnd(). console.groupEnd() Exits the...
... console.info() Informative logging of information. You may use string substitution and additional arguments with this method. console.log() For general output of logging information. You may use string substitution and additional arguments with this method. ...
...And 2 more matches
DocumentFragment - Web APIs
n of Document that stores a segment of a document structure comprised of nodes just like a standard document. The key difference is due to the fact that the document fragment isn't part of the active document tree structure. Changes made to the fragment don't affect the document (even on reflow) or incur any performance impact when changes are made. ...
...that the document fragment isn't part of the active document tree structure. Changes made to the fragment don't affect the document (even on reflow) or incur any performance impact when changes are made. ...
... inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 70" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monosp...
...And 2 more matches
DocumentType - Web APIs
The DocumentType interface represents a Node containing a doctype. ...
... The DocumentType interface represents a Node containing a doctype. ...
... inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 70" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monosp...
...And 2 more matches
ErrorEvent - Web APIs
The ErrorEvent interface represents events providing information related to errors in scripts or in files. ...
... The ErrorEvent interface represents events providing information related to errors in scripts or in files. ...
...lay: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/Event" target="_top"><rect x="1" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="38.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">Event</text></a><polyline points="76,25 86,20 86,30 76,25" stroke="#D4DDE4" fill="none"/><line x1="86" y1="25" x2="116" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/ErrorEvent" target="_top"><rect x="116" y="1" width="100" height="50" fill="#F4F7F8" stroke="#D4DDE4" stroke-width="2px" /><text x="166" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace...
...And 2 more matches
FocusEvent - Web APIs
The FocusEvent interface represents focus-related events, including focus, blur, focusin, and focusout. ...
... The FocusEvent interface represents focus-related events, including focus, blur, focusin, and focusout. ...
...play: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 70" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/Event" target="_top"><rect x="1" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="38.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">Event</text></a><polyline points="76,25 86,20 86,30 76,25" stroke="#D4DDE4" fill="none"/><line x1="86" y1="25" x2="116" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/UIEvent" target="_top"><rect x="116" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="153.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fil...
...And 2 more matches
Using the Frame Timing API - Web APIs
o provide a good user experience. This document describes how to use the PerformanceFrameTiming interfaces including example code. For an overview of these interfaces see Frame Timing API. Frame observers The performance observer interfaces allow an application to register an observer for specific performance event types. When one of those event types is added to the browser's performance timeline, the application is notified of the event via the observer's callback function that was specified when the observer was created. Creating an observer To observe "frame" performance entry types, the application first creates a PerformanceObserver object with a specific frame observer callback. In the following example, two observers for the "frame" performance entry type are created and the firs...
...of the event via the observer's callback function that was specified when the observer was created. Creating an observer To observe "frame" performance entry types, the application first creates a PerformanceObserver object with a specific frame observer callback. In the following example, two observers for the "frame" performance entry type are created and the first observer constructor uses inline function syntax. function create_frame_observer() { if (window.PerformanceObserver === undefined) return; // Register the performance observer var observe_frame = new PerformanceObserver(function(list) { // Log the frame entries var perfEntries = list.getEntriesByType("frame"); for (var i=0; i < perfEntries.length; i++) { console.log("OBS #1: [" + i + "] = " + perfEntrie...
... Registering for notifications After an observer is created, the next step is to use the PerformanceObserver.observe() method to specify the set of performance events to observe. In the following example, the observer only registers for "frame" performance entry notifications. var observe_frame = new PerformanceObserver(function(list) { // Pr...
...And 2 more matches
InputEvent - Web APIs
The InputEvent interface represents an event notifying of editable content change. ...
... The InputEvent interface represents an event notifying of editable content change. ...
...play: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 70" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/Event" target="_top"><rect x="1" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="38.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">Event</text></a><polyline points="76,25 86,20 86,30 76,25" stroke="#D4DDE4" fill="none"/><line x1="86" y1="25" x2="116" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/UIEvent" target="_top"><rect x="116" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="153.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fil...
...And 2 more matches
InstallEvent - Web APIs
r passed into the oninstall handler, the InstallEvent interface represents an install action that is dispatched on the ServiceWorkerGlobalScope of a ServiceWorker. As a child of ExtendableEvent, it ensures that functional events such as FetchEvent are not dispatched during installation. This interface inherits from the ExtendableEvent interface. ...
...a ServiceWorker. As a child of ExtendableEvent, it ensures that functional events such as FetchEvent are not dispatched during installation. This interface inherits from the ExtendableEvent interface. ...
...play: inline-block; position: absolute; top: 0; left: 0;" viewbox="-20 0 700 60" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/Event" target="_top"><rect x="1" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="38.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">Event</text></a><polyline points="76,25 86,20 86,30 76,25" stroke="#D4DDE4" fill="none"/><line x1="86" y1="25" x2="116" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/ExtendableEvent" target="_top"><rect x="116" y="1" width="150" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="191" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospa...
...And 2 more matches
KeyboardEvent - Web APIs
dicate what interaction the user had with a key on the keyboard at a low level, providing no contextual meaning to that interaction. When you need to handle text input, use the input event instead. Keyboard events may not be fired if the user is using an alternate means of entering text, such as a handwriting system on a tablet or graphics tablet. ...
...o handle text input, use the input event instead. Keyboard events may not be fired if the user is using an alternate means of entering text, such as a handwriting system on a tablet or graphics tablet. ...
...play: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 70" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/Event" target="_top"><rect x="1" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="38.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">Event</text></a><polyline points="76,25 86,20 86,30 76,25" stroke="#D4DDE4" fill="none"/><line x1="86" y1="25" x2="116" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/UIEvent" target="_top"><rect x="116" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="153.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fil...
...And 2 more matches
MouseEvent - Web APIs
lick, mouseup, mousedown. MouseEvent derives from UIEvent, which in turn derives from Event. Though the MouseEvent.initMouseEvent() method is kept for backward compatibility, creating of a MouseEvent object should be done using the MouseEvent() constructor. Several more specific events are based on MouseEvent, including WheelEvent and DragEvent. ...
...for backward compatibility, creating of a MouseEvent object should be done using the MouseEvent() constructor. Several more specific events are based on MouseEvent, including WheelEvent and DragEvent. ...
...play: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 70" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/Event" target="_top"><rect x="1" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="38.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">Event</text></a><polyline points="76,25 86,20 86,30 76,25" stroke="#D4DDE4" fill="none"/><line x1="86" y1="25" x2="116" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/UIEvent" target="_top"><rect x="116" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="153.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fil...
...And 2 more matches
Node - Web APIs
Web › API › Node
on, Entity, and EntityReference. In some cases, a particular feature of the base Node interface may not apply to one of its child interfaces; in that case, the inheriting node may return null or throw an exception, depending on circumstances. For example, attempting to add children to a node type that cannot have children will throw an exception. ...
...at case, the inheriting node may return null or throw an exception, depending on circumstances. For example, attempting to add children to a node type that cannot have children will throw an exception. ...
... inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 70" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/Node" target="_top"><rect x="151" y="1" width="75" height="50" fill="#F4F7F8" stroke="#D4DDE4" stroke-width="2px" /><text x="188.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,mon...
...And 2 more matches
PerformanceMark - Web APIs
PerformanceMark is an abstract interface for PerformanceEntry objects with an entryType of "mark". Entries of this type are created by calling performance.mark() to add a named DOMHighResTimeStamp (the mark) to the browser's performance timeline. ...
... PerformanceMark is an abstract interface for PerformanceEntry objects with an entryType of "mark". Entries of this type are created by calling performance.mark() to add a named DOMHighResTimeStamp (the mark) to the browser's performance timeline. ...
...PerformanceEntry objects with an entryType of "mark". Entries of this type are created by calling performance.mark() to add a named DOMHighResTimeStamp (the mark) to the browser's performance timeline. ...
...And 2 more matches
PerformanceMeasure - Web APIs
PerformanceMeasure is an abstract interface for PerformanceEntry objects with an entryType of "measure". Entries of this type are created by calling performance.measure() to add a named DOMHighResTimeStamp (the measure) between two marks to the browser's performance timeline. ...
... PerformanceMeasure is an abstract interface for PerformanceEntry objects with an entryType of "measure". Entries of this type are created by calling performance.measure() to add a named DOMHighResTimeStamp (the measure) between two marks to the browser's performance timeline. ...
...th an entryType of "measure". Entries of this type are created by calling performance.measure() to add a named DOMHighResTimeStamp (the measure) between two marks to the browser's performance timeline. ...
...And 2 more matches
PerformanceResourceTiming - Web APIs
The PerformanceResourceTiming interface enables retrieval and analysis of detailed network timing data regarding the loading of an application's resources. An application can use the timing metrics to determine, for example, the length of time it takes to fetch a specific resource, such as an XMLHttpRequest, <SVG>, image, or script. The interface's properties create a resource loading timeline with high-resolution timestamps for network events such as redirect start and end times, fetch start, DNS lookup start and end times, response start and end times, etc.. Additionally, the interface extends PerformanceEntry with other properties which provide data about the size of the fetched resource as well as the type of resource that initiated the fetch. <div id="interfaceDiagram" style="displ...
...esolution timestamps for network events such as redirect start and end times, fetch start, DNS lookup start and end times, response start and end times, etc.. Additionally, the interface extends PerformanceEntry with other properties which provide data about the size of the fetched resource as well as the type of resource that initiated the fetch. ...
...mes, etc.. Additionally, the interface extends PerformanceEntry with other properties which provide data about the size of the fetched resource as well as the type of resource that initiated the fetch. ...
...And 2 more matches
RTCDataChannel: error event - Web APIs
, "Cookie received while shutting down", "Restart of an association with new addresses", "User-initiated abort", "Protocol violation" ]; dc.addEventListener("error", ev => { const err = ev.error; console.error("WebRTC error: ", err.message); // Handle specific error detail types switch(err.errorDetail) { case "sdp-syntax-error": console.error(" SDP syntax error in line ", err.sdpLineNumber); break; case "idp-load-failure": console.error(" Identity provider load failure: HTTP error ", err.httpRequestStatusCode); break; case "sctp-failure": if (err.sctpCauseCode < sctpCauseCodes.length) { console.error(" SCTP failure: ", err.sctpCauseCode); } else { console.error(" Unknown SCTP err...
...The error's name is RTCError and the message is an error string specified by the WebRTC layer. Error information is...
...The error's name is RTCError and the message is an error string specified by the WebRTC layer. Error information is output to the console using console.error(). The message string is always ...
...And 2 more matches
ServiceWorkerGlobalScope - Web APIs
tionally, synchronous requests are not allowed from within a service worker -- only asynchronous requests, like those initiated via the fetch() method, can be used. This interface inherits from the WorkerGlobalScope interface, and its parent EventTarget, and therefore implements properties from WindowTimers, WindowBase64, and WindowEventHandlers. ...
...od, can be used. This interface inherits from the WorkerGlobalScope interface, and its parent EventTarget, and therefore implements properties from WindowTimers, WindowBase64, and WindowEventHandlers. ...
... inline-block; position: absolute; top: 0; left: 0;" viewbox="-20 0 700 85" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/WorkerGlobalScope" target="_top"><rect x="151" y="1" width="170" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="236" y="30" font-size="12px" font-family="Consolas,Monaco,Andale...
...And 2 more matches
SyncEvent - Web APIs
Web › API › SyncEvent
The SyncEvent interface represents a sync action that is dispatched on the ServiceWorkerGlobalScope of a ServiceWorker. This interface inherits from the ExtendableEvent interface. ...
... The SyncEvent interface represents a sync action that is dispatched on the ServiceWorkerGlobalScope of a ServiceWorker. This interface inherits from the ExtendableEvent interface. ...
...play: inline-block; position: absolute; top: 0; left: 0;" viewbox="-20 0 700 60" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/Event" target="_top"><rect x="1" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="38.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">Event</text></a><polyline points="76,25 86,20 86,30 76,25" stroke="#D4DDE4" fill="none"/><line x1="86" y1="25" x2="116" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/ExtendableEvent" target="_top"><rect x="116" y="1" width="150" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="191" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospa...
...And 2 more matches
TouchEvent - Web APIs
describe one or more points of contact with the screen and includes support for detecting movement, addition and removal of contact points, and so forth. Touches are represented by the Touch object; each touch is described by a position, size and shape, amount of pressure, and target element. Lists of touches are represented by TouchList objects. ...
...orth. Touches are represented by the Touch object; each touch is described by a position, size and shape, amount of pressure, and target element. Lists of touches are represented by TouchList objects. ...
...play: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 70" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/Event" target="_top"><rect x="1" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="38.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">Event</text></a><polyline points="76,25 86,20 86,30 76,25" stroke="#D4DDE4" fill="none"/><line x1="86" y1="25" x2="116" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/UIEvent" target="_top"><rect x="116" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="153.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fil...
...And 2 more matches
Using the User Timing API - Web APIs
The User Timing interface allows the developer to create application specific timestamps that are part of the browser's performance timeline. There are two types of user defined timing entry types: the "mark" entry type and the "measure" entry type. mark events are named by the application and can be set at any location in an application. measure events are also named by the application but they are placed between two marks thus they are effectively a midpoint between two marks. 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. A live version of the examples is available on Github, as is the source code. Pull...
... Creating a performance mark The performance.mark() method is used to create a performance mark. The method takes one argument, the name of the mark, as shown in the following example. ...
...rk')", 0); log("... " + entries[i].name, 0); } entries = performance.getEntriesByName("mark-2","mark"); for (var i=0; i < entries.length; i++) { if (i == 0) log("= getEntriesByName('mark-2', 'mark')", 0); log("... " + entries[i].name, 0); } } Removing performance marks The performance.clearMarks() method is used to remove one or more marks from the browser's performance timeline. If a specific mark name is given to this method, only the mark(s) with that name will be removed. However, if no argument is given, then all performance entries of type "mark" will be removed from the performance timeline. The following example demostrates both uses of this method. function clear_marks(obj) { if (performance.clearMarks === undefined) { log("Clear Marks: performance.clearM...
...And 2 more matches
Basic scissoring - Web APIs
de the specified rectangular area to be updated. This is a good opportunity to talk about the difference between pixels and fragments. A pixel is a picture element (in practice, a point) on the screen, or a single element of the drawing buffer, that area in memory that holds your pixel data (such as RGBA color components). A fragment refers to the pixel while it is being handled by the WebGL pipeline. The reason for this distinction is that fragment color (and other fragment values, such as depth) may be manipulated and changed several times during graphics operations before finally being written to the screen. We have already seen how fragment color changes during graphics operations, by applying color masking. In other cases, the fragments may be discarded altogether (so the pixel value is...
...ons, by applying color masking. In other cases, the fragments may be discarded altogether (so the pixel value is not updated), or it may interact with the already existing pixel value (such as when doing color blending for non-opaque elements in the scene). Here we see another example of the distinction between fragments and pixels. Scissoring is a distinct stage in the WebGL/OpenGL graphics pipeline (it occurs after color clearing, but before color masking). Before the actual pixels are updated, fragments must go through the scissor test. If the fragments pass the scissor test, they continue down the graphics pipeline, and the corresponding pixels are updated on the screen. If they fail the test, they are immediately discarded, no further processing occurs, and pixels are not updated. Becaus...
...We enable it here using the enable() method (you will also use enable() to activate many other features of WebGL; hence, the use of the SCISSOR_TEST constant as an argument in this case). This again demonstrates the typical order of commands in WebGL. We first tweak WebGL state. In this case, enabling the scissor test and establishing a rectangular mask. ...
...And 2 more matches
Introduction to WebRTC protocols - Web APIs
data is transferring. This is, in essence, the metadata describing the content and not the media content itself. Technically, then, SDP is not truly a protocol, but a data format used to describe connection that shares media between devices. Documenting SDP is well outside the scope of this documentation; however, there are a few things worth noting here. ...
...onnection that shares media between devices. Documenting SDP is well outside the scope of this documentation; however, there are a few things worth noting here. Structure SDP consists of one or more lines of UTF-8 text, each beginning with a one-character type, followed by an equals sign ("="), followed by structured text comprising a value or description, whose format depends on the type. The lines of text that begin with a given letter are generally referred to as "letter-lines". ...
...tation; however, there are a few things worth noting here. Structure SDP consists of one or more lines of UTF-8 text, each beginning with a one-character type, followed by an equals sign ("="), followed by structured text comprising a value or description, whose format depends on the type. The lines of text that begin with a given letter are generally referred to as "letter-lines". ...
...And 2 more matches
Movement, orientation, and motion: A WebXR example - Web APIs
sting the values of constants before you load it in the browser. The code looks like this: const xRotationDegreesPerSecond = 25; const yRotationDegreesPerSecond = 15; const zRotationDegreesPerSecond = 35; const enableRotation = true; const allowMouseRotation = true; const allowKeyboardMotion = true; const enableForcePolyfill = false; //const SESSION_TYPE = "immersive-vr"; const SESSION_TYPE = "inline"; const MOUSE_SPEED = 0.003; xRotationDegreesPerSecond The number of degrees of rotation to apply around the X axis per second. yRotationDegreesPerSecond The number of degrees to rotate around the Y axis each second. zRotationDegreesPerSecond The number of degrees per second to rotate around the Z axis. enableRotation A Boolean indicating whether or not to enable the rotation of the cu...
...ght, while the up and down arrow keys move up and down. If false, only XR device changes to the view are permitted. enableForcePolyfill If this Boolean is true, the example will attempt to use the WebXR polyfill even if the browser actually has support for WebXR. If false, the polyfill is only used if the browser doesn't implement navigator.xr. SESSION_TYPE The type of XR session to create: inline for an inline session presented in the context of the document and immersive-vr to present the scene to an immersive VR headset. MOUSE_SPEED A multiplier used to scale the inputs from the mouse used for pitch and yaw control. MOVE_DISTANCE The distance to move in response to any of the keys used to move the viewer through the scene. Note: This example always displays what it renders on the...
...texture file. Now that the rendering structures and data are loaded, we start preparing to run the XRSession. We connect the session to the WebGL layer so it konws what to use as a rendering surface by calling XRSession.updateRenderState() with a baseLayer set to a new XRWebGLLayer. We then look at the value of the SESSION_TYPE constant to see whether the WebXR context should be immersive or inline. Immersive sessions use the local reference space, while inline sessions use the viewer reference space. The glMatrix library's fromTranslation() function for 4x4 matrices is used to convert the viewer's start position as given in the viewerStartPosition constant into a transform matrix. The viewer's starting orientation, viewerStartOrientation, is copied into the cubeOrientation property, which...
...And 2 more matches
Web Animations API - Web APIs
oes so by combining two models: the Timing Model and the Animation Model. Concepts and usage The Web Animations API provides a common language for browsers and developers to describe animations on DOM elements. To get more information on the concepts behind the API and how to use it, read Using the Web Animations API. ...
...d Using the Web Animations API. Web Animations interfaces Animation Provides playback controls and a timeline for an animation node or source. Can take an object created with the KeyframeEffect() constructor. KeyframeEffect Describes sets of animatable properties and values, called keyframes and their timing options. These can then be played using the Animation() constructor. AnimationTimeline Represents the timeline of animation. This interface exists to define timeline features (inherited by DocumentTimeline and future timeline objects) and is not itself accessed by developers. AnimationEvent Actually part of CSS Animations. DocumentTimeline Represents animation timelines, including the default document timeline (accessed using the Document.timeline property). EffectTiming Ele...
... document.getAnimations() Returns an Array of Animation objects currently in effect on elements in the document. Extensions to the Element interface Element.animate() A shortcut method for creating and playing an animation on an element. It returns the created Animation object instance. ...
...And 2 more matches
Using the Web Speech API - Web APIs
the speech recognition -- most modern OSes have a speech recognition system for issuing voice commands. Think about Dictation on macOS, Siri on iOS, Cortana on Windows 10, Android Speech, etc. Note: On some browsers, like Chrome, using Speech Recognition on a web page involves a server-based recognition engine. Your audio is sent to a web service for recognition processing, so it won't work offline. Demo To show simple usage of Web speech recognition, we've written a demo called Speech color changer. When the screen is tapped/clicked, you can say an HTML color keyword, and the app's background color will change to that color. To run the demo, you can clone (or directly download) the Github repo it is part of, open the HTML index file in a supporting desktop browser, or navigate to the...
...r of the app.</p> <div> <p class="output"><em>...diagnostic messages</em></p> </div> The CSS provides a very simple responsive styling so that it looks ok across devices. JavaScript Let's look at the JavaScript in a bit more detail. ...
...d our grammar: var colors = [ 'aqua' , 'azure' , 'beige', 'bisque', 'black', 'blue', 'brown', 'chocolate', 'coral' ... ]; var grammar = '#JSGF V1.0; grammar colors; public <color> = ' + colors.join(' | ') + ' ;' The grammar format used is JSpeech Grammar Format (JSGF) -- you can find a lot more about it at the previous link to its spec. However, for now let's just run through it quickly: The lines are separated by semi-colons, just like in JavaScript. The first line -- #JSGF V1.0; -- states the format and version used. This always needs to be included first. The second line indicates a type of term that we want to recognise. public declares that it is a public rule, the string in angle brackets defines the recognised name for this term (color), and the list of items that follow the equa...
...And 2 more matches
ARIA annotations - Accessibility
The semantics for this have long been available in HTML, via the <ins> and <del> elements: <p>Freida's pet is a <del>black Cat called Luna</del><ins>purple Tyrannosaurus Rex called Tiny</in...
...'s pet is a <span role="suggestion" aria-details="comment-source"><span role="deletion">black Cat called Luna</span><span role="insertion">purple Tyrannosaurus Rex called Tiny</span></span>. ...
...ny</span></span>. ...
...And 2 more matches
Accessibility and Spacial Patterns - Accessibility
ns are typical of the kinds of images that create problems, and stripes have been studied most closely. There's the potential for causing harm if there are more than five light-dark pairs of stripes in any orientation. They can be parallel, radial, curved or straight, and may be formed by rows of repeating elements. ...
...sely. There's the potential for causing harm if there are more than five light-dark pairs of stripes in any orientation. They can be parallel, radial, curved or straight, and may be formed by rows of repeating elements. In 2005, Arnold Wilkins, John Emmett, and Graham Harding evaluated the guidelines for characterizing patterned images that could precipitate seizures. They revised the guidelines to their fundamental core, and came up with a surprisingly simple, but powerful test. ...
...ing elements. In 2005, Arnold Wilkins, John Emmett, and Graham Harding evaluated the guidelines for characterizing patterned images that could precipitate seizures. They revised the guidelines to their fundamental core, and came up with a surprisingly simple, but powerful test. which they published in the paper, Characterizing the Patterned Images That Precipitate Seizures and Optimizing Guidelines To Prevent Them The steps necessary to evaluate material reduce to the following: Look at the screen Are there more than five stripes? If so, do they last longer than 0.5 s? If so, does the brightness exceed the stated limit? If so, categorize the motion of the pattern Are the guidelines contravened? If so, reduce brightness. Text and padding WCAG standards for contrast perception do...
...And 2 more matches
Web Accessibility: Understanding Colors and Luminance - Accessibility
Overview Colors, and how they are used, are a major component of accessibility. At the surface, the subject seems simple, but it is actually a complex subject because color is as much about the physiology of the eye and human perception as it is about light emitting from a computer screen. Environment matters. ...
...dule 3, there are algorigthms available to translate the HSL to RGB. Newer technologies, such as OpenGL and Direct3D incorporate support for the sRGB gamma curve, although some articles for OpenGL reference use of RGBA rather than sRGB. WebGL is usually in the RGBA format; see an example of how it is used in "Clearing with colors". Where accessibility is concerned, however, standards and guidelines are currently written predominantly using the sRGB color space, especially as it applies to color contrast ratios. In speaking specifically to relative luminance, WCAG's definition of relative luminance notes: "Note 2: Almost all systems used today to view Web content assume sRGB encoding. Unless it is known that another color space will be used to process and display the content, authors shou...
...f00; } /* #rgb */ em { color: #ff0000; } /* #rrggbb */ em { color: #ff0000ff; } /* #rrggbbaa */ em { color: rgb(255, 0, 0); } em { color: rgb(100%, 0%, 0%); } em { color: rgb(255, 0, 0, 1); } em { color: rgba(100%, 0%, 0%, 100%); } Conversions are not casual. See the Stack Exchange article, "Formula to Determine the Brightness of RGB Color". There are many online tools that can convert RGB to HSL for you, with both the RGB hexidecimal and CSS function syntax. A great example of a tool that converts colors for you is Tom Jewett's "mini color selector" with HSL, RGB, Hex options for checking contrast in the browser. Luminance and Contrast Contrast Contrast between colors ("hues") is a critical component, but the use of color ("hues") alone is not en...
...And 2 more matches
::first-letter (:first-letter) - CSS: Cascading Style Sheets
/* Selects the first letter of a <p> */ p::first-letter { font-size: 130%; } The first letter of an element is not always trivial to identify: Punctuation that precedes or immediately follows the first letter is included in the match. Punctuation includes any Unicode character defined in the open (Ps), close (Pe), initial quote (Pi), final quote (Pf), and other punctuation (Po) classes. Some languages have digraphs that are always capitalized together, like the IJ in Dutch. ...
...t of CSS properties can be used with the ::first-letter pseudo-element: All font properties : font, font-style, font-feature-settings, font-kerning, font-language-override, font-stretch, font-synthesis, font-variant, font-variant-alternates, font-variant-caps, font-variant-east-asian, font-variant-ligatures, font-variant-numeric, font-variant-position, font-weight, font-size, font-size-adjust, line-height and font-family All background properties : background, background-color, background-image, background-clip, background-origin, background-position, background-repeat, background-size, background-attachment, and background-blend-mode All margin properties: margin, margin-top, margin-right, margin-bottom, margin-left All padding properties: padding, padding-top, padding-right, padding-bo...
... margin-right, margin-bottom, margin-left All padding properties: padding, padding-top, padding-right, padding-bottom, padding-left All border properties: the shorthands border, border-style, border-color, border-width, border-radius, border-image, and the longhands properties The color property The text-decoration, text-shadow, text-transform, letter-spacing, word-spacing (when appropriate), line-height, text-decoration-color, text-decoration-line, text-decoration-style, box-shadow, float, vertical-align (only if float is none) CSS properties Syntax /* CSS3 syntax */ ::first-letter /* CSS2 syntax */ :first-letter Examples Simple drop cap In this example we will use the ::first-letter pseudo-element to create a simple drop cap effect on the first letter of the paragraph coming right...
...And 2 more matches
:nth-last-child() - CSS: Cascading Style Sheets
the same as a simple p selector. (Since n starts at zero, while the last element begins at one, n and n+1 will both select the same elements.) p:nth-last-child(1) or p:nth-last-child(0n+1) Represents every <p> that is the first element among a group of siblings, counting from the end. This is the same as the :last-child selector. ...
...ts at zero, while the last element begins at one, n and n+1 will both select the same elements.) p:nth-last-child(1) or p:nth-last-child(0n+1) Represents every <p> that is the first element among a group of siblings, counting from the end. This is the same as the :last-child selector. ...
...one, n and n+1 will both select the same elements.) p:nth-last-child(1) or p:nth-last-child(0n+1) Represents every <p> that is the first element among a group of siblings, counting from the end. This is the same as the :last-child selector. ...
...And 2 more matches
Border-radius generator - CSS: Cascading Style Sheets
== */ .col { display: block; float:left; margin: 1% 0 1% 1.6%; } .col:first-child { margin-left: 0; } /* all browsers except IE6 and lower */ /* * UI Component */ .ui-input-slider-container { height: 20px; margin: 10px 0; font-family: "Segoe UI", Arial, Helvetica, sans-serif; -moz-user-select: none; user-select: none; } .ui-input-slider-container * { float: left; height: 100%; line-height: 100%; } /* Input Slider */ .ui-input-slider > input { margin: 0; padding: 0; width: 50px; text-align: center; -moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box; } .ui-input-slider-info { width: 90px; padding: 0px 10px 0px 0px; text-align: right; text-transform: lowercase; } .ui-input-slider-left, .ui-input-slider-right { width: 16px; cur...
...9/arrows.png") center left no-repeat; } .ui-input-slider-right { background: url("https://mdn.mozillademos.org/files/5679/arrows.png") center right no-repeat; } .ui-input-slider-name { width: 90px; padding: 0 10px 0 0; text-align: right; text-transform: lowercase; } .ui-input-slider-btn-set { width: 25px; background-color: #2C9FC9; border-radius: 5px; color: #FFF; font-weight: bold; line-height: 14px; text-align: center; } .ui-input-slider-btn-set:hover { background-color: #379B4A; cursor: pointer; } /* * UI Component */ /* Checkbox */ .ui-checkbox { text-align: center; font-size: 16px; font-family: "Segoe UI", Arial, Helvetica, sans-serif; line-height: 1.5em; color: #FFF; -moz-user-select: none; -webkit-user-select: none; -ms-user-select: none; user-select: no...
... */ /* Checkbox */ .ui-checkbox { text-align: center; font-size: 16px; font-family: "Segoe UI", Arial, Helvetica, sans-serif; line-height: 1.5em; color: #FFF; -moz-user-select: none; -webkit-user-select: none; -ms-user-select: none; user-select: none; } .ui-checkbox > input { display: none; } .ui-checkbox > label { font-size: 12px; padding: 0.333em 1.666em 0.5em; height: 1em; line-height: 1em; background-color: #888; background-image: url("https://mdn.mozillademos.org/files/5683/disabled.png"); background-position: center center; background-repeat: no-repeat; color: #FFF; border-radius: 3px; font-weight: bold; float: left; } .ui-checkbox .text { padding-left: 34px; background-position: center left 10px; } .ui-checkbox .left { padding-right: 34px; padding-le...
...And 2 more matches
Box alignment in grid layout - CSS: Cascading Style Sheets
xt of CSS Grid Layout. As this page aims to detail things which are specific to CSS Grid Layout and Box Alignment, it should be read in conjunction with the main Box Alignment page which details the common features of box alignment across layout methods. Basic Example In this example using grid layout, there is extra space in the grid container after laying out the fixed width tracks on the inline (main) axis. This space is distributed using justify-content. On the block (cross) axis the alignment of the items inside their grid areas is controlled with align-items. The first item overrides the align-items value set on the group by setting align-self to center. Grid axes As a two-dimensional layout method, when working with grid layout we always have two axes on which to align our items...
... the alignment of the items inside their grid areas is controlled with align-items. The first item overrides the align-items value set on the group by setting align-self to center. Grid axes As a two-dimensional layout method, when working with grid layout we always have two axes on which to align our items. We have access to all of the box alignment properties to help us achieve this. ...
...rid axes As a two-dimensional layout method, when working with grid layout we always have two axes on which to align our items. We have access to all of the box alignment properties to help us achieve this. The inline axis is the axis that corresponds to the direction that words in a sentence would run in the writing mode used. Therefore, in a horizontal language such as English or Arabic the inline direction runs horizontally. Should you be in a vertical writing mode the inline axis will run vertically. ...
...And 2 more matches
Relationship of flexbox to other layout methods - CSS: Cascading Style Sheets
flexbox article, I explained that flexbox is writing mode aware. Writing modes are fully detailed in the CSS Writing Modes specification, which details how CSS supports the various different writing modes that exist internationally. We need to be aware of how this will impact our flex layouts as writing mode changes the direction that blocks are laid out in our document. Understanding block and inline directions is key to new layout methods. It is worth noting that we might want to change the writing mode of our document for reasons other than publishing content in a language that uses a different writing mode. See this article for a full description of writing modes and ways to use them, both for content in other languages and for creative reasons. The writing modes The writing modes spec...
... Floats will not intrude, and the containers' margins will not collapse. With regard to flex items, if an item was floated or cleared and then becomes a flex item due to the parent having display: flex applied, the floating and clearing will no longer happen, and the item will not be taken out of normal flow in the way that floats are. If you have used the vertical-align property, as used with inline-block or table layout for alignment, this will no longer affect the item and you can use the alignment properties of flexbox instead. In this next live example the child elements have been floated, and then their container has had display: flex added. If you remove display: flex, you should see that the .box element collapses as we have no clearing applied. This demonstrates that the float is ha...
...tions that sometimes appear to be doing the same thing? The most straightforward answer to this question is defined in the specifications themselves. Flexbox is a one-dimensional layout method whereas Grid Layout is a two-dimensional layout method. The example below has a flex layout. As already described in the Basic concepts article, flex items can be allowed to wrap but, once they do so, each line becomes a flex container of its own. When space is distributed flexbox does not look at the placement of items in other rows and tries to line things up with each other. If we create a very similar layout using Grid, we can control the layout in both rows and columns. These examples point to another key difference between these layout methods. In Grid Layout you do the majority of sizing sp...
...And 2 more matches
Auto-placement in CSS Grid Layout - CSS: Cascading Style Sheets
means that if you have used the order property at all, the items will be placed by that order, not their DOM order. Otherwise they will stay by default in the order that they are entered in the document source. Items with placement properties The first thing grid will do is place any items that have a position. In the example below I have 12 grid items. Item 2 and item 5 have been placed using line based placement on the grid. You can see how those items are placed and the other items then auto-place in the spaces. The auto-placed items will place themselves before the placed items in DOM order, they don't start after the position of a placed item that comes before them. * {box-sizing: border-box;} .wrapper { border: 2px solid #f76707; border-radius: 5px; background-color: #...
.../ 3; grid-row: 1 / 3; } Deal with items that span tracks You can use placement properties while still taking advantage of auto-placement. In this next example I have added to the layout by setting odd items to span two tracks both for rows and columns. I do this with the grid-column-end and grid-row-end properties and setting the value of this to span 2. What this means is that the start line of the item will be set by auto-placement, and the end line will span two tracks. You can see how this then leaves gaps in the grid, as for the auto-placed items if grid comes across an item that doesn't fit into a track, it will move to the next row until it finds a space the item can fit in. * {box-sizing: border-box;} .wrapper { border: 2px solid #f76707; border-radius: 5px; ba...
...It wo...
...And 2 more matches
WebKit CSS extensions - CSS: Cascading Style Sheets
er-end** -webkit-border-end-color** -webkit-border-end-style** -webkit-border-end-width** -webkit-border-fit -webkit-border-horizontal-spacing -webkit-border-start** -webkit-border-start-color** -webkit-border-start-style** -webkit-border-start-width** -webkit-border-vertical-spacing -webkit-box-align** -webkit-box-direction** -webkit-box-flex-group** -webkit-box-flex** -webkit-box-lines** -webkit-box-ordinal-group** -webkit-box-orient** -webkit-box-pack** -webkit-box-reflect** C -webkit-column-axis -webkit-column-break-after -webkit-column-break-before -webkit-column-break-inside -webkit-column-progression -webkit-cursor-visibility D-I -webkit-dashboard-region -webkit-font-size-delta -webkit-font-smoothing -webkit-highlight -webkit-hyphenate-character -w...
...ox-reflect** C -webkit-column-axis -webkit-column-break-after -webkit-column-break-before -webkit-column-break-inside -webkit-column-progression -webkit-cursor-visibility D-I -webkit-dashboard-region -webkit-font-size-delta -webkit-font-smoothing -webkit-highlight -webkit-hyphenate-character -webkit-hyphenate-limit-after -webkit-hyphenate-limit-before -webkit-hyphenate-limit-lines -webkit-initial-letter L -webkit-line-align -webkit-line-box-contain -webkit-line-clamp -webkit-line-grid -webkit-line-snap -webkit-locale -webkit-logical-height -webkit-logical-width M -webkit-margin-after-collapse -webkit-margin-after -webkit-margin-before-collapse -webkit-margin-before -webkit-margin-bottom-collapse -webkit-margin-collapse -webkit-margin-end** -webkit...
...umn -webkit-grid-column-end -webkit-grid-column-gap -webkit-grid-column-start -webkit-grid-gap -webkit-grid-row -webkit-grid-row-end -webkit-grid-row-gap -webkit-grid-row-start -webkit-grid-template -webkit-grid-template-areas -webkit-grid-template-columns -webkit-grid-template-rows H-L -webkit-hyphens -webkit-justify-content -webkit-justify-items -webkit-justify-self -webkit-line-break M -webkit-mask -webkit-mask-clip -webkit-mask-composite -webkit-mask-image -webkit-mask-origin -webkit-mask-position -webkit-mask-repeat -webkit-mask-size O-R -webkit-opacity -webkit-order -webkit-perspective -webkit-perspective-origin -webkit-ruby-position S -webkit-scroll-snap-type -webkit-shape-image-threshold -webkit-shape-margin -webkit-shape-outside T ...
...And 2 more matches
<display-inside> - CSS: Cascading Style Sheets
t that lays out its contents (assuming it is a non-replaced element). These keywords are used as values of the display property, and can be used for legacy purposes as a single keyword, or as defined in the Level 3 specification alongside a value from the <display-outside> keywords. ...
... non-replaced element). These keywords are used as values of the display property, and can be used for legacy purposes as a single keyword, or as defined in the Level 3 specification alongside a value from the <display-outside> keywords. Syntax Valid <display-inside> values: flow The element lays out its contents using flow layout (block-and-inline layout). ...
...s of the display property, and can be used for legacy purposes as a single keyword, or as defined in the Level 3 specification alongside a value from the <display-outside> keywords. Syntax Valid <display-inside> values: flow The element lays out its contents using flow layout (block-and-inline layout). If its outer display type is inline or run-in, and it is participating in a block or inline formatting context, then it generates an inline box. Otherwise it generates a block container box. ...
...And 2 more matches
offset-path - CSS: Cascading Style Sheets
url() References the ID of an SVG shape --...
...from the position of the box and proceeds in the direction defined by the specified angle similar to the CSS gradient angle where 0deg is up, with positive angles increasing in the clockwise direction, with the size value being similar to the CSS radial gradient size values from closest-side to farthest-corner, and the keyterm contain. url() References the ID of an SVG shape -- circle, ellipse, line, path, polygon, polyline, or rect -- using the shape's geometry as the path. <basic-shape> Specifies a CSS shape including circle(), ellipse(), inset(), polygon(), or path(). path() A path string defined with SVG coordinate syntax. none Specifies no motion path at all. Description This property defines a path an animated element can follow. An offset path is either a specified...
...m | <length-percentage> ]? | [ [ left | right ] <length-percentage> ] && [ [ top | bottom ] <length-percentage> ] ]<box> = border-box | padding-box | content-box Examples Animating an element with offset-path The offset-path properties in the CSS code sample defines a motion path that is identical to the <path> element in the SVG. The path, as can be seen in the rendering of the SVG code, is a line drawing of a house with a chimney. SVG The top and bottom halves of the scissors would appear in the top left of the canvas were they not positioned along the starting point of the motion path defined by offset-path. <svg xmlns="http://www.w3.org/2000/svg" width="700" height="450" viewBox="350 0 1400 900"> <title>House and Scissors</title> <rect x="595" y="423" ...
...And 2 more matches
scroll-snap-type - CSS: Cascading Style Sheets
interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Specifying any precise animations or physics used to enforce those snap points is not covered by this property but instead left up to the user agent. /* Keyword values */ scroll-snap-type: none; scroll-snap-type: x; scroll-snap-type: y; scroll-snap-type: block; scroll-snap-type: inline; scroll-snap-type: both; /* Optional mandatory | proximity*/ scroll-snap-type: x mandatory; scroll-snap-type: y proximity; scroll-snap-type: both mandatory; /* etc */ /* Global values */ scroll-snap-type: inherit; scroll-snap-type: initial; scroll-snap-type: unset; Syntax Values none When the visual viewport of this scroll container is scrolled, it must ignore snap points. x The scrol...
...oll-snap-type: initial; scroll-snap-type: unset; Syntax Values none When the visual viewport of this scroll container is scrolled, it must ignore snap points. x The scroll container snaps to snap positions in its horizontal axis only. y The scroll container snaps to snap positions in its vertical axis only. block The scroll container snaps to snap positions in its block axis only. inline The scroll container snaps to snap positions in its inline axis only. both The scroll container snaps to snap positions in both of its axes independently (potentially snapping to different elements in each axis). mandatory The visual viewport of this scroll container will rest on a snap point if it isn't currently scrolled. That means it snaps on that point when the scroll action finished, i...
...may come to rest on a snap point if it isn't currently scrolled considering the user agent's scroll parameters. If content is added, moved, deleted or resized the scroll offset may be adjusted to maintain the resting on that snap point. Formal definition Initial valuenoneApplies toall elementsInheritednoComputed valueas specifiedAnimation typediscrete Formal syntax none | [ x | y | block | inline | both ] [ mandatory | proximity ]? Examples Snapping in different axes HTML <div class="holster"> <div class="container x mandatory-scroll-snapping" dir="ltr"> <div>X Mand. LTR</div> <div>2</div> <div>3</div> <div>4</div> <div>5</div> </div> <div class="container x proximity-scroll-snapping" dir="ltr"> <div>X Prox. LTR</div> <div>2</div> <div>3</div> <div>4</div> <div>5<...
...And 2 more matches
text-decoration-skip-ink - CSS: Cascading Style Sheets
The text-decoration-skip-ink CSS property specifies how overlines and underlines are drawn when they pass over glyph ascenders and descenders. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. text-decoration-skip-ink is not part of the text-decoration shorthand. ...
...//github.com/mdn/interactive-examples and send us a pull request. text-decoration-skip-ink is not part of the text-decoration shorthand. ...
...dn/interactive-examples and send us a pull request. text-decoration-skip-ink is not part of the text-decoration shorthand. ...
...And 2 more matches
text-decoration-skip - CSS: Cascading Style Sheets
Note: Most other browsers are converging on supporting the simpler text-decoration-skip-ink property. ...
... Note: Most other browsers are converging on supporting the simpler text-decoration-skip-ink property. ...
... /* Multiple keywords */ text-decoration-skip: objects spaces; text-decoration-skip: leading-spaces trailing-spaces; text-decoration-skip: objects edges box-decoration; /* Global values */ text-decoration-skip: inherit; text-decoration-skip: initial; text-decoration-skip: unset; Syntax Values none Nothing is skipped. Thus, text decoration is drawn for all text content and across atomic inline-level boxes. objects The entire margin box of the element is skipped if it is an atomic inline such as an image or inline-block. spaces All spacing is skipped: all Unicode white space characters and all word separators, plus any adjacent letter-spacing or word-spacing. leading-spaces The same as spaces, except that only leading spaces are skipped. trailing-spaces The same as spaces, excep...
...And 2 more matches
Event reference
iled to load. abort The loading of a resource has been aborted. load A resource and its dependent resources have finished loading. beforeunload The window, the document and its resources are about to be unloaded. unload The document or a dependent resource is being unloaded. Network events Event Name Fired When online The browser has gained access to the network. offline The browser has lost access to the network. Focus events Event Name Fired When focus An element has received focus (does not bubble). blur An element has lost focus (does not bubble). focusin An element is about to receive focus (does bubble). focusout A...
...rocessorNode is ready to be processed. canplay The browser can play the media, but estimates that not enough data has been loaded to play the media up to its end without having to stop for further buffering of content. canplaythrough The browser estimates it can play the media up to its end without stopping for content buffering. complete The rendering of an OfflineAudioContext is terminated. durationchange The duration attribute has been updated. emptied The media has become empty; for example, this event is sent if the media has already been loaded (or partially loaded), and the load() method is called to reload it. ended Playback has stopped because the end of the media was reached. loadeddata The first fram...
...ing. chargingtimechange Event Battery status The chargingTime attribute has been updated. click MouseEvent DOM L3 A pointing device button has been pressed and released on an element. close Event WebSocket A WebSocket connection has been closed. complete IndexedDB A transaction successfully completed. complete OfflineAudioCompletionEvent Web Audio APIThe definition of 'OfflineAudioCompletionEvent' in that specification. The rendering of an OfflineAudioContext is terminated. compositionend CompositionEvent DOM L3 The composition of a passage of text has been completed or canceled. compositionstart CompositionEvent DOM L3 The composition of a passage of text is prepare...
...And 2 more matches
Block formatting context - Developer guides
part of a visual CSS rendering of a web page. It's the region in which the layout of block boxes occurs and in which floats interact with other elements. A block formatting context is created by at least one of the following: The root element of the document (<html>). Floats (elements where float isn't none). Absolutely positioned elements (elements where position is absolute or fixed). Inline-blocks (elements with display: inline-block). Table cells (elements with display: table-cell, which is the default for HTML table cells). Table captions (elements with display: table-caption, which is the default for HTML table captions). Anonymous table cells implicitly created by the elements with display: table, table-row, table-row-group, table-header-group, table-footer-group (which is th...
...e default for HTML table cells). Table captions (elements with display: table-caption, which is the default for HTML table captions). ...
...able-row, table-row-group, table-header-group, table-footer-group (which is the default for HTML tables, table rows, table bodies, table headers, and table footers, respectively), or inline-table. Block elements where overflow has a value other than visible. display: flow-root. Elements with contain: layout, content, or paint. Flex items (direct children of the element with display: flex or inline-flex) if they are neither flex nor grid nor table containers themselves. Grid items (direct children of the element with display: grid or inline-grid) if they are neither flex nor grid nor table containers themselves. Multicol containers (elements where column-count or column-width isn't auto, including elements with column-count: 1). column-span: all should always create a new formatting cont...
...And 2 more matches
Making content editable - Developer guides
ome JavaScript event handlers, you can transform your web page into a full and fast rich text editor. This article provides some information about this functionality. Note: In Firefox 63 Beta/Dev edition, some of the rich-text editing features have been disabled by default, for better cross-browser compatibility. These are object resizing on <img>, <table>, and absolutely-positioned elements; inline table editing to add or remove rows and columns; and the grabber that allows moving of absolutely-positioned elements. See bug 1449564 and Firefox-specific HTML editing UI has been deprecated for additional details. How does it work? All you have to do is set the contenteditable attribute on nearly any HTML element to make it editable. Here's a simple example which creates a <div> element who...
...on: Executing commands When an HTML element has contenteditable set to true, the document.execCommand() method is made available. This lets you run commands to manipulate the contents of the editable region. ...
... line (indenting). When using contentEditable, calling execCommand() will affect the currently active editable element. Differences in markup generation Use of contenteditable across different browsers has been painful for a long time because of the differences in generated markup between browsers. For example, even something as simple as what happens when you press Enter/Return to create a new line of text inside an editable element was handled differently across the major browsers (Firefox inserted <br> elements, IE/Opera used <p>, Chrome/Safari used <div>). Fortunately, in modern browsers things are somewhat more consistent. As of Firefox 60, Firefox will be updated to wrap the separate lines in <div> elements, matching the behavior of Chrome, modern Opera, Edge, and Safari. Try it out ...
...And 2 more matches
HTML5 - Developer guides
Web › Guide › HTML › HTML5
HTML5 & friends and often shortened to just HTML5. Designed to be usable by all Open Web developers, this reference page links to numerous resources about HTML5 technologies, classified into several groups based on their function. Semantics: allowing you to describe more precisely what your content is. Connectivity: allowing you to communicate with the server in new and innovative ways. Offline and storage: allowing webpages to store data on the client-side locally and operate offline more efficiently. Multimedia: making video and audio first-class citizens in the Open Web. 2D/3D graphics and effects: allowing a much more diverse range of presentation options. Performance and integration: providing greater speed optimization and better usage of computer hardware. Device access: allo...
...irst-class citizens in the Open Web. 2D/3D graphics and effects: allowing a much more diverse range of presentation options. Performance and integration: providing greater speed optimization and better usage of computer hardware. Device access: allowing for the usage of various input and output devices. Styling: letting authors write more sophisticated themes. Semantics Sections and outlines in HTML5 A look at the new outlining and sectioning elements in HTML5: <section>, <article>, <nav>, <header>, <footer> and <aside>. Using HTML5 audio and video The <audio> and <video> elements embed and allow the manipulation of new multimedia content. Forms improvements A look at the constraint validation API, several new attributes, new values for the <input> attribute type and the new <o...
...Server-sent events Allows a server to push events to a client, rather than the classical paradigm where the server could send data only in response to a client's request. WebRTC This technology, where RTC stands for Real-Time Communication, allows connecting to other people and controlling videoconferencing directly in the browser, without the need for a plugin or an external application. ...
...And 2 more matches
<abbr>: The Abbreviation element - HTML: Hypertext Markup Language
Web › HTML › Element › abbr
all abbreviations be marked up using <abbr>. There are, though, a few cases where it's helpful to do so: When an abbreviation is used and you want to provide an expansion or definition outside the flow of the document's content, use <abbr> with an appropriate title. To define an abbreviation which may be unfamiliar to the reader, present the term using <abbr> and either a title attribute or inline text providing the definition. When an abbreviation's presence in the text needs to be semantically noted, the <abbr> element is useful. This can be used, in turn, for styling or scripting purposes. You can use <abbr> in concert with <dfn> to establish definitions for terms which are abbreviations or acronyms. See the example Defining an abbreviation below. Grammar considerations In language...
..., languages where the number of items affects the grammar of a sentence), use the same grammatical number in your title attribute as inside your <abbr> element. This is especially important in languages with more than two numbers, such as Arabic, but is also relevant in English. ...
... the number of items affects the grammar of a sentence), use the same grammatical number in your title attribute as inside your <abbr> element. This is especially important in languages with more than two numbers, such as Arabic, but is also relevant in English. ...
...And 2 more matches
<tr>: The Table Row element - HTML: Hypertext Markup Language
Web › HTML › Element › tr
".", the values in a column would be cleanly aligned on the decimal points, with the number of cents properly displayed to the right of the decimal point. This attribute is obsolete, and was never widely supported anyway. valignObsolete since HTML5 A DOMString specifying the vertical alignment of the text within each cell in the row. Possible values for this attribute are: baseline Aligns each cell's content text as closely as possible to the bottom of the cell, handling alignment of different fonts and font sizes by aligning the characters along the baseline of the font(s) used in the row. If all of the characters in the row are the same size, the effect is the same as bottom. bottom, Draws the text in each of the row's cells as closely as possible to the bottom edge...
...operty to the row. Examples See <table> for examples on <tr>. Basic example This simple example shows a table listing people's names along with various information about membership in a club or service. HTML This HTML demonstrates the most basic structure of a table. There are no groups, no cells that span multiple rows or columns, no captions, and only the most basic styling to create lines around the components of the table for something resembling clarity. There are just four rows (including one header row), each with four columns (including one header column). Not even the table section elements are used; instead, the browser is allowed to determine this automatically. We'll add <thead>, <tbody>, and <tfoot> in the next example. <table> <tr> <th>Name</th> <th>ID</th>...
...Note the use of rowspan on to make the "Name", "ID", and "Balance" headers occupy two rows instead of just one, and the use of colspan to make the "Membership Dates" header cell span across two columns. The CSS is unchanged from before. table { border: 1px solid black; } th, td { border: 1px solid black; } Explicitly specifying table content groups Before really get...
...And 2 more matches
CSP: default-src - HTTP
scheme and port number. You must include the single quotes. Some browsers specifically exclude blob and filesystem from source directives. Sites needing to allow these content types can specify them using the Data attribute. 'unsafe-eval' Allows the use of eval() and similar methods for creating code from strings. You must include the single quotes. 'unsafe-hashes' Allows enabling specific inline event handlers. If you only need to allow inline event handlers and not inline <script> elements or javascript: URLs, this is a safer method than using the unsafe-inline expression. 'unsafe-inline' Allows the use of inline resources, such as inline <script> elements, javascript: URLs, inline event handlers, and inline <style> elements. The single quotes are required. 'none' Refers to the empt...
..., this is a safer method than using the unsafe-inline expression. 'unsafe-inline' Allows the use of inline resources, such as inline <script> elements, javascript: URLs, inline event handlers, and inline <style> elements. The single quotes are required. 'none' Refers to the empty set; that is, no URLs match. The single quotes are required. 'nonce-<base64-value>' An allow-list for specific inline scripts using a cryptographic nonce (number used once). The server must generate a unique nonce value each time it transmits a policy. It is critical to provide an unguessable nonce, as bypassing a resource's policy is otherwise trivial. See unsafe inline script for an example. ...
... '<hash-algorithm>-<base64-value>' A sha256, sha384 or sha512 hash of scripts or styles. The use of this source consists of two portions separated by a dash: the encryption algorithm used to create the hash and the base64-encoded hash of the script or style. ...
...And 2 more matches
CSP: img-src - HTTP
scheme and port number. You must include the single quotes. Some browsers specifically exclude blob and filesystem from source directives. Sites needing to allow these content types can specify them using the Data attribute. 'unsafe-eval' Allows the use of eval() and similar methods for creating code from strings. You must include the single quotes. 'unsafe-hashes' Allows enabling specific inline event handlers. If you only need to allow inline event handlers and not inline <script> elements or javascript: URLs, this is a safer method than using the unsafe-inline expression. 'unsafe-inline' Allows the use of inline resources, such as inline <script> elements, javascript: URLs, inline event handlers, and inline <style> elements. The single quotes are required. 'none' Refers to the empt...
..., this is a safer method than using the unsafe-inline expression. 'unsafe-inline' Allows the use of inline resources, such as inline <script> elements, javascript: URLs, inline event handlers, and inline <style> elements. The single quotes are required. 'none' Refers to the empty set; that is, no URLs match. The single quotes are required. 'nonce-<base64-value>' An allow-list for specific inline scripts using a cryptographic nonce (number used once). The server must generate a unique nonce value each time it transmits a policy. It is critical to provide an unguessable nonce, as bypassing a resource's policy is otherwise trivial. See unsafe inline script for an example. ...
... '<hash-algorithm>-<base64-value>' A sha256, sha384 or sha512 hash of scripts or styles. The use of this source consists of two portions separated by a dash: the encryption algorithm used to create the hash and the base64-encoded hash of the script or style. ...
...And 2 more matches
CSP: navigate-to - HTTP
scheme and port number. You must include the single quotes. Some browsers specifically exclude blob and filesystem from source directives. Sites needing to allow these content types can specify them using the Data attribute. 'unsafe-eval' Allows the use of eval() and similar methods for creating code from strings. You must include the single quotes. 'unsafe-hashes' Allows enabling specific inline event handlers. If you only need to allow inline event handlers and not inline <script> elements or javascript: URLs, this is a safer method than using the unsafe-inline expression. 'unsafe-inline' Allows the use of inline resources, such as inline <script> elements, javascript: URLs, inline event handlers, and inline <style> elements. The single quotes are required. 'none' Refers to the empt...
..., this is a safer method than using the unsafe-inline expression. 'unsafe-inline' Allows the use of inline resources, such as inline <script> elements, javascript: URLs, inline event handlers, and inline <style> elements. The single quotes are required. 'none' Refers to the empty set; that is, no URLs match. The single quotes are required. 'nonce-<base64-value>' An allow-list for specific inline scripts using a cryptographic nonce (number used once). The server must generate a unique nonce value each time it transmits a policy. It is critical to provide an unguessable nonce, as bypassing a resource's policy is otherwise trivial. See unsafe inline script for an example. ...
... '<hash-algorithm>-<base64-value>' A sha256, sha384 or sha512 hash of scripts or styles. The use of this source consists of two portions separated by a dash: the encryption algorithm used to create the hash and the base64-encoded hash of the script or style. ...
...And 2 more matches
CSP: style-src-attr - HTTP
CSP version 3 Directive type Fetch directive default-src fallback Yes. If this directive is absent, the user agent will look for the style-src directive, and if both of them are absent, fallback to default-src directive. ...
... scheme and port number. You must include the single quotes. Some browsers specifically exclude blob and filesystem from source directives. Sites needing to allow these content types can specify them using the Data attribute. 'unsafe-eval' Allows the use of eval() and similar methods for creating code from strings. You must include the single quotes. 'unsafe-hashes' Allows enabling specific inline event handlers. If you only need to allow inline event handlers and not inline <script> elements or javascript: URLs, this is a safer method than using the unsafe-inline expression. 'unsafe-inline' Allows the use of inline resources, such as inline <script> elements, javascript: URLs, inline event handlers, and inline <style> elements. The single quotes are required. 'none' Refers to the empt...
..., this is a safer method than using the unsafe-inline expression. 'unsafe-inline' Allows the use of inline resources, such as inline <script> elements, javascript: URLs, inline event handlers, and inline <style> elements. The single quotes are required. 'none' Refers to the empty set; that is, no URLs match. The single quotes are required. 'nonce-<base64-value>' An allow-list for specific inline scripts using a cryptographic nonce (number used once). The server must generate a unique nonce value each time it transmits a policy. It is critical to provide an unguessable nonce, as bypassing a resource's policy is otherwise trivial. See unsafe inline script for an example. ...
...And 2 more matches
Error.prototype.stack - JavaScript
The non-standard stack property of Error objects offer a trace of which functions were called, in what order, from which line and file, and with what arguments. The stack string proceeds from the most recent calls to earlier ones, leading back to the original global scope call. Description Each step will be separated by a newline, with the first part of the line being the function name (if not a call from the global scope), then by an at (@) sign, the file location (except when the function is the error constructor as the error is being thrown), a colon, and, if there is a file location, the line number. ...
...There is no standard formatting. However, Safari 6+ and Opera 12- use a very similar format. ...
... values could be retrieved (though it may be -- it is still possible in Firefox 14 -- easier to use arguments.callee.caller.arguments, as could the function name be retrieved by arguments.callee.caller.name). "undefined" is listed as "(void 0)". Note that if string arguments were passed in with values such as "@", "(", ")" (or if in file names), you could not easily rely on these for breaking the line into its component parts. Thus, in Firefox 14 and later this is less of an issue. Different browsers set this value at different times. For example, Firefox sets it when creating an Error object, while PhantomJS sets it only when throwing the Error, and archived MSDN docs also seem to match the PhantomJS implementation. Examples Using the stack property The following HTML markup demonstrates ...
...And 2 more matches
SyntaxError() constructor - JavaScript
The SyntaxError constructor creates a new error object that represents an error when trying to interpret syntactically invalid code. ...
... The SyntaxError constructor creates a new error object that represents an error when trying to interpret syntactically invalid code. ...
... The SyntaxError constructor creates a new error object that represents an error when trying to interpret syntactically invalid code. ...
...And 2 more matches
Authoring MathML - MathML
thML. Fallback for Browsers without MathML support Unfortunately, some browsers are not able to render MathML equations or only have a limited support. Hence you will need to use a MathML polyfill to provide some fallback rendering. If you need only basic mathematical constructions such as those used on this MDN wiki then a small mathml.css stylesheet might be enough. ...
...ownload and copy the relevant Javascript and CSS files on your Web site and reference them in your page header (see the COPY-ME.html file from the zip archive for an example). One of the advantage of jqMath over the previous scripts is that it will automatically add some simple CSS rules to do the mathematical layout and make the formulas readable on browsers with limited MathML support. Command-line Programs An alternative way is to parse the simple syntax before publishing your web pages. That is, you use command-line programs to generate them and publish these static pages on your server. pros: You get static Web pages: the LaTeX source don't need to be parsed at each page load, the MathML code is exposed to Web crawlers and you can put them easily on any Web server. Binary pr...
... install programs on your computer, which may be a bit more difficult or they may not be available on all platforms. You must run the programs on your computer and have some kind of workflow to get the Web pages at the end ; that may be a bit tedious. Binary programs are not appropriate to integrate them in a Mozilla extension or XUL application. TeXZilla can be used from the command line and will essentially have the same support as itex2MML described below. However, the stream filter behavior is not implemented yet. If you only want to parse simple LaTeX mathematical expressions, you might want to try tools like itex2MML or Blahtex. The latter is often available on Linux distributions. Let's consider the former, which was originally written by Paul Gartside at the beginning of ...
...And 2 more matches
<menclose> - MathML
a2 + b2 long division symbol actuarial a2 + b2 actuarial symbol radical a2 + b2 square root symbol. Deprecated. Use <msqrt> instead. ...
...b2 actuarial symbol radical a2 + b2 square root symbol. Deprecated. Use <msqrt> instead. ...
...uare root symbol. Deprecated. Use <msqrt> instead. ...
...And 2 more matches
<mtable> - MathML
Web › MathML › Element › mtable
The MathML <mtable> element allows you to create tables or matrices. Inside a <mtable> only <mtr> and <mtd> elements may appear. These elements are similar to <table> , <tr> and <td> elements of HTML. Note: The <mtable> element resets the displaystyle attribute to false. If you want to use this element as an inline-block, you might want to set <mtable displaystyle="true">...</mtable>. Attributes align Specifies the vertical alignment of the table with respect to its environment. Possible values are: axis (default): The vertical center of the table aligns on the environment's axis (typically the minus sign). baseline: The vertical center of the table aligns on the environment's baseline. bottom: The bottom of the table aligns on the environments baseline. center: See baselin...
... In addition, values of the align attribute can end with a rownumber (e.g. align="center 3"). This allows you to align the specified row of the table rather than the whole table. ...
...14) the parsing has been updated to treat whitespace correctly. alignmentscope Unimplemented class, id, style Provided for use with stylesheets. columnalign Specifies the horizontal alignment of the cells. Multiple values separated by space are allowed and apply to the corresponding columns (e.g. columnalign="left right center"). Possible values are: left, center (default) and right. columnlines Specifies column borders. Multiple values separated by space are allowed and apply to the corresponding columns (e.g. columnlines="none none solid"). Possible values are: none (default), solid and dashed. columnspacing Specifies the space between table columns. Unimplemented columnwidth Specifies the width of table columns. displaystyle A Boolean value specifying whether more vertical spa...
...And 2 more matches
Media container formats (file types) - Web media technologies
ile phones, but can still be used on more modern phones and networks. However, the improved bandwidth availability and increased data caps on most networks has reduced the need for the 3GP format. However, this format is still used for slower networks and for lower-performance phones. This media container format is derived from the ISO Base Media File Format and MPEG-4, but is specifically streamlined for lower bandwidth scenarios. Base 3GP media MIME types Audio Video audio/3gpp video/3gpp audio/3gpp2 video/3gpp2 audio/3gp2 video/3gp2 These MIME types are the fundamental types for the 3GP media container; other types may be used depending on the specific codec or codecs in use; in addition, you can add the codecs parameter to the M...
...eform Audio File Format (WAVE), usually referred to simply as WAV due to its filename extension being .wav, is a format developed by Microsoft and IBM to store audio bitstream data. It is derived from the Resource Interchange File Format (RIFF), and as such is similar to other formats such as Apple's AIFF. The WAV codec registry can be found at RFC 2361; however, because nearly all WAV files use linear PCM, support for the other codecs is sparse. The WAVE format was first released in 1991. WAVE media MIME types Audio audio/wave1 audio/wav audio/x-wav audio/x-pn-wav [1] The audio/wave MIME type is the standard type, and is preferred; however, the others have been used by various products over the years and may be used as well in some e...
...he standard type, and is preferred; however, the others have been used by various products over the years and may be used as well in some environments. Audio codecs supported by WAVE Codec Browser support Chrome Edge Firefox Safari ADPCM (Adaptive Differential Pulse Code Modulation) No GSM 06.10 No LPCM (Linear Pulse Code Modulation) Yes MPEG-1 Audio Layer III (MP3) No u-Law (u-Law) No WebM WebM (Web Media) is a format based on Matroska which is designed specifically for use in modern web environments. It's based entirely on free and open technologies and primarily uses codecs that are in turn free and open, although some products ...
...And 2 more matches
Codecs used by WebRTC - Web media technologies
pport for WebRTC. Containerless media WebRTC uses bare MediaStreamTrack objects for each track being shared from one peer to another, without a container or even a MediaStream associated with the tracks. Which codecs can be within those tracks is not mandated by the WebRTC specification. However, RFC 7742 specifies that all WebRTC-compatible browsers must support VP8 and H.264's Constrained Baseline profile for video, and RFC 7874 specifies that browsers must support at least the Opus codec as well as G.711's PCMA and PCMU formats. These two RFCs also lay out options that must be supported for each codec, as well as specific user comfort features such as echo cancelation. This guide reviews the codecs that browsers are required to implement as well as other codecs that some or all browsers ...
...SDP attribute to indicate the maximum resolution that is acceptable. The sender is not required to support this mechanism, however, so you have to be prepared to receive media at a different resolution than you requested. Beyond this simple maximum resolution request, specific codecs may offer further ways to ask for specific media configurations. Supported video codecs WebRTC establishes a baseline set of codecs which all compliant browsers are required to support. Some browsers may choose to allow other codecs as well. Below are the video codecs which are required in any fully WebRTC-compliant browser, as well as the profiles which are required and the browsers which actually meet the requirement. Mandatory video codecs Codec name Profile(s) Browser compatibility ...
... allow other codecs as well. Below are the video codecs which are required in any fully WebRTC-compliant browser, as well as the profiles which are required and the browsers which actually meet the requirement. Mandatory video codecs Codec name Profile(s) Browser compatibility VP8 -- Chrome, Edge, Firefox, Safari (12.1+) AVC / H.264 Constrained Baseline (CB) Chrome (52+), Edge, Firefox[1], Safari [1] Firefox for Android 68 and later do not support AVC (H.264) anymore. This is due to a change in Google Play store requirements that prevent Firefox from downloading and installing the OpenH264 codec needed to handle H.264 in WebRTC connections. See this article on SUMO for details. For details on WebRTC-related considerations for each cod...
...And 2 more matches
Web Performance
ce monitoring approaches.Populating the page: how browsers worka developer should strive to achieve these two goals. To understand how to improve performance and perceived performance, it helps to understand how the browser works.Recommended Web Performance Timings: How long is too long?There are no clear set rules as to what constitutes a slow pace when loading pages, but there are specific guidelines for indicating content will load (1 second), idling (50ms), animating (16.7s) and responding to user input (50 to 200ms).The business case for web performanceYou know web performance is important, but how do you convince clients and management to invest in performance and make it a priority. In this article, we'll discuss creating a clear business case to convince decision-makers to make the inv...
... look at some CSS properties that impact performance and suggested ways of handling styles to ensure performance is not negatively impacted. JavaScript performance best practices JavaScript, when used properly, can allow for interactive and immersive web experiences -- or it can significantly harm download time, render time, in-app performance, battery life, and user experience. This article outlines some JavaScript best practices that should be considered to ensure even complex content is as performant as possible. Mobile performance With web access on mobile devices being so popular, and all mobile platforms having fully-fledged web browsers, but possibly limited bandwidth, CPU and battery life, it is important to consider the performance of your web content on these platforms. This arti...
...forms. This article looks at mobile-specific performance considerations. Using Performance APIs Performance API This guide describes how to use the Performance interfaces that are defined in the High-Resolution Time standard. Resource Timing API Resource loading and timing the loading of those resources, including managing the resource buffer and coping with CORS The performance timeline The Performance Timeline standard defines extensions to the Performance interface to support client-side latency measurements within applications. Together, these interfaces can be used to help identify an application's performance bottlenecks. User Timing API Create application specific timestamps using the user timing API's "mark" and "measure" entry types - that are part of the browser's pe...
...And 2 more matches
Mobile first - Progressive web apps (PWAs)
e the mobile first umbrella. First things first -- mobile as a default You may think that concentrating on the mobile experience first sounds pointless, as we are more used to dealing with desktop sites, and we surely need to consider the full gamut of features for the overall experience across desktop, mobile, etc., before then paring it down to a mobile experience that is simpler, more streamlined, or whatever. This rings true, yes, but in our experience mobile first is more about having the mobile implementation as a default layer to build on. We consider the overall experience during the planning stage, look at what subset of features will be available on mobile, desktop, etc. in tandem and how they will be implemented. Then at implementation stage, we present the mobile layout and fun...
...te the concepts, I wanted to cover in this article, I created a very simple app containing a nav menu, heading and single column of text. You can see my mobile first example running live, or grab the code to play with it on Github. To make my simple example I created a sample app structure from a Mozilla Mortar template. I installed the Volo automation tool by running the following on the command line sudo npm install -g volo (You'll also need to get Node.js too if you don't already have it) I then created my sample project using volo create myapp mozilla/mortar-app-stub This creates a sample project inside a directory called myapp. The app's code files are inside the www folder. Volo has a number of useful commands available, of which we will just use a couple: volo server: starts a l...
...bile first layout The above layout is fine for narrower layouts, but it doesn't work very well when you get wider than about 480px. ...
...And 2 more matches
gradientUnits - SVG: Scalable Vector Graphics
The gradientUnits attribute defines the coordinate system used for attributes specified on the gradient elements. Two elements are using this attribute: <linearGradient> and <radialGradient> linearGradient For <linearGradient>, gradientUnits defines the coordinate system used for the attributes x1, y1, x2, and y2. Value userSpaceOnUse | objectBoundingBox Default value objectBoundingBox Animatable Yes userSpaceOnUse This value indicates that the attributes represent values in the coordinate system that results from taking the current user coordinate system in place at the time when the gradient element is referenced (i.e., the user coordinate system for the element referencing the gradient element via a fill or stroke property) and then applyin...
...dingBox This value indicates that the user coordinate system for the attributes is established using the bounding box of the element to which the gradient is applied and then applying the transform specified by attribute gradientTransform. Percentages represent values relative to the bounding box for the object. With this value and gradientTransform being the identity matrix, the normal of the linear gradient is perpendicular to the gradient vector in object bounding box space (i.e., the abstract coordinate system where (0,0) is at the top/left of the object bounding box and (1,1) is at the bottom/right of the object bounding box). When the object's bounding box is not square, the gradient normal which is initially perpendicular to the gradient vector within object bounding box space may re...
...o application of the non-uniform scaling transformation from bounding box space to user space. Specifications Specification Status Comment Scalable Vector Graphics (SVG) 2The definition of 'gradientUnits for <radialGradient>' in that specification. ...
...And 2 more matches
stroke-dashoffset - SVG: Scalable Vector Graphics
The stroke-dashoffset attribute is a presentation attribute defining an offset on the rendering of the associated dash array. Note: As a presentation attribute stroke-dashoffset can be used as a CSS property. ...
... The stroke-dashoffset attribute is a presentation attribute defining an offset on the rendering of the associated dash array. Note: As a presentation attribute stroke-dashoffset can be used as a CSS property. ...
...set can be used as a CSS property. ...
...And 2 more matches
<marker> - SVG: Scalable Vector Graphics
Web › SVG › Element › marker
Markers are attached to shapes using the marker-start, marker-mid, and marker-end properties. ...
... Markers are attached to shapes using the marker-start, marker-mid, and marker-end properties. ...
...="6" markerHeight="6" orient="auto-start-reverse"> <path d="M 0 0 L 10 5 L 0 10 z" /> </marker> <!-- simple dot marker definition --> <marker id="dot" viewBox="0 0 10 10" refX="5" refY="5" markerWidth="5" markerHeight="5"> <circle cx="5" cy="5" r="5" fill="red" /> </marker> </defs> <!-- Coordinate axes with a arrowhead in both direction --> <polyline points="10,10 10,90 90,90" fill="none" stroke="black" marker-start="url(#arrow)" marker-end="url(#arrow)" /> <!-- Data line with polymarkers --> <polyline points="15,80 29,50 43,60 57,30 71,40 85,15" fill="none" stroke="grey" marker-start="url(#dot)" marker-mid="url(#dot)" marker-end="url(#dot)" /> </svg> Attributes markerHeight This attribute defines the height of the marker...
...And 2 more matches
<solidcolor> - SVG: Scalable Vector Graphics
This is less elegant, and unlike <solidcolor>, cannot itself be used in the definition of gradients. ...
...butes Global event attributes Presentation attributes Style attributes Specific attributes None. DOM interface This element implements the SVGSolidcolorElement interface. Example SVG <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 300 200" height="150"> <defs> <!-- solidColor is experimental. ...
... the SVGSolidcolorElement interface. Example SVG <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 300 200" height="150"> <defs> <!-- solidColor is experimental. --> <solidcolor id="myColor" solid-color="gold" solid-opacity="0.8"/> <!-- linearGradient with a single color stop is a less elegant way to achieve the same effect, but it works in current browsers. ...
...And 2 more matches
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. ...
...ure 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. ...
...The only interesting part is the <svg> element i...
...And 2 more matches
Preferences - Archive of obsolete content
is nsIPrefLocalizedString. It is similar to nsISupportsString, except that when there is no user value, getComplexValue() gets the default value from a locale file (thus making the default value localizable). It's easier to explain this by example. Let's say you want to make the default value for the extensions.myext.welcomemessage preference localizable. You should do the following: Add this line to some .properties file (for all of your locales), say to chrome://myext/locale/defaults.properties: extensions.myext.welcomemessage=Localized default value Add the default value for extensions.myext.welcomemessage, pointing to that properties file, by adding the following line to your file with default preferences (see below). pref("extensions.myext.welcomemessage", "chrome://myext/loca...
...ons read (application directory)/defaults/preferences/*.js In addition to that, recent versions of Toolkit applications (Firefox 1.0, Thunderbird 1.0, and the like but not the Mozilla Suite) read extension defaults -- usually located in (profile folder)/extensions/(ID)/defaults/preferences/ These files use simple JavaScript-like syntax. To add a default value for a preference, you should add a line like this to your default preferences file: pref("extensions.extensionname.preferencename", false); How to install an extension's defaults files For Mozilla Suite (not Firefox and Thunderbird), copy them to (appdir)/defaults/pref in your install script. For Firefox/Thunderbird, just put them in myext.xpi/defaults/preferences/. They will be copied and registered with the preferences system au...
... FIXME: ...
... FIXME: ...
JavaScript Daemons Management - Archive of obsolete content
unk?", oRecompose = new Daemon(document.createElement("p"), perform, 33, 30, prepare); onload = function () { oRecompose.owner.id = "perform-me"; document.body.appendChild(oRecompose.owner); oRecompose.play(); }; </script> <style type="text/css"> body { font-family: monospace, sans-serif; background: #DDDDDD; overflow: hidden; } #perform-me { margin: 50px; font-size: 20px; line-height: 20px; } </style> </head> <body> <h1>new Daemon(<em>@thisObject</em>, <em>@callback</em>[, <em>@rate</em>, <em>@length</em>, <em>@init</em>, <em>@onstart</em>])</h1> <p><button onclick="oRecompose.skipTo(11);">skipTo(11)</button> <button onclick="oRecompose.makeSteps(29);">makeSteps(29)</button> <button onclick="oRecompose.fixPosition(-13);">fixPosition(-13)</button> <button onclick="oR...
... : this.pool[parseInt(Math.random() * this.pool.length)]; } } }, 33, 30); onload = function () { oUnhide.owner.target.id = "animate-me"; document.body.appendChild(oUnhide.owner.target); oUnhide.play(); }; </script> <style type="text/css"> body { font-family: monospace, sans-serif; background: #DDDDDD; overflow: hidden; } #animate-me { margin: 50px; font-size: 20px; line-height: 20px; } </style> </head> <body> <h1>Daemon.buildAround()</h1> <p><button onclick="oUnhide.skipTo(11);">skipTo(11)</button> <button onclick="oUnhide.makeSteps(29);">makeSteps(29)</button> <button onclick="oUnhide.fixPosition(-13);">fixPosition(-13)</button> <button onclick="oUnhide.play();">play</button> <button onclick="oUnhide.turn();">turn</button> <button onclick="oUnhide.pause();">...
..., oRecompose = new Daemon.safe(document.createElement("p"), perform, 33, 30, prepare); onload = function () { oRecompose.owner.id = "perform-me"; document.body.appendChild(oRecompose.owner); oRecompose.play(); }; </script> <style type="text/css"> body { font-family: monospace, sans-serif; background: #DDDDDD; overflow: hidden; } #perform-me { margin: 50px; font-size: 20px; line-height: 20px; } </style> </head> <body> <h1>new Daemon.safe(<em>@thisObject</em>, <em>@callback</em>[, <em>@rate</em>, <em>@length</em>, <em>@init</em>, <em>@onstart</em>])</h1> <p><button onclick="oRecompose.skipTo(11);">skipTo(11)</button> <button onclick="oRecompose.makeSteps(29);">makeSteps(29)</button> <button onclick="oRecompose.fixPosition(-13);">fixPosition(-13)</button> <button onclic...
... : this.pool[parseInt(Math.random() * this.pool.length)]; } } }, 33, 30); onload = function () { oUnhide.owner.target.id = "animate-me"; document.body.appendChild(oUnhide.owner.target); oUnhide.play(); }; </script> <style type="text/css"> body { font-family: monospace, sans-serif; background: #DDDDDD; overflow: hidden; } #animate-me { margin: 50px; font-size: 20px; line-height: 20px; } </style> </head> <body> <h1>Daemon.safe.buildAround()</h1> <p><button onclick="oUnhide.skipTo(11);">skipTo(11)</button> <button onclick="oUnhide.makeSteps(29);">makeSteps(29)</button> <button onclick="oUnhide.fixPosition(-13);">fixPosition(-13)</button> <button onclick="oUnhide.play();">play</button> <button onclick="oUnhide.turn();">turn</button> <button onclick="oUnhide.pause...
Enhanced Extension Installation - Archive of obsolete content
Background There are several flaws with Extension1 Installation in Firefox2 1.0, including: It is very difficult for a third party application with its own managed install process to install an Extension into Firefox. First it must locate the Firefox executable, then run it with the -install-global-extension command line flag, which installs from a XPI into the Firefox application directory. Aside from the work of locating the Firefox executable in the first place (which varies from platform to platform), this is very limiting because: It forces the third party application to package its Firefox integration hooks as a XPI. It forces it to have write access to the Firefox directory in order to be installed, which may not always be the case. It forces its items to be located in ...
...adata: <profile>/extensions.ini -active items This file contains a list of active Extension directories (i.e. directories to extensions that are enabled only), to be used by the XREDirProvider during startup to locate components, preferences and chrome manifests. The format here is similar to Firefox 1.0 except there is no longer a Count value that needs to be kept in sync with the number of lines... the file is written simply as Extension#=<absolute path to item> and is read until there are no more numbers. The other difference is that since there is now only a single instance of this file in the profile location, the file paths are now absolute. <profile>/extensions.rdf -visible items This file contains non-startup and compatibility metadata for extensions that are visible to the use...
...patibility metadata for extensions that are visible to the user, whether they are enabled or disabled. If an extension is installed at two different Install Locations, the one with the higher importance is what is shown in this file. This replaces the individual Extensions.rdf files at the old locations. <profile>/extensions-startup.manifest -all items This file contains a tab delimited set of lines, one per item. This is a list of all installed items, disabled or not, keyed first by Install Location name, then by GUID. The following information is stored for each entry: the persistent descriptor of the path where the item lives. the last modified time of that path, used to detect out of process upgrades. optionally, an operation key that tells the startup system that there is an in...
...on, the extensions-startup.manifest file is written from the current state of the cache. The Pending Operations List is used by the Install Operation Finalization routine (|_finishOperations|) to get a list of items that are to be operated on. Since all metadata is now stored in the profile directory, there is no longer any need for special Extension System handling of the -register command line flag, so support for that has been removed. Datasource Structure Since there is now only a single RDF/XML datasource for storage of all installed items, the staggered datasource structure used by Firefox 1.0 and the use of an internal composite datasource is no longer required. The Extension System retains an object implementing nsIRDFDataSource (so that it can supply special properties in addi...
Install Manifests - Archive of obsolete content
ne Doe</em:contributor> <em:contributor>Elvis Presley</em:contributor> creator The name of the creator/principal developer - intended for display in the user interface. Examples <em:creator>John Doe</em:creator> or <em:creator>CoolExtension Team</em:creator> description A short description of the add-on - intended for display in the user interface. This description should fit on one short line of text. Examples <em:description>Advanced foo tools.</em:description> developer The name(s) of co-developers. You may specify more than one of this value to specify multiple developers. Examples <em:developer>Jane Doe</em:developer> <em:developer>Koos van der Merwe</em:developer> hasEmbeddedWebExtension If present and given the value "true", this indicates that this add-on contains an em...
...eURL> iconURL A chrome:// URL to an icon to display in the add-ons list. The icon will be displayed at 32x32 in Firefox 3.6 and lower. In Firefox 4.0 and later the icon can be up to 48x48 pixels in size. If this property is not specified, a default icon is used. <em:iconURL>chrome://myext/skin/icon.png</em:iconURL> Note: For the above example to work you will also have to add a skin package line to your chrome.manifest file. See Chrome Registration#skin. Alternatively you can place your icon in the directory specified in your content package line. Gecko 1.9.2 note Starting in Gecko 1.9.2 (Firefox 3.6), you can also simply include your icon, named icon.png, in the base directory of the add-on. This allows your add-on's icon to be displayed even when the add-on is disabled, or if the m...
...e displayed even when the add-on is disabled, or if the manifest is missing an iconURL entry. icon64URL A chrome:// URL to a 64x64 pixel icon to display in the add-on's details view . If this property is not specified, the smaller icon above will be used. <em:icon64URL>chrome://myext/skin/icon64.png</em:icon64URL> Note: For the above example to work you will also have to add a skin package line to your chrome.manifest file. See Chrome Registration#skin. Alternatively you can place your icon in the directory specified in your content package line. Gecko 2.0 note Starting in Gecko 2.0 (Firefox 4.0), you can also simply include your icon, named icon64.png, in the base directory of the add-on. This allows your add-on's icon to be displayed even when the add-on is disabled, or if the man...
...em:id> <em:unpack>true</em:unpack> ... </Description> updateKey To ensure the security of update rdf data that is retrieved over plain HTTP you must use a digital signature to verify the contents of the data. In order to do so you must include the public part of the cryptographic key in an updateKey entry in the install.rdf of the add-on. This can be generated using the McCoy tool. Any line breaks and whitespace as part of this entry are ignored. <em:updateKey>MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDK426erD/H3XtsjvaB5+PJqbhj Zc9EDI5OCJS8R3FIObJ9ZHJK1TXeaE7JWqt9WUmBWTEFvwS+FI9vWu8058N9CHhD NyeP6i4LuUYjTURnn7Yw/IgzyIJ2oKsYa32RuxAyteqAWqPT/J63wBixIeCxmysf awB/zH4KaPiY3vnrzQIDAQAB</em:updateKey> updateURL A link to a custom Update Manifest fil...
User Notifications and Alerts - Archive of obsolete content
u come back to the tab that displayed it. This means that these notifications make the most sense when they are related to the page currently being displayed, such as a page trying to install an add-on, or a site you just entered a password on. ...
...The notificationbox elements can be obtained from the gBrowser object. In this case we don't pass any argu...
...The notificationbox elements can be obtained from the gBrowser object. ...
...to include a hidden box in your overlay, which you can fill with any content you need before removing the hidden attribute so that it is displayed to the user. The best locations for this kind of box are above and below the tab browser. Below is preferrable because it only cuts the bottom part of the current page, as opposed to pushing down all tabs and content. Notification boxes are a good guideline to what you should aim for: thin, informative and easy to dismiss. Another option is to also add a hidden box to the overlay, but use CSS positioning to locate it where you want. This usually means that the box will be hovering on top of the page's content, and there are a few things you must know about this. First of all, switching tabs will probably make your alert disappear. This is probably ...
Index of archived content - Archive of obsolete content
ences Deploying a Plugin as an Extension Developing add-ons Displaying web content in an extension without security issues Downloading JSON and JavaScript in extensions Enhanced Extension Installation Extension Etiquette Extension Library Extension Packaging Extension Samples Extension Theming Guidelines Extension Versioning, Update and Compatibility Extensions support in SeaMonkey 2 Firefox addons developer guide Hiding browser chrome Hotfix Extension How to convert an overlay extension to restartless Inline options Install Manifests Installing Extensions and Themes From Web Pages Interaction bet...
...g Guide Embedding FAQ Embedding Mozilla in a Java Application using JavaXPCOM Error Console Exception logging in JavaScript Existing Content Extension Frequently Asked Questions External CVS snapshots in mozilla-central Fast Graphics Performance With HTML Firefox Block and Line Layout Cheat Sheet Content states and the style system Disabling interruptible reflow Document Loading - From Load Start to Finding a Handler Documentation for BiDi Mozilla Downloading Nightly or Trunk Builds JSS build instructions for OSX 10.6 Layout FAQ Layout System Overview Multiple Fir...
...ble Layout Strategy Tamarin ABCasm Tamarin Acceptance Testing Abc Assembler Tests Actionscript Acceptance Tests Tamarin Acceptance Test Template Actionscript Performance Tests Cmdline tests Running Tamarin acceptance tests Running Tamarin performance tests Tamarin Build System Documentation Tamarin Releases Tamarin-central rev 703:2cee46be9ce0 Tamarin Roadmap Tamarin build documentation Tamarin m...
... SVG And Canvas In Mozilla XUL - Mozilla's XML User Interface Language XTech 2006 Presentations XUL Explorer XULRunner Application Update Article Building XULRunner Building XULRunner with Python CommandLine Components Creating XULRunner Apps with the Mozilla Build System Creating a Windows Inno Setup installer for XULRunner applications Custom app bundles for Mac OS X Debugging a XULRunner Application Deploying XULRunner Dialogs in XULRunner Getting started with XULRunner How to enable locale ...
Localizing an extension - Archive of obsolete content
rosoft.label "Microsoft (MSFT)"> <!ENTITY menu_yahoo.label "Yahoo (YHOO)"> Update the XUL files Each XUL file needs to reference its corresponding locale file. We also need to update the code to use the entities instead of the strings, so that the substitutions take place based on the currently active locale. To add a reference to the correct locale file for a given XUL file, we need to add one line to the XUL file. To options.xul, we add this line: <!DOCTYPE window SYSTEM "chrome://stockwatcher2/locale/options.dtd"> We add a similar line to the stockwatcher.xul file: <!DOCTYPE overlay SYSTEM "chrome://stockwatcher2/locale/stockwatcher2.dtd"> In larger applications you might need to use entities from several locale files in a single XUL file. Using multiple DTDs describes how to do it. N...
...tiple DTDs describes how to do it. Note that the URLs of the DTD files don't actually include the name of the localization to use. The Chrome Registry resolves the URIs based on the user's current locale setting and the data you provide in your Chrome manifest. Then we simply replace each text string in our XUL files with the corresponding entity. ...
...Localizing strings in JavaScript code If your JavaScript code contains literal strings that need to be localized, as does our stock watcher sample, we need to make those localizable as well. ...
...ltipText = changeString + fieldArray[4] + " | " + openString + fieldArray[5] + " | " + lowString + fieldArray[6] + " | " + highString + fieldArray[7] + " | " + volumeString + fieldArray[8]; Localizing the description in install.rdf See Localizing extension descriptions. Adding more localizations To add another localization for a new language, all you need to do is add another line to the chrome manifest referencing the new locale. For example, to add a Spanish localization, you would add: locale stockwatcher2 es-ES chrome/locale/es-ES/ Then just create a subdirectory chrome/locale/es-ES and add the needed DTD files; in this case, options.dtd and stockwatcher2.dtd. These files should map the same tags to the Spanish translations of the strings used by the extension. Likew...
MCD, Mission Control Desktop, AKA AutoConfig - Archive of obsolete content
f the current user. Netscape.cfg/AutoConfig failed. Please contact your system administrator. Error: getLDAPAttibutes failed: [Exception... "Component returned failure code: 0xc1f30001 (NS_ERROR_NOT_INITIALIZED) [nsILDAPURL.spec]" nsresult: "0xc1f30001 (NS_ERROR_NOT_INITIALIZED)" location: "JS frame :: file:////usr/lib/thunderbird-3.0b2/defaults/autoconfig/prefcalls.js :: getLDAPAttributes :: line 174" data: no] bug 295329 had been re-opened . AutoConfig Option and LDAP Support in Thunderbird 1.5.x Fortunately, AutoConfig is now part of Thunderbird default packages. MOZ_LDAP_XPCOM=1 and MOZ_EXTENSIONS_DEFAULT="wallet spellcheck xmlextras pref webservices universalcharset auth" are now present in the default configure script. See bug 295329 for details. Add the AutoConfig Option for...
...beta 2 (2007/01/16) to check if autoconfig + ldap is still supported . Apprently it's OK . Autonfig API is there, ldap call works fine, good !. 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. Just setting MOZILLA_DEBUG=1 (see js code in thunderbird.cfg) allow that message to appear , it's very useful in debuging context ... The displayError() function does not work prope...
...} if Ldap call are uncommented in the preference file above, then I get a popup with: Netscape.cfg/AutoConfig failed. Please contact your system administrator. Error: getLDAPAttibutes failed: [Exception... "Could not convert JavaScript argument arg 0 [nsISupports.QueryInterface]" nsresult: "0x80570009 (NS_ERROR_XPC_BAD_CONVERT_JS)" location: "JS frame :: prefcalls.js :: getLDAPAttributes :: line 177" data: no] AutoConfig (pref) and LDAP Support in Packages Add LDAP Support in Firefox 1.5 A least from Firefox 1.5, AutoConfig is compiled by default (cf. browser, MOZ_EXTENSIONS_DEFAULT="pref...") but not LDAP (MOZ_LDAP_XPCOM=1). You need to recompile the package to get it, cf. bug 295329. Add AutoConfig and LDAP Support in Firefox 1.0.x Add pref extension (--enable-extensions=pref) an...
... encode: moz-byteshift.pl -s 7 <netscape.cfg.txt >netscape.cfg # Mozilla uses a byte-shift of 13 # To decode: moz-byteshift.pl -s -13 <netscape.cfg >netscape.cfg.txt # To encode: moz-byteshift.pl -s 13 <netscape.cfg.txt >netscape.cfg # To activate the netscape.cfg file, place the encoded netscape.cfg file # into your C:\Program Files\mozilla.org\Mozilla directory. # Then add the following line to your # C:\Program Files\mozilla.org\Mozilla\defaults\pref\autoconf.js file: # pref("general.config.filename", "mozilla.cfg"); ... $ ./moz-byteshift.pl -s 13 < mci-mozilla-web-tux.js > mci-mozilla-web-tux.cfg Location of mci-mozilla-web-tux.cfg The location of the netscape.cfg (here renamed to mci-mozilla-web-tux.cfg) and the way to call it is different from the old Netscape 4.x. It's locat...
Notes on HTML Reflow - Archive of obsolete content
gle element in the content model; the frames are arranged into a hierarchy that parallels the containment hierarchy in the content model. A frame is rectangular, with width, height, and an offset from the parent frame that contains it. More than one frame may be needed to represent a single element from the content model; for example, text that wraps is broken into several frames, one per wrapped line. In this case, the primary frame is the frame containing the first line of text, with continuing frames (or continuations ) created for subsequent lines. HTML uses a flow based layout model, meaning that most of the time it is possible to compute the geometry in a single pass. Elements later "in the flow" typically do not affect the geometry of elements that ar...
... The incremental reflow proceeds recursively through the frame hierarchy. Each frame along the incremental reflow path (as specified in the reflow command object) extracts the next frame and dispatches the reflow downward. In order to correctly dispatch the reflow to the child frame, the frame may need to perform some state recovery ; for example, a block frame will traverse its line list to recover the space occupied by floated frames. At some point, the incremental reflow reaches the target frame , at which point the reflow command's type becomes significant. ContentChanged indicates that the content corresponding to the target frame has changed somehow; for example, the text associated with a text frame has been modified. In reality, the only frame tha...
...al reflows to be coalesced intelligently. A frame that decides it needs a dirty reflow sets the NS_FRAME_IS_DIRTY state bit on itself, and then calls the ReflowDirtyChild method on its parent frame. In ReflowDirtyChild, the parent frame sets the NS_FRAME_HAS_DIRTY_CHILD state bit on itself, and does any bookkeeping necessary to remember which child is dirty (for example, the block frame marks the linebox dirty that contains the child frame). The parent frame can then either decide to schedule a ReflowDirty Incremental reflow targeted at itself, or to delegate that responsibility to its parent. If it decides to delegate, then it sets the NS_FRAME_IS_DIRTY state bit on itself and recursively calls ReflowDirtyChild. Eventually, the ReflowDirty Incremental reflow is dispatched, and arrive...
...r to delegate that responsibility to its parent. If it decides to delegate, then it sets the NS_FRAME_IS_DIRTY state bit on itself and recursively calls ReflowDirtyChild. Eventually, the ReflowDirty Incremental reflow is dispatched, and arrives at the container frame that scheduled it. The target frame recovers its bookkeeping information (e.g., the block frame iterates through the dirty lineboxes), and reflows the dirty child frames. Isn't information lost if a ReflowDirty Incremental reflow coalesces different kinds of incremental reflows (e.g., a ContentChanged with a StyleChanged)? No, because these kinds of reflows aren't coalesced; instead, they're directly enqueued to the presentation shell's reflow queue. HTML and XUL Interaction As mentioned above, HTML and XUL have ...
Dehydra Function Reference - Archive of obsolete content
See the Dehydra object reference for details on the available object properties. process_type(type) Dehydra calls this for each class, struct, enum, union, and typedef declaration. process_type is called after process_function is called for all the member functions. type is a type object representing the type that was declared. ...
...each class, struct, enum, union, and typedef declaration. process_type is called after process_function is called for all the member functions. type is a type object representing the type that was declared. process_function(decl, body) Dehydra calls this for each function definition (declarations without bodies are not included), including both top-level functions, class member functions, and inline class member functions. decl is a Variable Type object representing the function being processed body is an array of {loc:, statements:array of Variable Types} representing an outline of the function stripped down to variables, function calls and assignments. process_decl(decl) process_decl is called for every global variable, function, or template declaration. decl is a variable type input_e...
...compiled with DEBUG macro defined. require() Example require({strict:true, gczeal:2}) if (require().werror) print("werror is set") warning([code,] msg [, loc]) Print a warning message using the GCC warning mechanism. If -Werror is specified this will cause compilation to fail. Optional: code is an integer parameter that allows warnings to be enabled(-Wfoo) and disabled(-Wno-) on the GCC commandline. This parameter is used when the first argument to warning() is an integer. It is not possible to define new warnings in Dehydra, thus one has to figure out a warning code from an existing warning and hijack it for ulterior purposes. msg is a string to be presented as a gcc warning Optional: loc is the location that should be reported for the warning. If no location is provided, the location is i...
...-fplugin-arg="foo.js a b c" would run foo.js with ["a", "b", "c"] arguments array. This page was auto-generated because a user created a sub-page to this page. ...
Mozilla Crypto FAQ - Archive of obsolete content
sting onto a mirror or archive site of already-posted source code, notification is required only for the initial posting." BXA and NSA have already been notified of the posting of encryption-related source code on the Mozilla site, and in light of this opinion we have therefore decidednot to ask mirror sites to provide notification themselves. Note that in any case the notification procedures outlined in the Export Administration Regulations apply only to U.S. residents and sites located in the U.S. If you are not a U.S. citizen or resident and your mirror site is located outside the U.S. then you are not subject to U.S. encryption export regulations; however you may be subject to other regulations related to encryption, and are responsible for complying with any such regulations applying in ...
...ibly to the U.S. Supreme Court. Until the appeals process is completed the U.S. government will continue to enforce current U.S. export regulations. In light of the new encryption export regulations it is also possible that the Bernstein case may be declared moot on the basis that Professor Bernstein is now free to do what he originally requested to do, i.e., publish his encryption source code online. For more information see the archives on the Bernstein case maintained by the Electronic Frontier Foundation, particularly the 9th Circuit Court of Appeals ruling, the press release issued by the U.S. Bureau of Export Administration immediately afterward, and the U.S. Export Administration Regulations themselves, particularly 15 CFR Part 774, Supplement No. 1, Category 5, Part 2, entry 5D002 (n...
...form vs. electronic form). See also the request for an advisory opinion made to the Bureau of Export Administration by Bernstein's lawyers and the resulting advisory opinion issued by BXA in response to that request. Where can I learn more about U.S. export controls on encryption software? For more information on U.S. export control of encryption software and related topics, see the following online references: The ITAR, EAR and encryption export archive maintained by the Electronic Freedom Foundation (EFF). The cryptography policy page maintained by the Electronic Privacy Information Center (EPIC). The encryption page maintained by the Center for Democracy and Technology (CDT). The following books may also be of interest if you want to know more about the history and politics of U.S.
...e maintained by the Electronic Freedom Foundation (EFF). The cryptography policy page maintained by the Electronic Privacy Information Center (EPIC). The encryption page maintained by the Center for Democracy and Technology (CDT). The following books may also be of interest if you want to know more about the history and politics of U.S. export control of encryption software: Privacy on the Line: The Politics of Wiretapping and Encryption, by Whitfield Diffie and Susan Landau. Provides historical context and technical background for the recent political battles around encryption and privacy issues. Technology and Privacy: The New Landscape, by Philip Agre and Marc Rotenberg (ed.). A set of ten essays on various aspects of privacy and technological developments affecting it. The Electro...
Reading textual data - Archive of obsolete content
spond to a valid character. The last (4th) argument to init specifies which character they get replaced with; nsIConverterInputStream.DEFAULT_REPLACEMENT_CHARACTER is U+FFFD REPLACEMENT CHARACTER, which is often a good choice. If you do not want any replacement, you can specify 0x0000 as replacement character; that way, readString will throw an exception when reaching unsupported bytes. Reading lines The nsIUnicharLineInputStream interface provides an easy way to read entire lines from a unichar stream. It can be used like nsILineInputStream, except that it supports non-ASCII characters, and has no problems with charsets with embedded nulls (like UTF-16 and UTF-32). It can be used like this: var charset = /* Need to find out what the character encoding is. Using UTF-8 for this example: */...
... to find out what the character encoding is. Using UTF-8 for this example: */ "UTF-8"; var is = Components.classes["@mozilla.org/intl/converter-input-stream;1"] .createInstance(Components.interfaces.nsIConverterInputStream); // This assumes that fis is the nsIInputStream you want to read from is.init(fis, charset, 1024, 0xFFFD); is.QueryInterface(Components.interfaces.nsIUnicharLineInputStream); if (is instanceof Components.interfaces.nsIUnicharLineInputStream) { var line = {}; var cont; do { cont = is.readLine(line); // Now you can do something with line.value } while (cont); } The above example reads an entire stream until EOF. See nsIConverterInputStream for nsIConverterInputStream.init() arguments. Earlier versions Reading strings Earlier versions ...
...la.org/scriptableinputstream;1"] .createInstance(Components.interfaces.nsIScriptableInputStream); scriptableStream.init(istream); var chunk = scriptableStream.read(4096); var text = converter.ConvertToUnicode(chunk); However, you must be aware that this method will not work for character encodings that have embedded null bytes, such as UTF-16 or UTF-32. Reading Lines There is no easy, general way to read a unicode line from a stream. For the limited use case of reading lines from a local file, the following code using nsIScriptableUnicodeConverter works. This code will not work for character encodings that contain embedded nulls such as UTF-16 and UTF-32 // First, get and initialize the converter var converter = Components.classes["@mozilla.org/intl/scrip...
... = /* The character encoding you want, using UTF-8 here */ "UTF-8"; // This assumes that 'file' is a variable that contains the file you want to read, as an nsIFile var fis = Components.classes["@mozilla.org/network/file-input-stream;1"] .createInstance(Components.interfaces.nsIFileInputStream); fis.init(file, -1, -1, 0); var lis = fis.QueryInterface(Components.interfaces.nsILineInputStream); var lineData = {}; var cont; do { cont = lis.readLine(lineData); var line = converter.ConvertToUnicode(lineData.value); // Now you can do something with line } while (cont); fis.close(); See also Writing textual data Joel on Software: The Absolute Minimum Every Software Developer Absolutely, Positively Must Know About Unicode and Character Sets ...
Tamarin mercurial commit hook - Archive of obsolete content
It is highly recommended that all developers enable the mercurial commit hook for tamarin. The hook is located in the tamarin-redux repository in the file utils/hooks/tamarin-commit-hook.py This is a simple mercurial hook that checks the following filetypes ('.cpp', '.h', '.as', '.abs', '.py') for the following: Tabs anywhere in the line Trailing whitespace Windows line endings (\r\n) "MARK_SECURITY_CHANGE" - Looks for this text and warns user as security changes should NOT be checked into the public tamarin-redux repository. Installing the commit hook The easiest way to implement the hook is to sync to the tip of tamarin-redux then add the following to your tamarin-redux/.hg/hgrc file (or to ~/.hgrc to implement for all local repos): [hooks] pretxncommit.commit = python:/path/to/t...
...then add the following to your tamarin-redux/.hg/hgrc file (or to ~/.hgrc to implement for all local repos): [hooks] pretxncommit.commit = python:/path/to/tamarin-redux/utils/hooks/tamarin-commit-hook.py:master_hook Once added, all commits will run the commit hook. Hook Use On every commit to your local repository, the hook will only check for violations in any new / changed code. Any untouched lines of code that violate the check will be ignored. When a violation is found the following will be displayed: > hg commit -m "change with a tab" Tab(s) found in test/test.txt for rev 1458 (change 53543674b8e6): @@ -65,4 +65,6 @@ +# tab here ^ (n)o, (y)es, (a)llow Tabs for current file Are you sure you want to commit this change? [n]: Note that the prompt gives you the options to abort the...
...If you choose to abort the commit, the commit message will be saved to .hg/commit.save. This allows you to reuse the commit message after fixing the issue by using the -l (--logfile) option: hg commit -l /reporoot/.hg/commit.save Notes At the moment this is a local-only hook and is not enforced on the server. This may change in the future and...
...yed: > hg commit -m "change with a tab" Tab(s) found in test/test.txt for rev 1458 (change 53543674b8e6): @@ -65,4 +65,6 @@ +# tab here ^ (n)o, (y)es, (a)llow Tabs for current file Are you sure you want to commit this change? [n]: Note that the prompt gives you the options to abort the commit (no), allow the tab (or other violation) on that particular line, or allow the violation for all lines in that file. If you choose to abort the commit, the commit message will be saved to .hg/commit.save. This allows you to reuse the commit message after fixing the issue by using the -l (--logfile) option: hg commit -l /reporoot/.hg/commit.save Notes At the moment this is a local-only hook and is not enforced on the server. This may change in the future and be enforced for all checkins. ...
Using Breakpoints in Venkman - Archive of obsolete content
s possible. Future breakpoints are used when you want to stop in a script that has not yet been compiled. The most common use of future breakpoints is to stop in a "top level" script (script that executes outside of any function), or script that executes during the onLoad event of a page. When a script is loaded that matches the URL of a future breakpoint, and has executable code at the specified line, Venkman will automatically set a future breakpoint. Except for this distinction, breakpoints in Venkman work like breakpoints in most other debuggers. The dots you see in the left margin of the Source Code View indicate which lines contain executable code, places where a hard breakpoint can be set. Setting Breakpoints Clicking on one of these dots in the Source Code View will set a breapoint at...
...man will automatically set a future breakpoint. Except for this distinction, breakpoints in Venkman work like breakpoints in most other debuggers. The dots you see in the left margin of the Source Code View indicate which lines contain executable code, places where a hard breakpoint can be set. Setting Breakpoints Clicking on one of these dots in the Source Code View will set a breapoint at that line. Venkman will stop BEFORE the line executes. When a breakpoint is set, the margin will change to the letter "B", as in Figure 2. If you execute this code again after having set this breakpoint, Venkman will stop at line 81. (Note: By default, Venkman hides files file that appear to be part of the browser core; this includes extensions. To debug an extension, uncheck "Exclude Browser Files" on the...
...pear to be part of the browser core; this includes extensions. To debug an extension, uncheck "Exclude Browser Files" on the Debug menu and your installed extension files should appear in the Loaded Scripts list.) Venkman also indicates that one or more breakpoints have been set in the Loaded Scripts View, where red dots appear next to the files in which breakpoints have been set, along with the line number where the function begins whose code is being stopped. Using Breakpoints to Debug When you set a breakpoint, you give Venkman (or whatever debugger you're using) the opportunity to display information about the execution environment. One of the most important aspects of debugging a script or software program is the ability to examine variables--function return values, errors, counters, va...
... execution environment. One of the most important aspects of debugging a script or software program is the ability to examine variables--function return values, errors, counters, variable scopes--as they change over the course of the script execution. The onFlipX function in Figure 1, for example, uses the variable newSign to figure out what image to use for the fish. When you set a breakpoint at line 81, you can start animation on the web page in the browser window and see Venkman stop execution as it enters the onFlipX function. Stopped there, Venkman displays the value of the newSign variable as "1" in the Local Variables View. Using breakpoints and the Interactive View, you can change the values of the variables that Venkman displays (only in the context of the debugging environment itsel...
execute - Archive of obsolete content
et to true, specifies that the installation should wait for this executable to finish before processing the next queued install command. If you do not set this flag and launch an executable that is not a part of the installation, you will raise an error when you restart the browser. Passing Arguments to the Executable The args parameter, when present, passes a string to the executable as command-line parameters. The following line, for example, passes the "-c" command-line parameter to the executable: err = file.execute(myfile, "-c", true); When you want to pass more than one parameter to the executable itself, however, you must format the args string in a particular way so that the parameters can be broken up and passed separately as required. In general, you should use single quotes for t...
...The following parsing rules apply: Double quotes are treated as quotes; single quotes are ignored by the executable but legal in the execute() method. The outer quotes that frame the args string itself are stripped off when the string is passed to the executable. Quotes that are escaped, or "backslashed," are passed through the executable intact. ...
...uotes are treated as quotes; single quotes are ignored by the executable but legal in the execute() method. The outer quotes that frame the args string itself are stripped off when the string is passed to the executable. Quotes that are escaped, or "backslashed," are passed through the executable intact. All other backslashed cases are ignored. ...
...ed, or "backslashed," are passed through the executable intact. All other backslashed cases are ignored. This means that in order to pass three command-line arguments (-c, -d, and -s) to the executable, you should format the args string as follows: err = file.execute(myfile, '"-c""-d""-s"', true); //Technically, given the rules above, you could also pass the same //arguments with the following line, but the result is much less //readable: err = file.execute(myfile, "\"-c\"\"-d\"\"-s\"", true); Also see the note about binaries on the Macintosh platform in addFile. ...
List of commands - Archive of obsolete content
type) nsDomWindowController commands (generally legal when there is a selection): cmd_copy - copy a selection to the clipboard cmd_cut - cut a selection into the clipboard cmd_paste - paste a selection from the clipboard cmd_selectAll cmd_selectNone cmd_copyLink cmd_copyImageLocation cmd_copyImageContents cmd_scrollTop cmd_scrollBottom cmd_scrollPageUp cmd_scrollPageDown cmd_scrollLineUp cmd_scrollLineDown cmd_scrollLeft cmd_scrollRight cmd_selectCharPrevious cmd_selectCharNext cmd_wordPrevious cmd_wordNext cmd_selectWordPrevious cmd_selectWordNext cmd_beginLine cmd_endLine cmd_selectBeginLine cmd_selectEndLine cmd_selectLinePrevious cmd_selectLineNext cmd_selectPagePrevious cmd_selectPageNext cmd_selectMoveTop cmd_selectMoveBottom Editor commands (legal wh...
...selectLinePrevious cmd_selectLineNext cmd_selectPagePrevious cmd_selectPageNext cmd_selectMoveTop cmd_selectMoveBottom Editor commands (legal when the focus is anywhere where you can type text): cmd_paste - paste a selection from the clipboard cmd_pasteQuote cmd_delete cmd_deleteCharBackward cmd_deleteCharForward cmd_deleteWordBackward cmd_deleteWordForward cmd_deleteToBeginningOfLine cmd_deleteToEndOfLine cmd_scrollTop cmd_scrollBottom cmd_moveTop cmd_moveBottom cmd_selectTop cmd_selectBottom cmd_lineNext cmd_linePrevious cmd_selectLineNext cmd_selectLinePrevious cmd_charPrevious cmd_charNext cmd_selectCharPrevious cmd_selectCharNext cmd_beginLine cmd_endLine cmd_selectBeginLine cmd_selectEndLine cmd_wordPrevious cmd_wordNext cmd_selectWordPrevious cmd_...
...veTop cmd_moveBottom cmd_selectTop cmd_selectBottom cmd_lineNext cmd_linePrevious cmd_selectLineNext cmd_selectLinePrevious cmd_charPrevious cmd_charNext cmd_selectCharPrevious cmd_selectCharNext cmd_beginLine cmd_endLine cmd_selectBeginLine cmd_selectEndLine cmd_wordPrevious cmd_wordNext cmd_selectWordPrevious cmd_selectWordNext cmd_scrollPageUp cmd_scrollPageDown cmd_scrollLineUp cmd_scrollLineDown cmd_movePageUp cmd_movePageDown cmd_selectPageUp cmd_selectPageDown Other commands The following list other commands (prefixed by cmd_ or Browser:) which have not been categorized here yet (though they are in the alphabetical list below): http://lxr.mozilla.org/seamonkey/sou...barOverlay.xul http://lxr.mozilla.org/seamonkey/sou...t/navigator.js http://lxr.mozilla...
...innewtab cmd_bm_openinnewwindow cmd_bm_paste cmd_bm_properties cmd_bm_rename cmd_bm_selectAll cmd_bm_setnewbookmarkfolder cmd_bm_setnewsearchfolder cmd_bm_setpersonaltoolbarfolder cmd_bm_sortfolder cmd_bm_sortfolderbyname cmd_close cmd_closeOtherTabs cmd_closeWindow cmd_copy cmd_copyImage cmd_copyLink cmd_cut cmd_delete cmd_editPage cmd_findTypeLinks cmd_findTypeText cmd_goToLine cmd_handleBackspace cmd_handleShiftBackspace cmd_minimizeWindow cmd_newEditor cmd_newEditorDraft cmd_newEditorTemplate cmd_newNavigator cmd_newNavigatorTab cmd_newTabWithTarget cmd_openHelp cmd_paste - paste a selection from the clipboard cmd_printSetup cmd_quit cmd_redo cmd_savePage cmd_scrollPageDown cmd_scrollPageUp cmd_selectAll cmd_SwitchDocumentDirection cmd_switchTextDi...
Adding Style Sheets - Archive of obsolete content
method involves placing your files as part of a theme. Let's assume that we are building the find files dialog for themeability, because the find files dialog can be referred to with the URL chrome://findfile/content/findfile.xul so the style sheet file will be stored in chrome://findfile/skin/findfile.css. All the XUL examples so far have actually been using a style sheet already. The second line has always been: <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> This line indicates that we want to use the style provided by chrome://global/skin/. In Mozilla, this will be translated as the file global.css, which contains default style information for XUL elements. You could leave the line out and the elements will still work, however they will look fairly plain. The style she...
...ple would be when a script changes the style, or where a difference in layout might change the meaning of the element. However you should avoid this as much as possible. For installed files, you'll have to create or modify a manifest file and install the skin. Our Find Files Dialog Example Let's modify the find files dialog so that its style comes from a separate style file. First, the modifed lines of findfile.xul: <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> <?xml-stylesheet href="findfile.css" type="text/css"?> ... <spacer class="titlespace"/> <groupbox orient="horizontal"> <caption label="Search Criteria"/> <menulist id="searchtype"> <menupopup> <menuitem label="Name"/> <menuitem label="Size"/> <menuitem label="Da...
..."Is Not"/> </menupopup> </menulist> <spacer class="springspace"/> <menulist id="find-text" flex="1" editable="true" datasources="file:///mozilla/recents.rdf" ref="http://www.xulplanet.com/rdf/recent/all"/> ... <spacer class="titlespace"/> <hbox> <progressmeter id="progmeter" value="50%" style="display:none;"/> The new xml-stylesheet line is used to import the style sheet. It will contain the styles instead of having them directly in the XUL file. You can include any number of style sheets in a similar way. Here the style sheet is placed in the same directory as findfile.xul. Some of the styles in the code above have been removed. One that wasn't was the display property on the progressmeter. This will be changed by a script so ...
...hey could add or modify the style declarations by either modifying the file or by changing the skin. If the user changes the interface skin, the files in a directory other than default will be applied. Importing Style Sheets We've already seen how to import style sheets for use. An example is shown below: <?xml-stylesheet href="chrome://bookmarks/skin/" type="text/css"?> This might be the first lines of a bookmarks window. It imports the bookmarks style sheet, which is bookmarks.css. Mozilla's skin system is smart enough to figure out which style sheet to use, because the specific filename was not indicated here. We have done a similar thing with the global style sheet file (chrome://global/skin). A style sheet may import styles from another stylesheet using the import directive. Normally, y...
Using the Editor from XUL - Archive of obsolete content
copy/paste feature). This happens in response to MouseClick with button 2. It also forces an IME commit. nsTextEditorFocusListener Editor responds to Focus and Blur events by showing and hiding the caret or selection as appropriate. nsTextEditorTextListener The nsIDOMTextListener interface that this implements is used by the IME code. In response to the HandleText event, the editor sets the inline input composition string. nsTextEditorCompositionListener nsTextEditorCompositionListener implements another IME-related interface, nsIDOMCompositionListener. This is called by IME at the start, end, and to query the current composition. nsTextEditorDragListener The drag listener handles drag and drop events in the editor. It responds to the start of a drag in DragGesture by adding data to th...
...t is handled entirely by the rules code, in the WillDoAction()call. In Composer, we are using nsHTMLEditRules, so we end up in nsHTMLEditRules::WillDoAction(). For text insertion, this drops into nsHTMLEditRules::WillInsertText(). This code first deletes the selection if there is one (e.g. ...
...When handling key presses, this will just insert a single character. ...
...When handling key presses, this will just insert a single character. ...
XUL Accesskey FAQ and Policies - Archive of obsolete content
On Windows and UNIX, pressing ALT+A is a convenient way to push that button. On Macintosh, accesskeys are available only in HTML not in XUL, and they are activated using CTRL+letter instead of ALT. How is an accesskey added to a form control? An accesskey can be added to an HTML or XUL form control or label by using the accesskey attribute. ...
..., for purposes of internationalization. The above example should say: <button label="Apply instantly" accesskey="&applyInstantly.accesskey" /> (Always use accesskey instead of akey). If methods like confirm(), confirmEx() or prompt() are being used to create a dialog, use an & before the button or checkbox text to make the next character an accesskey. For example, "Do it &now" makes "n" the underlined accesskey. To insert a real ampersand, use &&. How do I pick an accesskey letter? Accesskey attribute is case sensitive! Notice that the difference between the button examples above is the case of the accesskey specified. Mozilla's accesskey implementation will first try to underline a letter of the same case, but if there isn't one it will fall back on a letter of the opposite case. Our...
...a real ampersand, use &&. How do I pick an accesskey letter? Accesskey attribute is case sensitive! Notice that the difference between the button examples above is the case of the accesskey specified. Mozilla's accesskey implementation will first try to underline a letter of the same case, but if there isn't one it will fall back on a letter of the opposite case. Our preference is to underline the first letter of one of the words, so it's important to be aware of this quirk. Avoid duplicates Don't use the same accesskey letter twice in the same window. Be especially careful of drop down menus in the same window. For example, in the Manage Bookmarks dialog, don't use F, E, V, T or H (File, Edit, View, Tasks, Help). Help wanted: it would be useful to have an automated t...
...File bugs under the Keyboard Navigation component, and make meta bug 129179 dependent on them. ...
The Implementation of the Application Object Model - Archive of obsolete content
pective. Purpose - The purpose of this document is two-fold. The first section of the document describes the motivation and reasoning behind using RDF as the foundation of XUL. This section makes a technical argument both for having XUL in the first place and for using RDF as the underlying implementation of XUL's content model. The second section describes the XUL/RDF architecture itself and outlines enhancements to the XUL language in order to allow the markup language to reference local data and to indicate how and when it would like to be annotatable with local data. The Case for the XUL/RDF Approach What is XUL? XUL (pronounced zool) used to be a ravening demon intent upon taking over the Earth in Ghost Busters. In recent years, XUL dropped the Z from its name and replaced it with a...
...hs, namely (1) redundancy of methods in the interfaces as well as a likely code redundancy in the implementation of some of those methods, and (2) the desire to be insulated from the layout DLL should those interfaces change, imply that a layer needs to exist between the pluggable content and the content tree interfaces. This layer would serve several useful functions. First of all it could streamline the redundancy in the interface methods and present a new interface for pluggable content that was much smaller and easier to plug into than the 4-5 interfaces required if directly implementing the content tree interfaces. Furthermore, should the content tree interfaces change, only this layer would need to be updated. The pluggable content, safe behind this layer, wouldn't have to change at all.
...implementation must necessarily reside in a different DLL, without introducing a code dependency between all pluggable content and the common base class. This inability to provide a cleanly inherited system argues for a different approach, namely that all content node implementations be the same kind of object, and that those objects communicate with their pluggable content through this new streamlined interface we talked about earlier. We'll call this new interface a pluggable data source. Just in case you still aren't convinced that all content nodes should be the same kind of element, consider another problem: how to implement aggregation. Suppose that a bookmarks folder contains a mailbox folder, a composer page template, and a bookmark. In order to achieve aggregation of data, a content n...
...to a local file to be reflected right in the XUL). Referencing local data: The LOCALDATA attribute A tag that references local RDF data does so by using the localData attribute, which gives the URI of the local data that should be merged in with the XUL content tree. Examples of tags that can reference local data are menu, menuitem, menubar, toolbox, toolbar, treebody, and treeitem. TODO: Outline the naming scheme for local data. Give an example once I actually know what the naming scheme will be. Talk to John McMullen about 5.0 preferences and figure out where LOCALDATA will need to be used (likely on every form element control) Talk to Steve Elmer. It's likely that this might be the desirable solution for buttons that observe preferences (like the HOME button) Denoting persistence o...
Common Firefox theme issues and solutions - Archive of obsolete content
To test this please go to bug 324777 using the default theme and activate the "click me" link. The URL bar of the resulting popup window is disabled. Address bar "door hangers" Door hanger sync panel not styled The sync panel at the bottom of the "door hanger" for the save password panel displayed...
...ensions/extensions.svg#greyscale"); opacity:0.3; } about:memory About:memory nodes do not collapse The styling of about:memory is a little messed up in that nodes do not collapse as they should when clicked on. To fix this issue you need to copy the following file from the latest version of Firefox to your theme: chrome://global/content/aboutMemory.css. about:permissions Domain names don't line up in about:permissions The domains on the domain list of about:permissions do not line up properly due to missing placeholder icons for domains without favicons. This issue is fixed by adding the following CSS instructions to the file browser/preferences/aboutPermissions.css: .site-favicon { height: 16px; width: 16px; -moz-margin-end: 4px; list-style-image: url("chrome://mozapps/skin/p...
....playButton[paused="true"] {...} .muteButton[muted="true"] {...} Error console warnings Unknown namespace for videocontrols.css The error console is reporting the following issue: Warning: Unknown namespace prefix 'html'. Ruleset ignored due to bad selector. Source file: chrome://global/skin/media/videocontrols.css The solution to this issue is to add the following name space to the second line of the file right after, and in addition to, the existing @namespace: @namespace html url("http://www.w3.org/1999/xhtml"); You can generate the error console message by going to Mozilla's Mission page. If you are using the extension Console2 you can easily filter out content related messages to see just chrome issues. Warning: Unknown Property (Obsolete CSS Rules) -moz-border-radius Firefox ...
...ted by Firefox since Firefox 4). -moz-box-shadow Firefox no longer supports -moz-box-shadow style property. Use CSS standard box-shadow property instead (supported by Firefox since Firefox 4). -moz-transition Firefox no longer supports -moz-transition style property. Use CSS standard transition property instead (supported by Firefox since Firefox 4). Resources AMO Editors Theme Testing Guidelines When developing and testing your themes, please refer to the theme testing guidelines AMO editors use to review themes. This guide will help you thoroughly test your theme to find and fix issues before you push updates to AMO. This is document is a work in progress so feedback and/or suggestions is appreciated. MDN CSS Reference Mozilla's Developer Network maintains a great CSS reference. AM...
Browser Feature Detection - Archive of obsolete content
true cssfloat true false true font true true true fontfamily true true true fontsize true true true fontstyle true true true fontvariant true true true fontweight true true true height true true true letterspacing true true true lineheight true true true liststyle true true true liststyleimage true true true liststyleposition true true true liststyletype true true true margin true true true margintop true true true marginright true true true marginbottom true true true ...
... fontstretch true false true left true true true markeroffset true false true marks true false true maxheight true ie7 only true maxwidth true ie7 only true minheight true true true minwidth true ie7 only true orphans true false true outline true false true outlinecolor true false true outlinestyle true false true outlinewidth true false true overflow true true true page true false true pagebreakafter true true true pagebreakbefore true true true pagebreakinside true false true ...
...se}, {name: 'cssFloat', 'supported': false}, {name: 'font', 'supported': false}, {name: 'fontFamily', 'supported': false}, {name: 'fontSize', 'supported': false}, {name: 'fontStyle', 'supported': false}, {name: 'fontVariant', 'supported': false}, {name: 'fontWeight', 'supported': false}, {name: 'height', 'supported': false}, {name: 'letterSpacing', 'supported': false}, {name: 'lineHeight', 'supported': false}, {name: 'listStyle', 'supported': false}, {name: 'listStyleImage', 'supported': false}, {name: 'listStylePosition', 'supported': false}, {name: 'listStyleType', 'supported': false}, {name: 'margin', 'supported': false}, {name: 'marginTop', 'supported': false}, {name: 'marginRight', 'supported': false}, {name: 'marginBottom', 'supported': false}, {name...
...false}, {name: 'fontStretch', 'supported': false}, {name: 'left', 'supported': false}, {name: 'markerOffset', 'supported': false}, {name: 'marks', 'supported': false}, {name: 'maxHeight', 'supported': false}, {name: 'maxWidth', 'supported': false}, {name: 'minHeight', 'supported': false}, {name: 'minWidth', 'supported': false}, {name: 'orphans', 'supported': false}, {name: 'outline', 'supported': false}, {name: 'outlineColor', 'supported': false}, {name: 'outlineStyle', 'supported': false}, {name: 'outlineWidth', 'supported': false}, {name: 'overflow', 'supported': false}, {name: 'page', 'supported': false}, {name: 'pageBreakAfter', 'supported': false}, {name: 'pageBreakBefore', 'supported': false}, {name: 'pageBreakInside', 'supported': false}, {name: 'pa...
-ms-filter - Archive of obsolete content
tions Reference for details. 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 exa...
...entType=' <integer> <StartColor> = 'StartColor=' <color> <StartColorStr> = 'StartColorStr=' <color> Enabled Default: true Set to false to disable. EndColor The end color, supports only opaque colors in the #RRGGBB notation. EndColorStr The end color, supports both opaque colors (#RRGGBB) and colors with alpha opacity using the #AARRGGBB notation. GradientType Default: 0 (equivalent to linear-gradient(to bottom, ...)) Set to a non-zero value to make the gradient horizontal (equivalent to linear-gradient(to right, ...)) StartColor The end color, supports only opaque colors in the #RRGGBB notation. StartColorStr The end color, supports both opaque colors (#RRGGBB) and colors with alpha opacity using the #AARRGGBB notation. HTML <div class="gradient horizontal"></div> <div clas...
...RRGGBB notation. HTML <div class="gradient horizontal"></div> <div class="gradient vertical"></div> CSS html, body { overflow-x: hidden; max-width: 100vw; } .gradient { width: 100vw; height: 60px; height: 50vh; } .gradient.horizontal { -ms-filter: 'progid:DXImageTransform.Microsoft.Gradient(startColorStr="#ffffff", endColorStr="#000000", GradientType=1)'; background-image: linear-gradient(to right, #ffffff 0%, #000000 100%); } .gradient.vertical { -ms-filter: 'progid:DXImageTransform.Microsoft.Gradient(startColorStr="#ffffff", endColorStr="#000000", GradientType=0)'; background-image: linear-gradient(to bottom, #ffffff 0%, #000000 100%); } Result Specifications Not part of any specification. Initial value"" (the empty string)Applies toall elementsInheritedno...
...When you use -ms-filter, enclose the progid in single quotes (') or double quotes ("). Use commas (,) to separate multiple values, as shown...
-ms-wrap-flow - Archive of obsolete content
The -ms-wrap-flow CSS property is a Microsoft extension that specifies how exclusions impact inline content within block-level elements. Initial valueautoApplies toblock-level elementsInheritednoComputed valueas specifiedAnimation typediscrete Syntax Values auto For floated elements, an exclusion is created; for all other elements, an exclusion is not created. both Inline flow content can flow on all sides of the exclusion. start Inline flow content can wrap on the start edge of the exclusion area but must leave empty the area after the end edge of the exclusion area. ...
...ueas specifiedAnimation typediscrete Syntax Values auto For floated elements, an exclusion is created; for all other elements, an exclusion is not created. both Inline flow content can flow on all sides of the exclusion. start Inline flow content can wrap on the start edge of the exclusion area but must leave empty the area after the end edge of the exclusion area. end Inline flow content can wrap after the end edge of the exclusion area but must leave empty the area before the start edge of the exclusion area. ...
...ted. both Inline flow content can flow on all sides of the exclusion. start Inline flow content can wrap on the start edge of the exclusion area but must leave empty the area after the end edge of the exclusion area. end Inline flow content can wrap after the end edge of the exclusion area but must leave empty the area before the start edge of the exclusion area. maximum Inline flow content can wrap on the side of the exclusion with the largest available space for the given line, and must leave empty the other side of the exclusion. clear Inline flow content can only wrap on top and bottom of the exclusion and must leave empty the areas to the start and end edges of the exclusion box. Formal syntax auto | both | start | end | maximum | clear Specifications ...
...reas to the start and end edges of the exclusion box. Formal syntax auto | both | start | end | maximum | clear Specifications Not part of any specification. Remarks The -ms-wrap-flow property makes an element an exclusion element when it has a computed value other than auto. This property specifies that the exclusion element (the exclusion) can be positioned in various ways, and that inline content will wrap around the exclusion in a way similar to how it wraps around floated elements. When the -ms-wrap-flow property's computed value is auto, the element does not become an exclusion element unless its float property's computed value is not none. In that case, the element contributes its border box to its containing block's wrapping context and content flows around it according to t...
::-ms-expand - Archive of obsolete content
...
... ...
... ...
... ...
::-ms-fill - Archive of obsolete content
dots that flow in a ring pattern. Allowable Properties Only the following CSS properties can be used in a rule with ::-ms-fill in its selector. Other properties are ignored. ...
...l in its selector. Other properties are ignored. ...
...or. Other properties are ignored. ...
...s are ignored. ...
CSS - Archive of obsolete content
Archive › Web › CSS
e been set in high contrast mode.-ms-hyphenate-limit-charsThe -ms-hyphenate-limit-chars CSS property is a Microsoft extension that specifies one to three values indicating the minimum number of characters in a hyphenated word. ...
...ode.-ms-hyphenate-limit-charsThe -ms-hyphenate-limit-chars CSS property is a Microsoft extension that specifies one to three values indicating the minimum number of characters in a hyphenated word. ...
...tension that specifies one to three values indicating the minimum number of characters in a hyphenated word. If the word does not meet the required minimum number of characters in the word, before the hyphen, or after the hyphen, then the word is not hyphenated.-ms-hyphenate-limit-linesThe -ms-hyphenate-limit-lines CSS property is a Microsoft extension specifying the maximum number of consecutive lines in an element that may be ended with a hyphenated word.-ms-hyphenate-limit-zoneThe -ms-hyphenate-limit-zone CSS property is a Microsoft extension specifying the width of the hyphenation zone.-ms-ime-alignThe -ms-ime-align CSS property is a Microsoft extension aligning the Input Method Editor (IME) candidate window box relative to the element on which the IME composition is active. The extension ...
...autospaceThe -ms-text-autospace CSS property is a Microsoft extension that specifies the autospacing and narrow space width adjustment of text.-ms-touch-selectThe -ms-touch-select CSS property is a Microsoft extension that toggles the gripper visual elements that enable touch text selection.-ms-wrap-flowThe -ms-wrap-flow CSS property is a Microsoft extension that specifies how exclusions impact inline content within block-level elements.-ms-wrap-marginThe -ms-wrap-margin CSS property is a Microsoft extension that specifies a margin that offsets the inner wrap shape from other shapes.-ms-wrap-throughThe -ms-wrap-through CSS property is a Microsoft extension that specifies how content should wrap around an exclusion element.:-moz-full-screen-ancestorThe :-moz-full-screen-ancestor CSS pseudo-clas...
Back to the Server: Server-Side JavaScript On The Rise - Archive of obsolete content
SQL statement is prepared, executed, and printed with the help of the metadata obtained from the resultset. Sample output is shown in Listing 2. id: 1 first_name: Sammy last_name: Hamm department: IT title: Network Administrator ---------- id: 2 first_name: Nigel last_name: Bitters department: Finance title: Accounting Manager ... It's clear to see that with just a few lines of code, we can easily take advantage of SQL data stores in JavaScript. The sample script in Listing 1 could be factored out to it's own function to retrieve the set of employee information, or abstracted further into a more generic data handler class. Next we'll take a look at another powerful feature in Rhino, E4X processing. E4X (ECMAScript for XML) is an extension of...
... below details a script used to process an RSS feed from the Mozilla website. ...
...per namespaces are defined for this particular resource. The default namespace is defined along with two others, in particular dc and rdf. Defining these namespaces becomes important if we want to be able to access any data elements in the feed defined in these namespaces. The act of creating an E4X object is quite simple, in the case of Listing 3, we do this through the line var x = new XML( str ); From here, the XML is accessible via dot notation. Notice during the processing of the item element where we use the rdf and dc namespace to access the about attribute of the item element, and the date element respectively. The syntax for accessing E4X objects is actually quite natural and certainly easier than most methods...
...SQLite database which is included in Jaxer, or a mySQL database, and is extensible to others. Much like the file I/O namespace, database access in Jaxer can be as simple or complicated as you want or need it to be. For debugging, Jaxer will also send database errors to the client if you want. Upgrading the example application to include database access requires just a few lines of code added to the formProcessor method. Listing 9 demonstrates these changes. Listing 9 - Jaxer database access <script runat="server"> function formProcessor( name, email, message ) { // perform the same validation of the data server-side if( !validateComments( name, email, message ) ) { throw "Incomplete data was submitted."; } // assemble the string var...
XForms Group Element - Archive of obsolete content
controls, groups, switches, repeats and host language content) within a non-relevant group are handled as non-relevant. ...
... repeats and host language content) within a non-relevant group are handled as non-relevant. If a group is non-relevant, then the rendering approach used to signify non-relevance is applied to the entire content of the group. ...
...in a non-relevant group are handled as non-relevant. If a group is non-relevant, then the rendering approach used to signify non-relevance is applied to the entire content of the group. ...
...handled as non-relevant. If a group is non-relevant, then the rendering approach used to signify non-relevance is applied to the entire content of the group. Representations The group element doesn't have visual presentation. ...
3D games on the Web - Game development
lot more with WebGL. There are some advanced concepts which you should dive into and learn more about -- like shaders, collision detection, or the latest hot topic: virtual reality on the web. Shaders It's worth mentioning shaders, which are a separate story on their own. Shaders use GLSL, a special OpenGL shading language, with syntax similar to C, that is executed directly by the graphics pipeline. They can be split into vertex shaders and fragment shaders (or pixel shaders) -- the former transforms shape positions to real 3D drawing coordinates, while the latter computes rendering colors and other attributes. You should definitely check out GLSL Shaders article to learn more about them. Collision detection It's hard to imagine a game without collision detection -- we always need to work...
...t is taken care of by the tools you use, so you can focus on building the game itself. The most popular JavaScript 3D library is Three.js, a multi-purpose tool that makes common 3D techniques simpler to implement. There are other popular game development libraries and frameworks worth checking too; A-Frame, PlayCanvas and Babylon.js are among the most recognizable ones with rich documentation, online editors and active communities. Building up a basic demo with A-Frame A-Frame is a web framework for building 3D and VR experiences. Under the hood, it is a Three.js framework with a declarative entity-component pattern, meaning we can build scenes with just HTML. See the Building up a basic demo with A-Frame subpage for the step-by-step process of creating the demo. Building up a basic demo w...
...lp you implement common 3D functionality more quickly. See the Building up a basic demo with Babylon.js subpage for the basics of using Babylon.js, including setting up a development environment, structuring the necessary HTML, and writing the JavaScript code. ...
...turing the necessary HTML, and writing the JavaScript code. Building up a basic demo with PlayCanvas PlayCanvas is a popular 3D WebGL game engine open-sourced on GitHub, with an editor available online and good documentation. 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. Building up a basic demo with Three.js Three.js, like any other library, gives you a huge advantage: instead of writing hundreds of lines of WebGL code to build anything interesting you can use built-in helper functions to do it a lot easier and faster. See the Building up a basic demo with Three.js subpage for the step-by-step process of creating the demo. Other tools Both Unity and ...
Paddle and keyboard controls - Game development
ed. Two event listeners for keydown and keyup events. We want to run some code to handle the paddle movement when the buttons are pressed. Two functions handling the keydown and keyup events the code that will be run when the buttons are pressed. The ability to move the paddle left and right Pressed buttons can be defined and initialized with boolean variables like in the example. ...
... left and right Pressed buttons can be defined and initialized with boolean variables like in the example. Add these lines somewhere near the rest of your variables: var rightPressed = false; var leftPressed = false; The default value for both is false because at the beginning the control buttons are not pressed. To listen for key presses, we will set up two event listeners. Add the following lines just above the setInterval() line at the bottom of your JavaScript: document.addEventListener("keydown", keyDownHandler, false); document.addEventListener("keyup", keyUpHandler, false); When the keydown event is fired on any of the keys on your keyboard (when they are pressed), the keyDownHandler() function will be executed. The same pattern is true for the second listener: keyup events will f...
...alse); document.addEventListener("keyup", keyUpHandler, false); When the keydown event is fired on any of the keys on your keyboard (when they are pressed), the keyDownHandler() function will be executed. The same pattern is true for the second listener: keyup events will fire the keyUpHandler() function (when the keys stop being pressed). ...
...will move between 0 on the left side of the canvas and canvas.width-paddleWidth on the right hand side, which will work exactly as we want it to. Add the above code block into the draw() function at the bottom, just above the closing curly brace. The only thing left to do now is call the drawPaddle() function from within the draw() function, to actually print it on the screen. Add the following line inside your draw() function, just below the line that calls drawBall(): drawPaddle(); Compare your code Here's the working code for you to compare yours against: Exercise: Make the paddle move faster or slower, or change its size. Next steps Now we have something resembling a game. The only trouble now is that you can just continue hitting the ball with the paddle forever. This will al...
2D maze game with device orientation - Game development
ial. Example game By the end of the tutorial you will have a fully functional demo game: Cyber Orb. It will look something like this: Phaser framework Phaser is a framework for building desktop and mobile HTML5 games. It's quite new, but growing rapidly thanks to the passionate community involved in the development process. You can check it out on GitHub where it's open sourced, read the online documentation and go through the big collection of examples. The Phaser framework provides you with a set of tools that will speed up development and help handle generic tasks needed to complete the game, so you can focus on the game idea itself. Starting with the project You can see Cyber Orb source code on GitHub. The folder structure is quite straightforward: the starting point is the index.
...e', Ball.Game); game.state.start('Boot'); })(); </script> </body> </html> So far we have a simple HTML website with some basic content in the <head> section: charset, title, CSS styling and the inclusion of the JavaScript files. The <body> contains initialization of the Phaser framework and the definitions of the game states. var game = new Phaser.Game(320, 480, Phaser.CANVAS, 'game'); The line above will initialize the Phaser instance -- the arguments are the width of the Canvas, height of the Canvas, rendering method (we're using CANVAS, but there are also WEBGL and AUTO options available) and the optional ID of the DOM container we want to put the Canvas in. If there's nothing specified in that last argument or the element is not found, the Canvas will be added to the <body> tag. Wit...
...0' height='480'></canvas> The important thing to remember is that the framework is setting up helpful methods to speed up a lot of things like image manipulation or assets management, which would be a lot harder to do manually. Note: You can read the Building Monster Wants Candy article for the in-depth introduction to the basic Phaser-specific functions and methods. Back to game states: the line below is adding a new state called Boot to the game: game.state.add('Boot', Ball.Boot); The first value is the name of the state and the second one is the object we want to assign to it. The start method is starting the given state and making it active. Let's see what the states are actually. Managing game states The states in Phaser are separate parts of the game logic; in our case we're loa...
...you can see we're incrementing the this.timer variable and updating the content of the text objects with the current values on each iteration, so the player sees the elapsed time. Finishing the level and the game The ball is rolling on the screen, the timer is working and we have the hole created that we have to reach. Now let's set up the possibility to actually finish the level! The following line in the update() function adds a listener that fires when the ball gets to the hole. this.physics.arcade.overlap(this.ball, this.hole, this.finishLevel, null, this); This works similarly to the collide method explained earlier. When the ball overlaps with the hole (instead of colliding), the finishLevel function is executed: finishLevel: function() { if(this.level >= this.maxLevels) { ...
A cool-looking box - Learn web development
box model and other box-related features such as borders and backgrounds. Starting point To get this assessment started, you should: Make local copies of the starting HTML and CSS -- save them as index.html and style.css in a new directory. Alternatively, you could use a site like JSBin or Glitch to do your assessment. You could paste the HTML and fill in the CSS into one of these online editors. If the online editor you are using doesn't have a separate CSS panel, feel free to put it in a <style> element in the head of the document. Note: If you get stuck, then ask us for help -- see the Assessment or further help section at the bottom of this page. Project brief Your task is to create a cool, fancy box and explore the fun we can have with CSS. General tasks Apply the C...
...ease in font size, to around 17-18 pixel computed style. Use rems. Write a comment about how you worked out the value. A base color for the design. Give the box this color as its background color. The same color for the text; make it readable using a black text shadow. A fairly subtle border radius. A 1-pixel solid border with a color similar to the base color, but a slightly darker shade. A linear semi-transparent black gradient that goes toward the bottom right corner. Make it completely transparent at the start, gradiating to around 0.2 opacity by 30% along, and remaining at the same color until the end. Multiple box shadows. Give it one standard box shadow to make the box look slightly raised off the page. The other two should be inset box shadows -- a semi-transparent white shadow n...
...hadows -- a semi-transparent white shadow near the top left and a semi-transparent black shadow near the bottom right -- to add to the nice raised 3D look of the box. 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. Write a post asking for assessment and/or help at the MDN Discourse forum Learning category. Your post should include: A descriptive title such as "Assessment wanted for Cool-looking box". Details of what you have already tried, and what you would like us to do, e.g. if you are stuck and need help, or want an assessment. A link t...
...ite a post asking for assessment and/or help at the MDN Discourse forum Learning category. Your post should include: A descriptive title such as "Assessment wanted for Cool-looking box". Details of what you have already tried, and what you would like us to do, e.g. if you are stuck and need help, or want an assessment. A link to the example you want assessed or need help with, in an online shareable editor (as mentioned in step 1 above). This is a good practice to get into -- it's very hard to help someone with a coding problem if you can't see their code. A link to the actual task or assessment page, so we can find the question you want help with. ...
Creating fancy letterheaded paper - Learn web development
Prerequisites: Before attempting this assessment you should have already worked through all the articles in this module. Objective: To test comprehension of CSS box model, and other box-related features such as implementing backgrounds. ...
...ing point To get this assessment started, you should: Make local copies of the HTML and CSS -- save them as index.html and style.css in a new directory. Save local copies of the top, bottom and logo images in the same directory as your code files. Alternatively, you could use a site like JSBin or Glitch to do your assessment. You could paste the HTML and fill in the CSS into one of these online editors. If the online editor you are using doesn't have a separate CSS panel, feel free to put it in a <style> element in the head of the document. Note: If you get stuck, then ask us for help -- see the Assessment or further help section at the bottom of this page. Project brief You have been given the files needed to create a letterheaded paper template. You just need to put the files tog...
...ond one, whereas newer browsers will apply the first one, then override it with the second one. Feel free to create your own graphics for the assessment if you wish. 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. Write a post asking for assessment and/or help at the MDN Discourse forum Learning category. Your post should include: A descriptive title such as "Assessment wanted for Creating fancy letterheaded paper". Details of what you have already tried, and what you would like us to do, e.g. if you are stuck and need help, or want an assess...
... for assessment and/or help at the MDN Discourse forum Learning category. Your post should include: A descriptive title such as "Assessment wanted for Creating fancy letterheaded paper". Details of what you have already tried, and what you would like us to do, e.g. if you are stuck and need help, or want an assessment. A link to the example you want assessed or need help with, in an online shareable editor (as mentioned in step 1 above). This is a good practice to get into -- it's very hard to help someone with a coding problem if you can't see their code. A link to the actual task or assessment page, so we can find the question you want help with. ...
Test your skills: Images and Form elements - Learn web development
If you get stuck, then ask us for help -- see the Assessment or further help section at the bottom of this page. ...
...Task One In this task, you have an image that is overflowing the box. We want the image to scale down to fit inside the box without any extra white space, but we do not mind if some part of the image is cropped. In the example below see if you can match the image above. For assessment or further work purposes, download the starting point for this task to work in your own editor or in an online editor. Task Two In this task, you have a simple form. Your task is to make the following changes to the way this form looks: Use attribute selectors to target the search field and button inside .myform. Make the form field and button use the same text size as the rest of the form. Give the form field and button 10 px of padding. Give the button a purple background (I used rebeccapurple)...
...e rest of the form. Give the form field and button 10 px of padding. Give the button a purple background (I used rebeccapurple), white foreground, no border and rounded corners of 5px. Try updating the live code below to recreate the example as displayed in the image: For assessment or further work purposes, download the starting point for this task to work in your own editor or in an online editor. Assessment or further help You can practice these examples in the Interactive Editors mentioned above. If you would like your work assessed, or are stuck and want to ask for help: Put your work into an online shareable editor such as CodePen, jsFiddle, or Glitch. You can write the code yourself, or use the starting point files linked to in the above sections. Write a post asking f...
...t asking for assessment and/or help at the MDN Discourse forum Learning category. Your post should include: A descriptive title such as "Assessment wanted for Images skill test 1". Details of what you have already tried, and what you would like us to do, e.g. if you are stuck and need help, or want an assessment. A link to the example you want to be assessed or need help with, in an online shareable editor (as mentioned in step 1 above). This is a good practice to get into -- it's very hard to help someone with a coding problem if you can't see their code. A link to the actual task or assessment page, so we can find the question you want help with. ...
Test your skills: backgrounds and borders - Learn web development
If you get stuck, then ask us for help -- see the Assessment or further help section at the bottom of this page. ...
...orners of 10px. Add a background image (use the URL balloons.jpg) and size it so that it covers the box. Give the <h2> a semi-transparent black background color, and make the text white. The finished example should look like the image below. Try updating the live code below to recreate the finished example: Download the starting point for this task to work in your own editor or in an online editor. Backgrounds and Borders 2 In this task we want you to add background images, a border, and some other styling to a decorative box: Give the box a 5px lightblue border, and round the top left corner 20px and the bottom right corner 40px The heading uses the star.png image as a background image, with a single centered star on the left and a repeating pattern of stars on the right. M...
... of stars on the right. Make sure that the heading text does not overlay the image, and that it is centered -- you will need to use techniques learned in previous lessons to achieve this. The finished example should look like the image below: Try updating the live code below to recreate the finished example: Download the starting point for this task to work in your own editor or in an online editor. Assessment or further help You can practice these examples in the Interactive Editors above. If you would like your work assessed, or are stuck and want to ask for help: Put your work into an online shareable editor such as CodePen, jsFiddle, or Glitch. You can write the code yourself, or use the starting point files linked to in the above sections. Write a post asking for assessm...
... MDN Discourse forum. Add the "learning" tag to your post so we are able to more easily find it. Your post should include: A descriptive title such as "Assessment wanted for Flexbox layout 1 skill test". Details of what you would like us to do -- for example what you have already tried, if you are stuck and need help,. A link to the example you want assessed or need help with, in an online editor. This is a good practice to get into -- it's very hard to help someone with a coding problem if you can't see their code. A link to the actual task or assessment page, so we can find the question you want help with. ...
Legacy layout methods - Learn web development
helpful to you if you need to create fallback code for browsers that do not support newer methods, in addition to allowing you to work on existing projects which use these types of systems. It is worth bearing in mind, as we explore these systems, that none of them actually create a grid in the way that CSS Grid Layout creates a grid. They work by giving items a size, and pushing them around to line them up in a way that looks like a grid. A two column layout Let's start with the simplest possible example -- a two column layout. You can follow along by creating a new index.html file on your computer, filling it with a simple HTML template, and inserting the below code into it at the appropriate places. At the bottom of the section you can see a live example of what the final code should lo...
...can you implement an offset-by-two class? Floated grid limitations When using a system like this you do need to take care that your total widths add up correctly, and that you don't include elements in a row that span more columns than the row can contain. Due to the way floats work, if the number of grid columns becomes too wide for the grid, the elements on the end will drop down to the next line, breaking the grid. Also bear in mind that if the content of the elements gets wider than the rows they occupy, it will overflow and look a mess. The biggest limitation of this system is that it is essentially one dimensional. We are dealing with columns, and spanning elements across columns, but not rows. It is very difficult with these older layout methods to control the height of elements wi...
... rows in order to allow us to have elements that add up to less than 100%. We set that container to display: flex. On .col we set the flex property's first value (flex-grow) to 1 so our items can grow, the second value (flex-shrink) to 1 so the items can shrink, and the third value (flex-basis) to auto. As our element has a width set, auto will use that width as the flex-basis value. On the top line we get twelve neat boxes on the grid and they grow and shrink equally as we change the viewport width. On the next line, however, we only have four items and these also grow and shrink from that 60px basis. With only four of them they can grow a lot more than the items in the row above, the result being that they all occupy the same width on the second row. To fix this we still need to include...
...padding: 0 20px; box-sizing: border-box; } Elements can only be part of the grid if they are inside a row, so as with our earlier example we need an additional <div> or other element with a class of row nested between the content <div> and our actual content container <div>s. We've done this already as well. Now let's lay out the container boxes. Skeleton is based on a 12 column grid. The top line boxes all need classes of one column to make them span one column. 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 s...
Test your skills: position - Learn web development
The aim of this task is to get you working with the CSS position property and values covered in our lesson on Position. You will be working through two small tasks which use different elements of the material you have just covered. Note: You can try out solutions in the interactive editors below, however it may be helpful to download the code and use an online tool such as CodePen, jsFiddle, or Glitch to work on the tasks. If you get stuck, then ask us for help -- see the Assessment or further help section at the bottom of this page. Positioning One In this task you need to position the item with a class of target to the top and right of the container, which has the 5px grey border. Try updating the live code below to recreate the finished example: As an extra challenge, can y...
...you need to position the item with a class of target to the top and right of the container, which has the 5px grey border. Try updating the live code below to recreate the finished example: As an extra challenge, can you change the target to display underneath the text? For assessment or further work purposes, download the starting point for this task to work in your own editor or in an online editor. Position Two In the below example if you scroll the box the sidebar scrolls with the content. Change it so that the sidebar stays in place and only the content scrolls. Try updating the live code below to recreate the finished example: For assessment or further work purposes, download the starting point for this task to work in your own editor or in an online editor. Assessmen...
...You can write the code yourself, or use the starting point files linked to in the above sections. ...
... post asking for assessment and/or help at the MDN Discourse forum Learning category. Your post should include: A descriptive title such as "Assessment wanted for Position skill test 1". Details of what you have already tried, and what you would like us to do, e.g. if you are stuck and need help, or want an assessment. A link to the example you want assessed or need help with, in an online shareable editor (as mentioned in step 1 above). This is a good practice to get into -- it's very hard to help someone with a coding problem if you can't see their code. A link to the actual task or assessment page, so we can find the question you want help with. ...
What are browser developer tools? - Learn web development
most-to-least-specific. Click the checkboxes next to each declaration to see what would happen if you removed the declaration. Click the little arrow next to each shorthand property to show the property's longhand equivalents. Click a property name or value to bring up a text box, where you can key in a new value to get a live preview of a style change. Next to each rule is the file name and line number the rule is defined in. Clicking that rule causes the dev tools to jump to show it in its own view, where it can generally be edited and saved. You can also click the closing curly brace of any rule to bring up a text box on a new line, where you can write a completely new declaration for your page. You'll notice a number of clickable tabs at the top of the CSS Viewer: Computed: This...
...on Firefox. File list The first pane on the left contains the list of files associated with the page you are debugging. Select the file you want to work with from this list. Click on a file to select it and view its contents in the center pane of the Debugger. Source code Set breakpoints where you want to pause execution. In the following image, the highlight on the number 18 shows that the line has a breakpoint set. Watch expressions and breakpoints The right-hand pane shows a list of the watch expressions you have added and breakpoints you have set. In the image, the first section, Watch expressions, shows that the listItems variable has been added. You can expand the list to view the values in the array. The next section, Breakpoints, lists the breakpoints set on the page. In ex...
...e listItems variable has been added. You can expand the list to view the values in the array. The next section, Breakpoints, lists the breakpoints set on the page. In example.js, a breakpoint has been set on the statement listItems.push(inputNewItem.value); The final two sections only appear when the code is running. The Call stack section shows you what code was executed to get to the current line. You can see that the code is in the function that handles a mouse click, and that the code is currently paused on the breakpoint. The final section, Scopes, shows what values are visible from various points within your code. For example, in the image below, you can see the objects available to the code in the addItemClick function. Find out more Find more out about the JavaScript debugger i...
... see the objects available to the code in the addItemClick function. Find out more Find more out about the JavaScript debugger in different browsers: Firefox JavaScript Debugger Microsoft Edge Debugger Chrome Debugger Safari Debugger The JavaScript console The JavaScript console is an incredibly useful tool for debugging JavaScript that isn't working as expected. It allows you to run lines of JavaScript against the page currently loaded in the browser, and reports the errors encountered as the browser tries to execute your code. To access the console in any browser: If the developer tools are already open, click or press the Console tab. If not, Firefox allows you to open the console directly using Ctrl + Shift + K or using the menu command: Menu ? Web Developer ? Web Console, ...
Other form controls - Learn web development
Previous Overview: Forms Next We now look at the functionality of non-<input> form elements in detail, from other control types such as drop-down lists and multi-line text fields, to other useful form features such as the <output> element (which we saw in action in the previous article), and progress bars. Prerequisites: Basic computer literacy, and a basic understanding of HTML. Objective: To understand the non-<input> form features, and how to implement them using HTML. ...
...ontrol types such as drop-down lists and multi-line text fields, to other useful form features such as the <output> element (which we saw in action in the previous article), and progress bars. Prerequisites: Basic computer literacy, and a basic understanding of HTML. Objective: To understand the non-<input> form features, and how to implement them using HTML. Multi-line text fields A multi-line text field is specified using a <textarea> element, rather than using the <input> element. <textarea cols="30" rows="8"></textarea> This renders like so: The main difference between a <textarea> and a regular single line text field is that users are allowed to include hard line breaks (i.e. pressing return) that will be included when the data is submitted. <textare...
...size of the text area. 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. Note: You can find a slightly more interesting example of text area usage in the example we put together in the first article of the series (see the source code also). Controlling multi-line rendering <textarea> accepts three attributes to control its rendering across several lines: cols Specifies the visible width (columns) of the text control, measured in average character widths. This is effectively the starting width, as it can be changed by resizing the <textarea>, and overriden using CSS. The default value if none is specified is 20. rows Specifies the number of visible ...
...endered texts are wrapped, and off, which stops wrapping. Controlling textarea resizability The ability to resize a <textarea> is controlled with the CSS resize property. Its possible values are: both: The default -- allows resizing horizontally and vertically. horizontal: Allows resizing only horizontally. vertical: Allows resizing only vertically. none: Allows no resizing. block and inline: Experimental values that allow resizing in the block or inline direction only (this varies depending on the directionality of your text; read Handling different text directions if you want to find out more.) Play with the interactive example at the top of the resize reference page for a demonstration of how these work. Drop-down controls Drop-down controls are a simple way to let users selec...
Styling web forms - Learn web development
do need to take extra care to ensure we don't break usability. Not all widgets are created equal when CSS is involved At present, some difficulties remain when using CSS with forms. These problems can be divided into three categories: The good Some elements can be styled with few if any problems across platforms. ...
...qual when CSS is involved At present, some difficulties remain when using CSS with forms. These problems can be divided into three categories: The good Some elements can be styled with few if any problems across platforms. These include the following elements: <form> <fieldset> and <legend> Single-line text <input>s (e.g. type text, url, email...), except for <input type="search">. Multi-line <textarea>s Buttons (both <input> and <button>s) <label> <output> The bad Some elements are more difficult to style, requiring more complex CSS or some more specific tricks: Checkboxes and radio buttons <input type="search"> We describe how to handle these more specific features in the article Advanced form styling. The ugly Some elements can't be styled thoroughly using CSS. These ...
...%; background : none; } When one of these fields gains focus, we highlight them with a light grey, transparent, background (it is always important to have focus style, for usability and keyboard accessibility): input:focus, textarea:focus { background : rgba(0,0,0,.1); border-radius: 5px; } Now that our text fields are complete, we need to adjust the display of the single and multiple line text fields to match, since they won't typically look the same using the defaults. Tweaking the textareas <textarea> elements default to being rendered as an inline-block element. The two important things here are the resize and overflow properties. While our design is a fixed-size design, and we could use the resize property to prevent users from resizing our multi-line text field, it is best ...
... Test your skills! You've reached the end of this article, but can you remember the m...
Publishing your website - Learn web development
What are the options? Publishing a website is a complex topic because there are many ways to go about it. This article doesn't attempt to document all the possible methods. Instead, it explains the advantages and disadvantages of three approaches that are practical for beginners. ...
... rented file space on a hosting company's web server. You put website files on the web server. The web server provides website content to website visitors. A domain name is the unique address where people find your website, such as http://www.mozilla.org or http://www.bbc.co.uk. You can rent your domain name for as many years as you want from a domain registrar. Many professional websites go online this way. In addition, you will need a File Transfer Protocol (FTP) program (see How much does it cost: software for more details) to actually transfer the website files over to the server. FTP programs vary widely, but generally, you have to connect to your web server using details provided by your hosting company (typically username, password, hostname). Then the program shows you your local ...
...may provide some limited hosting for a small website. The available feature set will be limited, but it might be perfect for your first experiments. There are also free services available like Neocities, Blogger, and WordPress. Sometimes you get what you pay for, but sometimes these resources are good enough for your initial experiments. Many companies provide hosting and domains. Using an online tool like GitHub or Google App Engine Some tools let you publish your website online: GitHub is a "social coding" site. It allows you to upload code repositories for storage in the Git version control system. You can then collaborate on code projects, and the system is open-source by default, meaning that anyone in the world can find your GitHub code, use it, learn from it, and improve on it.
...sername. For example, our friend Bob Smith would enter bobsmith.github.io. Check the "Initialize this repository with a README" box. Then click Create repository. Drag and drop the content of your website folder into your repository. Then click Commit changes. Note: Make sure your folder has an index.html file. Navigate your browser to username.github.io to see your website online. For example, for the username chrisdavidmills, go to chrisdavidmills.github.io. Note: It may take a few minutes for your website to go live. If your website does not display immediately, wait a few minutes. Try again. To learn more, see GitHub Pages Help. Further reading What is a web server Understanding domain names How much does it cost to do something on the web? Deploy a...
Advanced text formatting - Learn web development
Blockquotes If a section of block level content (be it a paragraph, multiple paragraphs, a list, etc.) is quoted from somewhere else, you should wrap it inside a <blockquote> element to signify this, and include a URL pointing to the source of the quote inside a cite attribute. For example, the following markup is taken from the MDN <blockquote> element page: <p>The <strong>HTML <co...
...cs/Web/HTML/Element/blockquote"> <p>The <strong>HTML <code>&lt;blockquote&gt;</code> Element</strong> (or <em>HTML Block Quotation Element</em>) indicates that the enclosed text is an extended quotation.</p> </blockquote> Browser default styling will render this as an indented paragraph, as an indicator that it is a quote; the paragraph above the quotation is there to demonstrate that. Inline quotations Inline quotations work in exactly the same way, except that they use the <q> element. For example, the below bit of markup contains a quotation from the MDN <q> page: <p>The quote element -- <code>&lt;q&gt;</code> -- is <q cite="/docs/Web/HTML/Element/q">intended for short quotations that don't require paragraph breaks.</q></p> Browser default styling will render this as normal text...
.../q> -- <a href="/docs/Web/HTML/Element/q"> <cite>MDN q page</cite></a>.</p> Citations are styled in italic font by default. Active learning: Who said that? Time for another active learning example! In this example we'd like you to: Turn the middle paragraph into a blockquote, which includes a cite attribute. Turn "The Need To Eliminate Negative Self Talk" in the third paragraph into an inline quote, and include a cite attribute. Wrap the title of each source in <cite> tags and turn each one into a link to that source. The citation sources you need are: http://www.brainyquote.com/quotes/authors/c/confucius.html for the Confucius quote http://www.affirmationsforpositivethinking.com for "The Need To Eliminate Negative Self Talk". If you make a mistake, you can always reset it us...
... Summary That marks the end of our study of HTML text semantics. Bear in mind that what you have seen during this course is not an exhaustive list of HTML text elements -- we wanted to try to cover the essentials, and some of the more common ones you will see in the wild, or at least might find interesting. To find way more HTML elements, you can take a look at our HTML element reference (the Inline text semantics section would be a great place to start.) In the next article we will look at the HTML elements you'd use to structure the different parts of an HTML document. Previous Overview: Introduction to HTML Next In this module Getting started with HTML What's in the head? Metadata in HTML HTML text fundamentals Creating hyperlinks Advanced text formatting Document and we...
Marking up a letter - Learn web development
th HTML, What's in the head? Metadata in HTML, HTML text fundamentals, Creating hyperlinks, and Advanced text formatting. Objective: Test basic and advanced HTML text formatting, use of hyperlinks, and use of HTML <head>. Starting point To begin, get the raw text you need to mark up, and the the CSS to style the HTML. Create a new .html file using your text editor or use an online tool such as CodePen, jsFiddle, or Glitch to complete the tasks. Note: If you get stuck, then ask us for help. See the Assessment or further help section at the bottom of this page. Project brief For this project, your task is to mark up a letter that needs to be hosted on a university intranet. The letter is a response from a research fellow to a prospective PhD student concerning their app...
...a response from a research fellow to a prospective PhD student concerning their application to the university. Block/structural semantics Use appropriate document structure including doctype, and <html>, <head> and <body> elements. In general, the letter should be marked up as an organization of headings and paragraphs, with the following exception. There is one top level heading (the "Re:" line) and three second level headings. Use an appropriate list type to mark up the semester start dates, study subjects, and exotic dances. Put the two addresses inside <address> elements. Each line of the address should sit on a new line, but not be in a new paragraph. Inline semantics The names of the sender and receiver (and Tel and Email) should be marked up with strong importance. The fou...
... bonus points if it validates. You don't need to know any CSS to do this assignment. You just need to put the provided CSS inside an HTML element. Example The following screenshot shows an example of what the letter might look like after being marked up. Assessment or further help If you would like your work assessed, or if you get stuck and want to ask for help: Put your work in an online shareable editor such as CodePen, jsFiddle, or Glitch. Write a post asking for assessment and/or help at the MDN Discourse forum Learning category. Your post should include: A descriptive title such as "Assessment wanted for Marking up a letter". Details of what you have already tried, and what you would like us to do (if you are stuck and need help, or if you want an assessment). A ...
...ost asking for assessment and/or help at the MDN Discourse forum Learning category. Your post should include: A descriptive title such as "Assessment wanted for Marking up a letter". Details of what you have already tried, and what you would like us to do (if you are stuck and need help, or if you want an assessment). A link to the example you want evaluated or need help with, in an online shareable editor (as mentioned in step 1 above). This is a good habit to develop. It's very hard to help someone with a coding problem without seeing their code. A link to the actual task or assessment page, so we can read the exact wording of the relevant question(s). Previous Overview: Introduction to HTML Next In this module Getting started with HTML What's in the head? ...
Test your skills: HTML text basics - Learn web development
This aim of this skill test is to assess whether you've understood our HTML text fundamentals article. Note: You can try out solutions in the interactive editors below, however it may be helpful to download the code and use an online tool such as CodePen, jsFiddle, or Glitch to work on the tasks. If you get stuck, then ask us for help -- see the Assessment or further help section at the bottom of this page. HTML text basics 1 In this task we want you to mark up the provided HTML using semantic heading and paragraph elements. Try updating the live code below to recreate the finished example: Download the starting point for this task to work in your own editor or in an online editor. HTML text basics 2 In this task we want you to turn the first un-marked up list into an unordered...
...e: Download the starting point for this task to work in your own editor or in an online editor. HTML text basics 2 In this task we want you to turn the first un-marked up list into an unordered list, and the second one into an ordered list. Try updating the live code below to recreate the finished example: Download the starting point for this task to work in your own editor or in an online editor. HTML text basics 3 In this task you are provided with a paragraph, and your aim is to use some inline elements to mark up a couple of appropriate words with strong importance, and a couple with emphasis. Try updating the live code below to recreate the finished example: Download the starting point for this task to work in your own editor or in an online editor. Assessment or fur...
...You can write the code yourself, or use the starting point files linked to in the above sections. ...
...king for assessment and/or help at the MDN Discourse forum Learning category. Your post should include: A descriptive title such as "Assessment wanted for HTML text basics 1 skill test". Details of what you have already tried, and what you would like us to do, e.g. if you are stuck and need help, or want an assessment. A link to the example you want assessed or need help with, in an online shareable editor (as mentioned in step 1 above). This is a good practice to get into -- it's very hard to help someone with a coding problem if you can't see their code. A link to the actual task or assessment page, so we can find the question you want help with. ...
Adding vector graphics to the Web - Learn web development
ext equivalent available in the alt attribute. You can make the image into a hyperlink easily by nesting the <img> inside an <a> element. The SVG file can be cached by the browser, resulting in faster loading times for any page that uses the image loaded in the future. Cons You cannot manipulate the image with JavaScript. If you want to control the SVG content with CSS, you must include inline CSS styles in your SVG code. (External stylesheets invoked from the SVG file take no effect.) You cannot restyle the image with CSS pseudoclasses (like :focus). Troubleshooting and cross-browser support For browsers that don't support SVG (IE 8 and below, Android 2.3 and below), you could reference a PNG or JPG from your src attribute and use a srcset attribute (which only recent browsers rec...
...ct to the same CSS limitations. If your SVGs aren't showing up at all, it might be because your server isn't set up properly. If that's the problem, this article will point you in the right direction. ...
... You can assign classes and ids to SVG elements and style them with CSS, either within the SVG or wherever you put the CSS style rules for your HTML document. In fact, you can use any SVG presentation attribute as a CSS property. ...
...se CSS interactions (like :focus) and CSS animations on your SVG image (even in your regular stylesheet.) You can make SVG markup into a hyperlink by wrapping it in an <a> element. Cons This method is only suitable if you're using the SVG in only one place. Duplication makes for resource-intensive maintenance. Extra SVG code increases the size of your HTML file. The browser cannot cache inline SVG as it would cache regular image assets, so pages that include the image will not load faster after the first page containing the image is loaded. You may include fallback in a <foreignObject> element, but browsers that support SVG still download any fallback images. You need to weigh whether the extra overhead is really worthwhile, just to support obsolescent browsers. How to embed an S...
Test your skills: HTML images - Learn web development
If you get stuck, then ask us for help -- see the Assessment or further help section at the bottom of this page. HTML images 1 In this task we want you to embed a simple image of some Blueberries into the page. ...
...the image, for people that cannot see it. Give the <img> element an appropriate width and height so that it displays at the correct aspect ratio, and enough space is left on the page to display it. The image's intrinsic size is 615 x 419 pixels. Try updating the live code below to recreate the finished example: Download the starting point for this task to work in your own editor or in an online editor. HTML images 2 In this task you already have a full-featured image, but we'd like you to add a tooltip that appears when the image is moused over. You should put some appropriate information into the tooltip. Try updating the live code below to recreate the finished example: Download the starting point for this task to work in your own editor or in an online editor. HTML images 3...
...to work in your own editor or in an online editor. HTML images 3 In this final task you are provided with both a full-featured image and some caption text. What you need to do here is add elements that will associate the image with the caption. Try updating the live code below to recreate the finished example: Download the starting point for this task to work in your own editor or in an online editor. Assessment or further help You can practice these examples in the Interactive Editors above. If you would like your work assessed, or are stuck and want to ask for help: Put your work into an online shareable editor such as CodePen, jsFiddle, or Glitch. You can write the code yourself, or use the starting point files linked to in the above sections. Write a post asking for assessm...
...ing for assessment and/or help at the MDN Discourse forum Learning category. Your post should include: A descriptive title such as "Assessment wanted for HTML image basics 1 skill test". Details of what you have already tried, and what you would like us to do, e.g. if you are stuck and need help, or want an assessment. A link to the example you want assessed or need help with, in an online shareable editor (as mentioned in step 1 above). This is a good practice to get into -- it's very hard to help someone with a coding problem if you can't see their code. A link to the actual task or assessment page, so we can find the question you want help with. ...
Graceful asynchronous programming with Promises - Learn web development
, and then display that blob inside an <img> element. This is very similar to the example we looked at in the first article of the series, but we'll do it a bit differently as we get you building your own promise-based code. Note: The following example will not work if you just run it directly from the file (i.e. via a file:// URL). ...
...t work if you just run it directly from the file (i.e. via a file:// URL). You need to run it through a local testing server, or use an online solution such as Glitch or GitHub pages. First of all, download our simple HTML template and the sample image file that we'll fetch. Add a <script> element at the bottom of the HTML <body>. Inside your <script> element, add the following line: let promise = fetch('coffee.jpg'); This calls the fetch() method, passing it the URL of the image to fetch from the network as a parameter. This can also take an options object as an optional second parameter, but we are just using the simplest version for now. We are storing the promise object returned by fetch() inside a variable called promise. As we said before, this object represents ...
...ightly more than this. Fetch promises do not fail on 404 or 500 errors -- only on something catasrophic like a network failure. Instead, they succeed, but with the response.ok property set to false. To produce an error on a 404, for example, we need to check the value of response.ok, and if false, throw an error, only returning the blob if it is true. This can be done like so -- add the following lines below your first line of JavaScript. let promise2 = promise.then(response => { if (!response.ok) { throw new Error(`HTTP error! status: ${response.status}`); } else { return response.blob(); } }); Each call to .then() creates a new promise. This is very useful; because the blob() method also returns a promise, we can handle the Blob object it returns on fulfillment by invo...
... promise. Because we want to do something a bit more complex to the blob than just run a single method on it and return the result, we'll need to wrap the function body in curly braces this time (otherwise it'll throw an error). Add the following to the end of your code: let promise3 = promise2.then(myBlob => { }) Now let's fill in the body of the executor function. Add the following lines inside the curly braces: let objectURL = URL.createObjectURL(myBlob); let image = document.createElement('img'); image.src = objectURL; document.body.appendChild(image); Here we are running the URL.createObjectURL() method, passing it as a parameter the Blob returned when the second promise fulfills. This will return a URL pointing to the object. Then we create an <img> element, set its sr...
Introduction to events - Learn web development
-- The color changes when the mouse pointer hovers over the button, or when the pointer moves off the button, respectively. Some events are general and available nearly anywhere (e.g. an onclick handler can be registered on nearly any element), whereas some are more specific and only useful in certain situations (e.g. it makes sense to use onplay only on specific elements, such as <video>). Inline event handlers -- don't use these You might also see a pattern like this in your code: <button onclick="bgChange()">Press me</button> function bgChange() { const rndCol = 'rgb(' + random(255) + ',' + random(255) + ',' + random(255) + ')'; document.body.style.backgroundColor = rndCol; } Note: You can find the full source code for this example on GitHub (also see it running live). The e...
...bgChange()">Press me</button> function bgChange() { const rndCol = 'rgb(' + random(255) + ',' + random(255) + ',' + random(255) + ')'; document.body.style.backgroundColor = rndCol; } Note: You can find the full source code for this example on GitHub (also see it running live). 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. The above example invokes a function defined inside a <script> element on the same page, but you could also insert JavaScript directly inside the attribute, for example: <button onclick="alert('Hello, this is my old-fashioned event handler!');">Press me</button>...
...ht seem easy to use an event handler attribute if you are doing something really quick, but they quickly become unmanageable and inefficient. For a start, it is not a good idea to mix up your HTML and your JavaScript, as it becomes hard to parse -- keeping your JavaScript separate is best practice; if it is in a separate file you can apply it to multiple HTML documents. Even in a single file, inline event handlers are not a good idea. One button is OK, but what if you had 100 buttons? You'd have to add 100 attributes to the file; it would quickly turn into a maintenance nightmare. With JavaScript, you could easily add an event handler function to all the buttons on the page no matter how many there were, using something like this: const buttons = document.querySelectorAll('button'); for (l...
...an up old unused event handlers. Plus, this allows you to have the same button performing different actions in different circumstances -- all you have to do is add or remove event handlers as appropriate. Second, you can register multiple handlers for the same listener. The following two handlers wouldn't both be applied: myElement.onclick = functionA; myElement.onclick = functionB; The second line overwrites the value of onclick set by the first line. This would work, however: myElement.addEventListener('click', functionA); myElement.addEventListener('click', functionB); Both functions would now run when the element is selected. In addition, there are other powerful features and options available with this event mechanism. These are a little out of scope for this article, but if you wan...
Looping code - Learn web development
o print out a simple launch countdown to the output box, from 10 down to Blastoff. Specifically, we want you to: Loop from 10 down to 0. We've provided you with an initializer -- let i = 10;. For each iteration, create a new paragraph and append it to the output <div>, which we've selected using const output = document.querySelector('.output');. In comments, we've provided you with three code lines that need to be used somewhere inside the loop: const para = document.createElement('p'); -- creates a new paragraph. output.appendChild(para); -- appends the paragraph to the output <div>. para.textContent = -- makes the text inside the paragraph equal to whatever you put on the right-hand side, after the equals sign. Different iteration numbers require different text to be pu...
...s a new paragraph. output.appendChild(para); -- appends the paragraph to the output <div>. para.textContent = -- makes the text inside the paragraph equal to whatever you put on the right-hand side, after the equals sign. Different iteration numbers require different text to be put in the paragraph for that iteration (you'll need a conditional statement and multiple para.textContent = lines): If the number is 10, print "Countdown 10" to the paragraph. If the number is 0, print "Blast off!" to the paragraph. For any other number, print just the number to the paragraph. Remember to include an iterator! However, in this example we are counting down after each iteration, not up, so you don't want i++ -- how do you iterate downwards? Note: If you start typing the lo...
...conditional statement: If it is, concatenate the array item to the end of the refused paragraph's textContent, followed by a comma and a space. If it isn't, concatenate the array item to the end of the admitted paragraph's textContent, followed by a comma and a space. We've already provided you with: let i = 0; -- Your initializer. refused.textContent += -- the beginnings of a line that will concatenate something on to the end of refused.textContent. admitted.textContent += -- the beginnings of a line that will concatenate something on to the end of admitted.textContent. Extra bonus question -- after completing the above tasks successfully, you will be left with two lists of names, separated by commas, but they will be untidy -- there will be a comma at the end of each o...
... If you make a mistake, you can always reset the example with the "Reset" button. If you get really stuck, press "Show solution" to see a solution. ...
Useful string methods - Learn web development
Now, before your brain starts melting, don't worry! You really don't need to know about most of these early on in your learning journey. But there are a few that you'll potentially use quite often that we'll look at here. Let's enter some examples into the browser developer console. Finding the length of a string This is easy -- you simply use the length property. Try entering the following lines: let browserType = 'mozilla'; browserType.length; This should return the number 7, because "mozilla" is 7 characters long. This is useful for many reasons; for example, you might want to find the lengths of a series of names so you can display them in order of length, or let a user know that a username they have entered into a form field is too long if it is over a certain length. Retrieving ...
...le name. Inside the square brackets you include the number of the character you want to return, so for example to retrieve the first letter you'd do this: browserType[0]; Remember: computers count from 0, not 1! You could use this to, for example, find the first letter of a series of strings and order them alphabetically. To retrieve the last character of any string, we could use the following line, combining this technique with the length property we looked at above: browserType[browserType.length-1]; The length of "mozilla" is 7, but because the count starts at 0, the character position is 6; using length-1 gets us the last character. Finding a substring inside a string and extracting it Sometimes you'll want to find if a smaller string is present inside a larger one (we generally sa...
...original string. There are other options too; study the slice() page to see what else you can find out. Changing case The string methods toLowerCase() and toUpperCase() take a string and convert all the characters to lower- or uppercase, respectively. This can be useful for example if you want to normalize all user-entered data before storing it in a database. Let's try entering the following lines to see what happens: let radData = 'My NaMe Is MuD'; radData.toLowerCase(); radData.toUpperCase(); Updating parts of a string You can replace one substring inside a string with another substring using the replace() method. This works very simply at a basic level, although there are some advanced things you can do with it that we won't go into yet. It takes two parameters -- the string you wa...
... ul'); list.innerHTML = ''; let greetings = ['Happy Birthday!', 'Merry Christmas my love', 'A happy Christmas to all the family', 'You\'re all I want for Christmas', 'Get well soon']; for (let i = 0; i < greetings.length; i++) { let input = greetings[i]; // 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:...
JavaScript object basics - Learn web development
very little -- a <script> element for us to write our source code into. We'll use this as a basis for exploring basic object syntax. While working with this example you should have your developer tools JavaScript console open and ready to type in some commands. As with many things in JavaScript, creating an object often begins with defining and initializing a variable. Try entering the following line below the JavaScript code that's already in your file, then saving and refreshing: const person = {}; Now open your browser's JavaScript console, enter person into it, and press Enter/Return. You should get a result similar to one of the below lines: [object Object] Object { } { } Congratulations, you've just created your first object. Job done! But this is an empty object, so we can't reall...
...-- they map strings to values in the same way that arrays map numbers to values. Setting object members So far we've only looked at retrieving (or getting) object members -- you can also set (update) the value of object members by simply declaring the member you want to set (using dot or bracket notation), like this: person.age = 45; person['name']['last'] = 'Cratchit'; Try entering the above lines, and then getting the members again to see how they've changed, like so: person.age person['name']['last'] Setting members doesn't just stop at updating the values of existing properties and methods; you can also create completely new members. Try these in the JS console: person['eyes'] = 'hazel'; person.farewell = function() { alert("Bye everybody!"); } You can now test out your new members...
... we wanted users to be able to store custom value types in their people data, by typing the member name and value into two text inputs. ...
...n in our own basic custom examples. So when you used string methods like: myString.split(','); You were using a method available on an instance of the String class. Every time you create a string in your code, that string is automatically created as an instance of String, and therefore has several common methods and properties available on it. When you accessed the document object model using lines like this: const myDiv = document.createElement('div'); const myVideo = document.querySelector('video'); You were using methods available on an instance of the Document class. For each webpage loaded, an instance of Document is created, called document, which represents the entire page's structure, content, and other features such as its URL. Again, this means that it has several common method...
Object building practice - Learn web development
a browser. Open the browser's JavaScript console, and then refresh the page so that the canvas size changes to the smaller visible viewport that remains when the console opens. Type in the following to create a new ball instance: let testBall = new Ball(50, 100, 4, 4, 'blue', 10); Try calling its members: testBall.x testBall.size testBall.color testBall.draw() When you enter the last line, you should see the ball draw itself somewhere on the canvas. Updating the ball's data We can draw the ball in position, but to actually move the ball, we need an update function of some kind. Add the following code at the bottom of your JavaScript file, to add an update() method to the Ball()'s prototype: Ball.prototype.update = function() { if ((this.x + this.size) >= width) { this.ve...
...ll is going off the bottom edge). if the y coordinate is smaller than 0 (the ball is going off the top edge). In each case, we include the size of the ball in the calculation because the x/y coordinates are in the center of the ball, but we want the edge of the ball to bounce off the perimeter -- we don't want the ball to go halfway off the screen before it starts to bounce back. The last two lines add the velX value to the x coordinate, and the velY value to the y coordinate -- the ball is in effect moved each time this method is called. This will do for now; let's get on with some animation! Animating the ball Now let's make this fun. We are now going to start adding balls to the canvas, and animating them. First, we need to create somewhere to store all our balls and then populate...
...the function again using the requestAnimationFrame() method -- when this method is repeatedly run and passed the same function name, it runs that function a set number of times per second to create a smooth animation. This is generally done recursively -- which means that the function is calling itself every time it runs, so it runs over and over again. Last but not least, add the following line to the bottom of your code -- we need to call the function once to get the animation started. loop(); That's it for the basics -- try saving and refreshing to test your bouncing balls out! Adding collision detection Now for a bit of fun, let's add some collision detection to our program, so our balls know when they have hit another ball. First, add the following method definition below...
...ould have done something far more complex, like get the balls to bounce off each other realistically, but that would have been far more complex to implement. For such physics simulations, developers tend to use a games or physics library such as PhysicsJS, matter.js, Phaser, etc. You also need to call this method in each frame of the animation. Add the following below the balls[i].update(); line: balls[i].collisionDetect(); Save and refresh the demo again, and you'll see your balls change color when they collide! Note: If you have trouble getting this example to work, try comparing your JavaScript code against our finished version (also see it running live). Summary We hope you had fun writing your own real world random bouncing balls example, using various object and object-o...
Properly configuring server MIME types - Learn web development
for stylesheets loaded from a different origin than the requesting document. If your stylesheet comes from a different origin than the document, you must serve it with the correct MIME type (text/css). Gecko 1.9.1.11 (Firefox 3.5.11) and Gecko 1.9.2.5 (Firefox 3.6.5) also implement this security fix, but to improve compatibility, there was a temporary heuristic that allows the load if the first line in the style sheet appears to be a well-formed CSS construct; the heuristic has been removed in Firefox 4, and you have to properly set the text/css MIME types to have your CSS pages recognized. Why browsers should not guess MIME types Apart from violating the HTTP specification, it is a bad strategy for browsers to guess MIME types for the following reasons: Loss of control If the browser i...
... determine the MIME type sent by a server In Firefox, load the file and use Tools | Page Info. You can also use Rex Swain's HTTP Viewer or Live HTTP Headers to see the full headers and content of any file sent from a web server. According to the standards, a meta tag that gives the MIME type such as <meta http-equiv="Content-Type" content="text/html"> should be ignored if there's a Content-Type line in the header. Instead of looking for this line in the HTML source, use the above techniques to determine the MIME type sent by the server. How to determine the correct MIME type for your content There are several steps which you can take to determine the correct MIME type value to be used for your content. If your content was created using a vendor's software application, read the vendor's ...
...cument. If you're using the Apache web server, simply copy this sample .htaccess file to the directory that contains the files that you want to send with the correct MIME types. If you have an entire subdirectory of files, just place the file in the parent directory; you need not place it in each subdirectory. If you're using a server-side script to generate content, you can generally add one line near the top of your script. You can serve content other than HTML from Perl, PHP, ASP, or Java -- just change the MIME type accordingly. For Perl CGI, you should have the line print "Content-Type: text/html\n\n"; before any other output lines. If you're using the CGI module, you can use the line print $cgi->header('text/html'); instead, where $cgi is your reference to the CGI instance. ...
... You can serve content other than HTML from Perl, PHP, ASP, or Java -- just change the MIME type accordingly. For Perl CGI, you should have the line print "Content-Type: text/html\n\n"; before any other output lines. If you're using the CGI module, you can use the line print $cgi->header('text/html'); instead, where $cgi is your reference to the CGI instance. For PHP, you should have the line header('Content-Type: text/html'); before any other output lines. For ASP, you should have the line response.ContentType = "text/html"; before any other output lines. For a Java servlet, you should have the line response.setContentType("text/html"); at the top of your doGet or doPost method, where response is a reference to the HttpServletResponse. Related Links Incorrect MIME Typ...
Introduction to the server side - Learn web development
de (e.g. HTML and JavaScript). Perhaps the most significant benefit of server-side code is that it allows you to tailor website content for individual users. Dynamic sites can highlight content that is more relevant based on user preferences and habits. It can also make sites easier to use by storing personal preferences and information -- for example reusing stored credit card details to streamline subsequent payments. It can even allow interaction with users of the site, sending notifications and updates via email or through other channels. All of these capabilities enable much deeper engagement with users. In the modern world of web development, learning about server-side development is highly recommended. What is server-side website programming? Web browsers communicate with web serv...
...e to get, delete, or post the resource), and may include additional information encoded in URL parameters (the field-value pairs sent via a query string), as POST data (data sent by the HTTP POST method), or in associated cookies. Web servers wait for client request messages, process them when they arrive, and reply to the web browser with an HTTP response message. The response contains a status line indicating whether or not the request succeeded (e.g. "HTTP/1.1 200 OK" for success). The body of a successful response to a request would contain the requested resource (e.g. a new HTML page, or an image, etc...), which could then be displayed by the web browser. Static sites The diagram below shows a basic web server architecture for a static site (a static site is one that returns the same...
...s not limited to sending information from databases, and might alternatively return the result of software tools, or data from communications services. The content can even be targeted for the type of client device that is receiving it. Because the information is in a database, it can also more easily be shared and updated with other business systems (for example, when products are sold either online or in a shop, the shop might update its database of inventory). Note: Your imagination doesn't have to work hard to see the benefit of server-side code for efficient storage and delivery of information: Go to Amazon or some other e-commerce site. Search for a number of keywords and note how the page structure doesn't change, even though the results do. Open two or three different products...
...tent: articles are visible to everyone, but only users who have logged in can edit them. To try this, click on the Edit button at the top of this page -- if you are logged in you will be shown the edit view; if you are not logged in you will be taken to the sign-up page. Note: Consider other real examples where access to content is controlled. ...
Componentizing our Svelte app - Learn web development
tive of this article is to look at how to break our app into manageable components and share information between them. We'll componentize our app, then add more functionality to allow users to update existing components. Prerequisites: At minimum, it is recommended that you are familiar with the core HTML, CSS, and JavaScript languages, and have knowledge of the terminal/command line. You'll need a terminal with node + npm installed to compile and build your app. Objective: To learn how to break our app into components and share information among them. Code along with us Git Clone the github repo (if you haven't already done it) with: git clone https://github.com/opensas/mdn-svelte-tutorial.git Then to get to the current app state, run cd mdn-...
...__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. ...
...on> </div> Back in our Todos.svelte component, we want to make use of our FilterButton component. First of all, we need to import it -- add the following line at the top of the Todos.svelte <script> section: import FilterButton from './FilterButton.svelte' Now, replace the filters <div> with a call to the FilterButton component, which takes the current filter as a prop -- the below line is all you need: <FilterButton {filter} /> Note: Remember that when the HTML attribute name and variable matches, they can be replaced with {variable}, that's why we could replace <FilterButton filter={filter} /> with <FilterButton {filter} />. So far so good! Let's try out the app now. You'll notice that when you click on the filter buttons, they are selected and the style updates appr...
... data will be available on the detail property of the event object. Note: Custom events in Svelte share the same API as regular DOM events. Moreover, you can bubble up an event to your parent component by specifying on:event without any handler. We'll edit our Todo component to emit a remove event, passing the todo being removed as additional information. ...
Working with Svelte stores - Learn web development
we will show another way to handle state management in Svelte -- Stores. Stores are global global data repositories that hold values. Components can subscribe to stores and receive notifications when their values change. Prerequisites: At minimum, it is recommended that you are familiar with the core HTML, CSS, and JavaScript languages, and have knowledge of the terminal/command line. You'll need a terminal with node + npm installed to compile and build your app. 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. In this case, the Alert component is independent from the rest -- it is not a parent or child of any other -- so the m...
... update of the component's DOM. The subscribe() method also returns a clean-up function, which takes care of releasing the subscription. So we subscribe when the component is being initialized, and use onDestroy to unsubscribe when the component is unmounted. Finally we use the alertContent variable in our markup, and if the user clicks on the alert we clean it. At the end we include a few CSS lines to style our Alert component. This setup allows us to work with stores in a reactive way. When the value of the store changes, the callback is executed. There we assign a new value to a local variable, and thanks to Svelte reactivity all our markup and reactive dependencies are updated accordingly. Using the component Let's now use our component. In App.svelte we'll import the componen...
...ys get the same list of hardcoded todos when we reload it. To make it truly useful, we have to find out how to persist our todos. First we need some way for our Todos component to give back the updated todos to its parent. We could emit an updated event with the list of todos, but it's easier just to bind the todos variable. Let's open App.svelte and try it. First of all, add the following line below your todos array: $: console.log('todos', todos) Next, update your Todos component call as follows: <Todos bind:todos /> Remember: <Todos bind:todos /> is just a shortcut for <Todos bind:todos={todos} />. Go back to your app, try adding some todos, then go your developer tools web console. You'll see that every modification we make to our todos is reflected in the...
.... A store may optionally contain a set() method, which must accept as its argument a new value for the store, and which synchronously calls all of the store's active subscription functions. A store with a set() method is called a writable store. First of all, let's add the following console.log() statements to our App.svelte component to see the todos store and its content in action. Add these lines below the todos array: console.log('todos store - todos:', todos) console.log('todos store content - $todos:', $todos) When you run the app now, you'll see something like this in your web console: As you can see, our store is just an object containing subscribe(), set(), and update() methods, and $todos is our array of todos. Just for reference, here's a basic working store implemented fro...
Getting started with Vue - Learn web development
ticle we'll look at a little bit of Vue background, learn how to install it and create a new project, study the high-level structure of the whole project and an individual component, see how to run the project locally, and get it prepared to start building our example. Prerequisites: Familiarity with the core HTML, CSS, and JavaScript languages, knowledge of the terminal/command line. Vue components are written as a combination of JavaScript objects that manage the app's data and an HTML-based template syntax that maps to the underlying DOM structure. For installation, and to use some of the more advanced features of Vue (like Single File Components or render functions), you'll need a terminal with node + npm installed. Objective: To setup a local Vue dev...
...u knowing.) <script src="/static/external/29/29296ccacaa9ed35ed168fc51e36f54fd6f8db9c7786bbf38cc59a27229ba5c2.svg"></script> However, this approach has some limitations. To build more complex apps, you'll want to use the Vue NPM package. This will let you use advanced features of Vue and take advantage of bundlers like WebPack. To make building apps with Vue easier, there is a CLI to streamline the development process. To use the npm package & the CLI you will need: Node.js 8.11+ installed. npm or yarn. Note: If you don't have the above installed, find out more about installing npm and Node.js here. To install the CLI, run the following command in your terminal: npm install --global @vue/cli Or if you'd prefer to use yarn: yarn global add @vue/cli Once installed, to initial...
...f changes Let's make our first change to the app -- we'll delete the Vue logo. Open the App.vue file, and delete the <img> element from the template section: <img alt="Vue logo" src="./assets/logo.png"> If your server is still running, you should see the logo removed from the rendered site almost instantly. Let's also remove the HelloWorld component from our template. ...
...erver is still running, you should see the logo removed from the rendered site almost instantly. Let's also remove the HelloWorld component from our template. First of all delete this line: <HelloWorld msg="Welcome to Your Vue.js App"/> If you save your App.vue file now, the rendered app will throw an error because we've registered the component but are not using it. 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>. Let's add a new <h1> inside <div id="app">. Since we're going to be creating a todo li...
Accessibility information for UI designers and developers
Verou's Contrast Ratio. There are also plug-ins available for design software, like Stark for Sketch. Don't rely on color alone When your interface uses color to distinguish between things, make sure the distinction is also made in other ways. For example, add text labels or texture in addition to color differences. For example, in this chart, it helps to add labels besides the colored chart lines:People who cannot see the difference between the colors, can use the labels instead. Or in this one, you could consider using patterns besides colored areas: Again, if people are unable to distinguish the colors, they can rely on the patterns instead. See also: Understanding SC 1.4.3: Contrast The focus indicator Users who navigate by keyboard (or other specialised input methods), rely on...
...ides colored areas: Again, if people are unable to distinguish the colors, they can rely on the patterns instead. See also: Understanding SC 1.4.3: Contrast The focus indicator Users who navigate by keyboard (or other specialised input methods), rely on focus styles to see where they are on the page. Only one element has focus at a given time, typically revealed by browsers with a dotted outline. CSS lets authors change what the focus indicator look like, so you can design it to match branding. Here's an example of someone tabbing through a footer, the focus moves around: Note: don't remove the focus indicator, as without it, users that can't or don't use a mouse cannot see where they are. It would be like removing the mouse indicator. See also: Understanding SC 2.4.7: focus visibl...
... On the web, users can use tools in their browser to make font sizes larger, or even provide custom CSS to meet their specific needs. Ensure your design is flexible enough to allow for this. Text sizing Users should be able to enlarge their text size up to 200 percent without breaking functionality. ...
...browsers come with a lot of accessibility for free. For example, the select element displays an ideal mobile interface on mobile operating systems like Android and iOS. On desktop with a keyboard, it lets people type a character, say 'K', to jump directly to options starting with 'K'. It is recommended to use native controls, visibly or under the hood. Links vs buttons To keep your interface in line with user expectations, use links for interactions that go somewhere (on the current page or another page) and buttons for interactions that do something (like submit a form or open an overlay). Links can be styled as buttons and vice versa, but designers are advised to avoid this where possible. Motion On pages with transitions and animations, note that some users could experience distraction...
CSUN Firefox Materials
Firefox 1.5, Beyond the Status Quo "...Firefox is a great little browser. It's a quick download, occupies very little disk space, and has a clean, no-nonsense interface." - PC Magazine Firefox 1.5 is a fast, free, standards compliant web browser which is rapidly gaining recognition for its fresh, streamlined approach to browsing the web. In addition to winning major awards such as PC World Product of the Year, Firefox has attracted a huge following among savvy users who simply care enough about their web browsing experience to download a new piece of software. Websites such as online magazines with sophisticated audiences are now reporting upwards of 25% Firefox usage. Why do the most discerning users switch to Firefox? Because Firefox rethinks the web, and does away with many of t...
... navigation within the entire Windows OS much simpler. Both history and bookmarks can be searched with a "quick search" field that quickly narrows the list down via a substring search. Bookmarks can have a keyword assigned to them which can be typed into the address bar to bring up the bookmark. A "smart keywords" feature enhances this even further by allowing custom searches from the command line such as "word punditry" to look up the word "punditry" in an online dictionary. These smart keywords can be setup via the context menu for the search field on the desired website. Integrated web search via Ctrl+K is much faster to use than first going to the search tool's web site. Custom searches can be added to this quick search bar and the user can switch between them by choosing from a drop...
...ibutes Accessible Web Applications (DHTML and AJAX) IBM realized it needed a way to enable accessibility for ever more powerful web applications, beyond what you see on typical web pages today. Rather than go and write their own new web browser, IBM decided to trust in the openness of the Mozilla community, which accepted IBM's significant contributions. For example, IBM has delivered over 50,000 lines of code to enable accessibility in Firefox on Windows and especially for this new powerful world of "web applications". A web application may be an easier-to-use online tax assistant, a web calendar or a live sports statistics page, which is familiar in that it acts much like a desktop application. Whether the current buzzword for this technology is "DHTML", "AJAX" or "Web 2.0" doesn't really ma...
...ows, because the same core accessibility work applies to Linux. The two companies anticipate that in 2007, Firefox will support topnotch screen reader accessibility on UNIX and Linux. ...
Accessibility and Mozilla
e to chat with there, day or night.Accessibility information for UI designers and developersWhen you design user interfaces with accessibility in mind, they will work for more people. This page describes a number of design-related aspects to look out for, in no particular order.Accessibility/LiveRegionDevGuideThis page is currently under construction. This developer's guide lays out general guidelines that assistive technology (AT) developers can use in developing live region support. This guide was written from an ATK/AT-SPI point of view as part of the Orca Live Region Support project. However, many of the concepts were also used during the development of FireVox, an AT using IAccessible2.Accessible Toolkit ChecklistPlease contact the Mozilla Accessibility Community with questions or feedba...
...s part of the Orca Live Region Support project. ...
...irefox 1.5 is a fast, free, standards compliant web browser which is rapidly gaining recognition for its fresh, streamlined approach to browsing the web. In addition to winning major awards such as PC World Product of the Year, Firefox has attracted a huge following among savvy users who simply care enough about their web browsing experience to download a new piece of software. Websites such as online magazines with sophisticated audiences are now reporting upwards of 25% Firefox usage.Embedding API for AccessibilityEvent Process ProcedureThis diagram outlines how events are processed within Gecko. Gecko info for Windows accessibility vendorsPlease contact the Mozilla Accessibility Community.Information for Assistive Technology VendorsBoth end users and developers are invited for discussio...
...ed by Aaron Leventhal and by the Mozilla Accessibility Community. Feedback and constructive suggestions are encouraged.Mozilla Plugin AccessibilityPlugins in Gecko-based browsers have a lot of accessibility issues. Here is a rundown of problems and the planned solutions:Mozilla's Section 508 ComplianceMozilla's UAAG evaluation reportThe UAAG document contains a very rich set of accessibility guidelines, that broadly define how accessibility should be implemented by any user agent, i.e. software that renders web content. The UAAG is not the basis for any government accessibility regulations at this time.Multiprocess on WindowsA high-level overview of the ideas behind the a11y+e10s design is available on the wiki.Software accessibility: Where are we today?The accessibility of computer software h...
Adding a new CSS property
rty not reset by that shorthand to such a struct. Once you know which struct you're going to use (or that the property is a shorthand), you can add appropriate entry to nsCSSPropList.h. Again, see the documentation at the top of the file and the other entries for examples, and also see the next section for details about parsing. Parsing To start implementing the parsing, first read the Syntax line in the property's specification (whose syntax is in turn defined in the CSS Values and Units specification) and any prose in the specification that adds additional restrictions to that syntax. Every property in nsCSSPropList.h must have in its flags field exactly one of the four CSS_PROPERTY_PARSE_* flags defined in nsCSSProps.h. Given the syntax for the property, you can determine which one to...
...e name must match the "method" argument in the CSS_PROP_SHORTHAND macro. When writing the custom parsing code for a shorthand, you'll need to ensure that any successful parse sets all of the subproperties of the shorthand (since that's the way shorthands work in CSS). Some common mistakes to watch out for when writing custom parsing code (which might go away if we redesign the parser along the lines described in css3-syntax): make sure to call SkipUntil() to look for the matching close parentheses, braces, or brackets whenever you hit an error inside of them. make sure to call UngetToken() if you have called GetToken() but the result is unexpected. This is particularly important in case the unexpected token is a parenthesis or something else that requires matching the other half of a p...
...), which is faster than calling into the preferences code For further understanding of how the parsing code works, you should read and understand the code in nsCSSParser.cpp. Computed Style When adding a new longhand property, you also need to implement the computed style side of things. (None of this applies to shorthand properties.) Start by reading and understanding the "Computed Value:" line in the specification's definition of the property, and any associated prose. This line describes the conceptual representation (but not syntax) of the computed value of the property. The data structures in Gecko that store the computed value must correspond to this concept, or inheritance won't work as described by the specification. So first, you need to add a member variable (or variables) t...
... in nsStyleStruct.h and fix the default constructor and the copy constructor of that struct in nsStyleStruct.cpp. If this variable needs to be a tagged union, use nsStyleCoord. But don't use nsStyleCoord if you only need a single type that nsStyleCoord provides. The default constructor must initialize the variable to match the initial value of the property, as described in the "Initial Value:" line in the specification's definition of the property. You then need to add code to nsRuleNode::Compute*Data (where the * is for the style struct) to transform a specified value of the property into a computed value of the property. This needs to match the specification's definition of the "Computed value" (and, for the 'initial' value, it's definition of "Initial Value"). For examples of how to w...
Debugging on Windows
ing Power Tool allows automatically attaching to child processes, such as Web Content process, GPU process, etc. Enable it by going its configuration menu in "Debug > Other debugging targets > Child process debugging settings", and ticking the box. If you have followed the steps in Building Firefox for Windows and have a local debug build, you can execute ./mach run --debug from the same command line. It would open Visual Studio with Firefox's run options configured. You can click "Start" button to run Firefox then, already attached in the debugger. Alternatively, if you have generated the Visual Studio solution, via ./mach build-backend -b VisualStudio, opening this solution allows you to run firefox.exe directly in the debugger. Making it the startup project, by right clicking on it (it ap...
...documentation on firefox-source-docs. Changing/setting the executable to debug VC++ 6.0: To change or set the executable to debug, go to Project > Settings..., Debug tab and select General from the drop down list. "Executable for debug session:" should show the executable you are debugging. If it is empty or incorrect, use the arrow button and select Browse... to locate the executable. Command line parameters and environment variables VC++ 6.0: To change or set the command line options, go to Project > Settings..., Debug tab and select General from the drop down list. "Program arguments:" should show the options. Some common options would be the URL of the file you want the browser to open as soon as it starts, starting the Profile Manager, or selecting a profile. You can also redirect th...
...em). So unless you feel comfortable with this, don't do it. You have been warned! It is possible to change the interrupt code in memory (which causes you to break into debugger) to be a NOP (no operation). You do this by running the program in the debugger until you hit an assertion. You should see some assembly code. One assemly code instruction reads "int 3". Check the memory address for that line. Now open memory view. Type/copy/drag the memory address of "int 3" into the memory view to get it to update on that part of the memory. Change the value of the memory to "90", close the memory view and hit "F5" to continue. Confused? See the screenshot below: VC++ 7.0? Automatically handling ASSERTIONS without a debugger attached When an assertion happens and there is not a debugger attach...
...be necessary to disable the content sandbox (MOZ_DISABLE_CONTENT_SANDBOX=1 ./mach run ...). Running two instances of Mozilla simultaneously You can run two instances of Mozilla (e.g. debug and optimized) simultaneously by setting the environment variable MOZ_NO_REMOTE: set MOZ_NO_REMOTE=1 Or, starting with Firefox 2 and other Gecko 1.8.1-based applications, you can use the -no-remote command-line switch instead (implemented in bug 325509). You can also specify the profile to use with the -P profile_name command-line argument. Debugging JavaScript Use Venkman, the JavaScript Debugger for Mozilla. You can use helper functions from nsXPConnect.cpp to inspect and modify the state of JavaScript code from the MSVS debugger. For example, to print curent JavaScript stack to stdout, evaluate ...
How Mozilla's build system works
many other config.status files, as it's written in Python! Instead of our configure script producing a shell script, it generates a Python script. Python 2 is prevalent in a Mozilla build system. If we need to write code for the build system, we do it in Python 2 instead of editing a makefile. config.status contains 2 parts: data structures representing the output of configure and a command-line interface for preparing, configuring, or generating an appropriate build backend. A build backend is merely a tool used to build the tree -- like GNU Make or Tup. These data structures describe the current state of the system and what the existing build configuration looks like. For example, a data structure defines which compiler to use, how to invoke it, which application features are enabled...
...s and directories. As the moz.build files are read, data structures describing the overall build system definition are emitted. These data structures are then read by a build backend generator, which then converts them into files, function calls, and so on. In the case of a make backend, the generator writes out makefiles. When config.status runs, you'll see the following output: Reticulating splines... Finished reading 1096 moz.build files into 1276 descriptors in 2.40s Backend executed in 2.39s 2188 total backend files. 0 created; 1 updated; 2187 unchanged Total wall time: 5.03s; CPU time: 3.79s; Efficiency: 75% What this is saying is that a total of 1,096 moz.build files were read. Altogether, 1,276 data structures describing the build configuration were derived from them. It took 2.40s ...
...d package now, not mozbuild.frontend). The child class implements methods for processing individual class instances as well as common hook points, such as processing has finished. See recursivemake.py for an implementation of a BuildBackend. Although we call the base class BuildBackend, the class doesn't need to be focused with building at all. If you wanted to create a consumer that performed a line count of all C++ files or generated a Clang compilation database, for example, this would be an acceptable use of a BuildBackend. Technically, we don't need to feed the TreeMetadataEmitter output into a BuildBackend: it's possible to create your own consumer. However, a BuildBackend provides a common framework from which to author consumers. Along the same vein, you don't need to use TreeMetadat...
...(i.e., source files). One other frequently used variable not specific to a particular build target is DIRS. DIRS is a list of subdirectories of the current directory to recursively build in. Subdirectories are traversed after their parent directories. For example, you could have: DIRS = \ public \ resources \ src \ $(NULL) This example demonstrates another concept called continuation lines. A backslash as the last character on a line allows the variable definition to be continued on the next line. The extra whitespace is compressed. The terminating $(NULL) is a method for consistency; it allows you to add and remove lines without worrying about whether the last line has an ending backslash or not. Makefile examples Standard Makefile Header Installing headers using EXPORTS Co...
HTML parser threading
tead of the tree op stage described earlier) of the tree builder. The speculation object has a queue of tree ops (into which the tree builder will now flush ops to instead of the tree op stage), an owning reference to the nsHtml5OwningUTF16Buffer that contains the starting point of the speculation, an index into the nsHtml5OwningUTF16Buffer defining the exact starting point within the buffer, the line number of the tokenizer at that point and a snapshot of the tree op state. The line number and the snapshot are also added to the tree op that attempts to execute scripts (before flushing it). The tree builder snapshot contains a copy of the tree builder stack, a copy of the list of open formatting elements and copies of various fields that define the tree builder state. It contains all the infor...
... that is used for parsing document.write()-originating data is initialized from the state snapshot. Now the tokenizer/tree builder pair used for parsing document.write() data is in the same state that the off-the-main-thread tokenizer/tree builder pair was immediately after processing the script end tag. The tree op executor then attempts to execute the script. This operation either executes an inline script right away or tells the parser to block (for external scripts). If the parser is told to block, the script loader will unblock the parser before the external script executes. If the script was executed without blocking, the executor dispatches an event to reflush itself. (Remember that reflushing ends up calling nsHtml5Parser::ParseUntilBlocked(). That method is responsible for moving back...
...pair that exists on the main thread solely for parsing data from document.write(). If the parser isn't blocked, document.write() parses input into tree ops synchronously and flushes the tree ops synchronously by calling nsHtml5TreeOpExecutor::FlushDocumentWrite(). Unlike nsHtml5TreeOpExecutor::RunFlushLoop(), nsHtml5TreeOpExecutor::FlushDocumentWrite() does not sample the clock to return early. Inline scripts that arrive from document.write() are executed synchronously (if the parser isn't already blocked). External scripts arriving from document.write() block the parser. If there is data in document.write() input after a an external script (or any data at all if a previous document.write() call has contained an external script and blocked the parser), the data is left in a linked list of nsHt...
...xecutor and the tree op stage is set as the tree op sink for the tree builder. The executor is told that it's reading from the stage again. If the speculation failed, the first buffer corresponding to the starting point of the speculation gets its start index restored to the index stored on the speculation object. Subsequent buffers get their start index reset back to zero. The tokenizer gets its line number restored from the speculation object. This is equivalent to rewinding the input to where it was when speculation started. All the speculations in the speculation queue are destroyed. Pending tree ops in the tree builder are cleared. The tree op stage is set as the tree op sink for the tree builder. The executor is told that it's reading from the stage again. The state of the main-thread to...
How to get a stacktrace with WinDbg
for Windows->WinDbg) Next, open the "File" menu and choose "Open Executable...". In the file chooser window that appears, open the firefox.exe executable in your Firefox program folder (C:\Program Files\Mozilla Firefox). You should now see a "Command" text window with debug output at the top and an input box at the bottom. Before debugging can start, several commands must be entered into the one-line input box at the bottom of the Command window. Tip: All commands must be entered exactly as written, one line at a time, into the bottom of the Command box. Copying and pasting each line is the easiest method to avoid mistakes Some commands start with a period (.) or a pipe character (|), which is required. (The keystroke for a pipe character on US keyboards is SHIFT+\) Submit the log file...
...g the application and need to close the running instance first before you start debugging, otherwise you won't get useful results. Now run Firefox by opening the Debug menu and clicking Go. While Firefox is running, you will not be able to type any commands into the debugger. After it starts, try to reproduce the crash or hanging issue that you are seeing. If Firefox fails to start, and you see lines of text followed by a command prompt in the debugger, a "breakpoint" may have been triggered. If you are prompted for a command but don't see an error about a crash, go back to the Debug menu and press Go. Once the browser crashes, you will see an error (such as "Access violation") in the WinDbg Command window. If Firefox hangs and there is no command prompt available in the debugger, open the ...
...mation. Q: I'm seeing "wow64" on top of each thread, is that ok ? A: No, you are running a 64 bit version of Windbg and trying to debug a 32 bit version of the mozilla software. Redownload and install the 32 bit version of windbg. Troubleshooting: Symbols will not download If symbols will not download no matter what you do, the problem may be that Internet Explorer has been set to the Work Offline mode. You will not receive any warnings of this in Windbg, Visual C++ or Visual Studio. Even using the command line with symchk.exe to download symbols will fail. This is because Microsoft uses Internet Explorer's internet & proxy settings to download the symbol files. Check the File menu of Internet Explorer to ensure "Work Offline" is unchecked. See also symbol server Maps addresses to huma...
...l C++ or Visual Studio. Even using the command line with symchk.exe to download symbols will fail. This is because Microsoft uses Internet Explorer's internet & proxy settings to download the symbol files. Check the File menu of Internet Explorer to ensure "Work Offline" is unchecked. See also symbol server Maps addresses to human readable strings. ...
Internationalized Domain Names (IDN) Support in Mozilla Browsers
CE prefix "xn--" are now disallowed in IDN. As an example, an output string to be sent to a DNS server for a Japanese domain name, "http://????????.jp", will look like the following in ACE form: http://xn--hckqz9bzb1cyrb.jp Domain Name Registration After the technical standards were established by IETF, the last remaining issue was for domain name registrars to agree on an international guideline on the use of IDN characters. This was accomplished by the publication of the ICANN guideline for IDN in June of 2003. (Cf. ICANN = Internet Corporation for Assigned Names and Numbers.) The guideline allows domain name registrars in each country to limit the use of characters for domain names. Since the Unicode repertoire contains characters no longer used in any living languages and there are al...
... IDN in June of 2003. (Cf. ICANN = Internet Corporation for Assigned Names and Numbers.) The guideline allows domain name registrars in each country to limit the use of characters for domain names. Since the Unicode repertoire contains characters no longer used in any living languages and there are also living characters in most languages that are not suitable for URI/URL creation, the ICANN guideline allows the governing body of each country's domain registrars to set appropriate limitations on the use of characters. With this last piece of obstacle for standardization out of the way, domain name registrars are expected to move forward on implementing the new RFC's for existing and future IDN registrations quickly. JPRS (Japan Registry Service) decided to move to the new RFC implementation ...
...rars to set appropriate limitations on the use of characters. With this last piece of obstacle for standardization out of the way, domain name registrars are expected to move forward on implementing the new RFC's for existing and future IDN registrations quickly. JPRS (Japan Registry Service) decided to move to the new RFC implementation on July 10, 2003, only a few weeks after the ICANN's guideline was published. This makes it possible for Netscape 7.1/Mozilla 1.4 users to access Japanese host names under .jp top domain without any additional setup using just the built-in IDN functionality. Real World Examples Punycode There are real world examples of IDN that you can test with Netscape 7.1, which uses Punycode as the default IDN encoding. For example, Most sample links on the following ...
...web sites around the world are expected to register native language host names with the appropriate domain name registrars for their top domains. Netscape 7.1 and Mozilla 1.4 are playing a significant role in aiding the development of IDN further. Original Document Information Author(s): Katsuhiko Momoi Last Updated Date: 03 Jul 2003 Learn moreEdit General knowledge Emoji Keyboard Online ...
Mozilla Content Localized in Your Language
can be found here. Pluralization What is the appropriate form of expressing pluralization in your language? If yes, list all forms of plural forms and examples if there is more than one. Additional discussions can be found Here. Voice What is the appropriate form of expressing voice in your language? How should emphasis be made in your language? Character styles How are bold, italics, underlines, etc. used to express certain concepts in your language? If these are not applicable styles, what are some of the corresponding ways to express, emphasis or highlight some of the texts. Address Format What is the format in your language? ex: most Asian countries start from big to small: [Country] [postal code][state/province][city][district][street number and name][building and suite numb...
...: [Country] [postal code][state/province][city][district][street number and name][building and suite numbers][addressee] Countries of European languages start from small to big: [addressee][street number and name][building and suite numbers][district][city][state/province][postal code][Country] Name Convention What are the order of family name and given name in your language. Here is the guideline on the naming convention from w3c.org: New Terminology What is your localization team's process for identifying and creating new terminology? Currency Currency and symbol. What are other widely used currency and symbols used in your country/language for paid apps. User Interface Elements Titles Should be brief and precise. Localizers can assume that source content r...
....org: New Terminology What is your localization team's process for identifying and creating new terminology? Currency Currency and symbol. What are other widely used currency and symbols used in your country/language for paid apps. User Interface Elements Titles Should be brief and precise. Localizers can assume that source content reaches 2/3 of the total available line space. This allows localization text to expand and not be truncated or resolved through ellipsis. Title on the final page (meaning no more click through) should allow enough room to display full text. Buttons Capitalize the first letter of each word. Limit to one or two words. Use verbs that precisely describe the button's action. For example, "Cancel", "Clear History...
...nother language may not translate well, when a sentence is half finished as such. ...
Localizing with Koala
e how that works. Running a comparison Open Koala's start page. Select Firefox (3.6) in Application column. Select en-US (included) in Original Locale column. Select x-testing (3.6) in User Locale column. The buttons on the right become active. Click "Compare". A dialog will appear letting you know that Koala is comparing en-US with x-testing. When the comparison is done, you should see a new line in "Last used compares" section of Koala's startpage. It's a handy shortcut to run the comparison in the future. 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. Switch to "Koala file view" in the sidebar (choose it from the list that appears when you click on the arrow pointin...
...o earlier versions in case of errors. Version control systems add a lot of transparency to your work and allow others to get involved easily, so it's best to commit often (e.g. after you finish translating every file, or even more frequently). Koala supports Mercurial and allows you to add and commit files automatically from Komodo. For the purposes of this tutorial, we will switch to the command line every now and then to see what Koala does behind the scenes. Normally though, you don't have to use the command line to commit your work. Assuming that your locale files are in C:\mozilla\l10n\locale\x-testing\3.6 which is where the local Mercurial repository was created (see Creating a new project section), you should be able to successfully issue "hg cmd" commands in that directory (where "cmd"...
...file in the background. Koala will show you a message if the "hg add" was successful. Instead of adding single files, you can also add an entire folder. Since we still need to add searchbar.dtd, let's simply add the entire browser/chrome/browser folder now. Right-click on the folder and choose "add folder to repository". The files have been added to the repository. If you switch to the command line and issue "hg status" again, you should now see that the files are scheduled for addition on the next commit (which is indicated by the letter "A" standing in front of each new file): C:\mozilla\l10n\locale\x-testing\3.6> hg status A browser\chrome\browser\search.properties A browser\chrome\browser\searchbar.dtd You now have to commit the new files to the repository. Right-click on the browser/c...
...o ask yourself a question: "If I was a new person to this project and new nothing about the work already done in this repository, would this message help me understand what changes were made in this revision?". Type a good commit message and click "OK". Koala will execute "hg commit" in the background and will let you know that the files were successfully committed. If you now go to the command line, "hg status" will not display anything (because there are no uncommitted changes in the repository). If you run "hg log" however, you will see you first commit in the repository's revision history: C:\mozilla\l10n\locale\x-testing\3.6> hg log changeset: 0:7c543e8f3a6a tag: tip user: Stas Malolepszy <stas@mozilla.com> date: Mon Nov 23 18:08:25 2009 +0100 summary: Added ...
QA phase
g Additionally, you will need to copy and translate the toolkit/defines.inc file directly from en-US before you can build. This is due to a bug in the build logic. Please either follow the above structure closely or adjust the commands below according to your custom setup. To copy this file to the appropriate directory, do the following: Navigate to your working directory from your command-line terminal (i.e., where you created the folder structure described above). Enter the following commands: mkdir -p l10n-central/x-testing/toolkit/ cp mozilla-aurora/toolkit/locales/defines.inc l10n-central/x-testing/toolkit/defines.inc Tah-dah! Copied! Finally, you will need a file called .mozconfig to proceed with manual builds. This file contains the necessary build instructions. To create...
...illa-aurora and mozilla-beta when building language packs against those two trees you should: remove ac_add_options --disable-compile-environment from .mozconfig in step 3 use ./mach build config after step 4 Update the Mozilla source code: $ cd mozilla-aurora $ hg pull -u Enter the following command to create the .mozconfig file: $ nano -w .mozconfig Enter the following lines in your .mozconfig file: mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/../firefox-build ac_add_options --disable-compile-environment ac_add_options --with-l10n-base=../l10n-central # path relative to MOZ_OBJDIR ac_add_options --enable-application=[browser or mail] You will need to specify which application you're localizing in the fourth line (e.g., for Firefox, that's browser, Thunderbird would be ...
...le-compile-environment ac_add_options --with-l10n-base=../l10n-central # path relative to MOZ_OBJDIR ac_add_options --enable-application=[browser or mail] You will need to specify which application you're localizing in the fourth line (e.g., for Firefox, that's browser, Thunderbird would be mail). Enter the following command to perform the configuration: $ ./mach configure Once your command-line finishes spitting out the config command's output, navigate to the newly created directory: $ cd ../firefox-build/browser/locales Now you're ready to build! At this point you can choose between two build options. You can either: Create a langpack, which is installed on top of your Mozilla application, or Repack the application's binary (aka, a L10n repack), which allows you to install next ...
... your localization: Install Aurora in your preferred language. Install the .xpi langpack you just created (or exported). Set your language using the Quick Locale Switcher or Locale Switcher add-ons by navigating to Tools->Language->Your localization's language code. Restart your browser and start testing! Now you should be able to see all of your work up to this point. Click here for guidelines on how to test your localization. Don't lose your work! Your work is SO important! We would really hate to see you lose any of it. After you test your localization, you should send it to a remote repository, which will serve as a backup for your work and will let others follow your progress. We're going to go through the process below. The official localization teams use repositories at hg.mo...
Translation phase
ecide which l10n tool fits your specific needs. These are the l10n tools we use to localize Mozilla applications: Pootle A user-friendly web portal built on the Translate Toolkit API. This tool includes workspaces for translating strings, reviewing string submissions, and project dashboards. See the instance of Pootle used to localize Mozilla applications. Koala A l10n add-on for the offline, stand-alone Komodo Edit text editor. Mozilla Translator Am offline, stand-alone, Java-based l10n tool that helps you translate and integrates with your repositories. Visit the Mozilla Translator (MT) download page to get your own MT client. Version 5.26 is the latest version. Virtaal An offline, stand-alone version of Pootle that is also built on the Translate Toolkit API. These are the Mo...
...can access rich Web content and enjoy your favorite Firefox features wherever you go. Lightning Lightning is a popular calendaring, scheduling and task management extension. If your locale has an hg repository hosted on the Mozilla servers, you can track your localization's current progress by visiting the l10n dashboards. Note: If you are starting a new localization and decide to use an offline tool for localizing Mozilla applications, you will need to become familiar with using Mercurial (hg). Visit the tutorial on using hg in your localization efforts here. Mozilla websites So you're interested in localizing Mozilla websites. Each l10n tool follows a different workflow for localizing Mozilla web projects. We've linked a brief tutorial to each l10n tool name below. Follow the tutor...
... Mozilla websites within the site itself. Visit Pontoon here. Please note the Pontoon is not available for all web projects yet. These are the Mozilla web projects that are localized using the l10n tools above: mozilla.org Every user's first Mozilla experience. addons.mozilla.org (AMO) A portal for all users interested in finding add-ons for their local Mozilla applications. Read the guidelines on localizing AMO, straight from the AMO team. developer.mozilla.org (MDN) Where you are now! Help localize the MDN user interface for everyone in your region. support.mozilla.com (SUMO) A portal for anyone who needs technical support for their Mozilla applications. Help localize the SUMO user interface for everyone in your region. Mozilla Engagement Campaigns Individual campaigns created ...
... Mozilla web projects. Add-ons l10n for add-ons is handled by at least two other organizations/services called Babelzilla and Adofex. They both have created comprehensive programs and l10n tools for localizing any and all third-party add-ons for Mozilla applications. Visit their websites to learn how to get involved. Babelzilla Adofex Tool-independent localization Are you a command-line master? Do you prefer Unicode text editors to any other applications on Earth? Do you have a pet CAT (computer-assisted translation) tool, like OmegaT? Then you may not be interested in using any of the tools listed above for your localizations. If that is the case, then this section is for you! For localizers who prefer localizing without a specialized tool the workflows for localizing Mozilla ...
Preference reference
ontrols if the reader mode used in Firefox Mobile should be enabled independent of the memory available in the device. ...
...de used in Firefox Mobile should be enabled independent of the memory available in the device. ...
...independent of the memory available in the device. ...
... reader mode in Firefox Mobile is only enabled if the memory is greater than 384MB.ui.alertNotificationOriginui.alertNotificationOrigin controls the position and direction from which popup notifications invoked by nsIAlertsService are sliding in.ui.SpellCheckerUnderlineui.SpellCheckerUnderline holds the colour which is used to underline words not recognized by the spellchecker.ui.SpellCheckerUnderlineStyleui.SpellCheckerUnderlineStyle holds the style which is used to underline words not recognized by the spellchecker.ui.textSelectBackgroundui.textSelectBackground saves the color in which the background of a text selection in the user interface or in content will be styled.ui.textSelectForegroundui.textSelectForeground saves the color in which the text of a text selection in the user interface ...
NSPR Contributor Guide
cepts contributions in the form of bugfixes, new features, libraries, platform ports, documentation, test cases and other items from many sources. We (the NSPR module owners) sometimes disappoint our contributors when we must reject their contributions. We reject contributions for a variety of reasons. Some of these reasons are not obvious to an outside observer. NSPR wishes to document some guidelines for those who would contribute to NSPR. These guidelines should help the contributor in crafting his contribution, increasing its likelihood for acceptance. General Guidelines Downward Compatibility Because many different applications, besides the mozilla client, use the NSPR API, the API must remain downward compatible across even major releases. This means that the behavior of an existing ...
... Should you need to have a similar API, with some slightly different behavior or different function prototype, then suggest a new API with a different name. C Language API The NSPR API is a C Language API. Please do not contribute Java, C or other language wrappers. Coding Style NSPR does not have a documented coding style guide. Look at the extant code. Make yours look like that. Some guidelines concerning naming conventions can be found in NSPR Naming Conventions in the NSPR Reference. See also: XXX Ownership of your contribution When you contribute something to NSPR, you must have intellectual property rights to that contribution. This means that you cannot give us something you snatched from somewhere else;. it must be your own invention, free and clear of encumberment of anyone o...
... you have a good idea; we may say that it really is not a good candidate for inclusion in NSPR; we may give you suggestions on what would make it more generalized, hence a good candidate for inclusion in NSPR. Use Bugzilla to track your work. Be verbose. NSPR wants you to document your work. If we accept it, we are going to have to answer questions about it and/or maintain it. These are some guidelines for new APIs that you may add to NSPR. Header File Descriptions. Provide header file descriptions that fully document your public typedefs, enums, macros and functions. See: prshm.h as an example of how your header file(s) should be documented. Source File Descriptions. Provide descriptive documentation in your source (*.c) files. Alas, we have no source files documented as we think they should ...
... Header File Descriptions. Provide header file descriptions that fully document your public typedefs, enums, macros and functions. See: prshm.h as an example of how your header file(s) should be documented. Source File Descriptions. Provide descriptive documentation in your source (*.c) files. Alas, we have no source files documented as we think they should be. The following are some general guidelines to use when implementing new features: Don't export global variables Your code must be thread safe You must provide test cases that test all APIs you are adding. See: [#TestCases Test Cases] New Libraries All the guidelines applicable to [#NewFeatures New Features] applies to new libraries. For purposes of this paper, a "new library" is defined as a libary under the mozilla/nsprpub/lib di...
NSS Certificate Download Specification
OID must be netscape-cert-sequence (see Object Identifiers). The content field is the following ASN.1 structure: CertificateSequence ::= SEQUENCE OF Certificate See the section below on Certificate Chains for more information about how multiple certificates are handled. Text Formats Any of the above binary formats can also be imported in text form. ...
...ers). The content field is the following ASN.1 structure: CertificateSequence ::= SEQUENCE OF Certificate See the section below on Certificate Chains for more information about how multiple certificates are handled. Text Formats Any of the above binary formats can also be imported in text form. The text form begins with the following line: -----BEGIN CERTIFICATE----- Following this line should be the certificate data, which can be in any of the binary formats described above. This data must be base64 encoded as described by RFC 1113. Following the data should be the following line: -----END CERTIFICATE----- In a text format download, NSS ignores any text before the first BEGIN CERTIFICATE line, and ignores any text after the first END CERTIFICATE line. Between those two li...
...CERTIFICATE----- In a text format download, NSS ignores any text before the first BEGIN CERTIFICATE line, and ignores any text after the first END CERTIFICATE line. Between those two lines, there must be exactly ONE item of any of the supported binary formats described above, and that one item must be base64 encoded. Regardless of which of the supported binary formats is used, the BEGIN and END lines must say CERTIFICATE, and not any other word (such as KEY). The BEGIN and END lines must begin and end with 5 dashes, with no extra leading or trailing white space (excluding the End Of Line characters). Importing Certificate Chains Several of the formats described above can contain several certificates. When NSS's certificate decoder encounters one of these collections of multiple certificate...
... untrusted CA certificates to the local database. This is intended to allow people or CAs to post their e-mail certificates on web pages for download by other users who want to send them encrypted mail. Note: the browser checks that the size of the object being downloaded matches the size of the encoded certificates. Therefore it is important to ensure that no extra characters, such as NULLs or LineFeeds are added at the end of the object. Importing Certificates into NSS-based servers Consult your server's administration guide for the most accurate information. For some NSS-base servers, the following information is correct. Server certificates are imported via the server admin interface. Certificates are pasted into a text input field in an HTML form, and then the form is submitted to th...
NSS Developer Tutorial
Indentation level is 4. Tabs are used heavily in many NSS source files. Try to stay consistent when you modify existing code. The proper use of tabs has often been confusing for new NSS developers, so in nss/lib/ssl, we're gradually removing the use of tabs. Curly braces: both of the following styles are allowed: if (condition) { action1(); } else { action2(); } Or: if (condition) { action1(); } else { action2(); } The former style is more common. When modifying existing code, try to stay consistent. In new code, prefer the former style, as it conserves vertical space. ...
... more common. When modifying existing code, try to stay consistent. In new code, prefer the former style, as it conserves vertical space. When a block of code consists of a single statement, NSS doesn't require curly braces, so both of these examples are fine: if (condition) { action(); } Or: if (condition) action(); although the use of curly braces is more common. Multiple-line comments should be formatted as follows: /* * Line1 * Line2 */ or /* ** Line 1 ** Line 2 */ The following styles are also common, because they conserve vertical space: /* Line1 * Line2 */ or /* Line1 ** Line2 */ or /* Line1 * Line2 */ Naming Public functions are named FOO_DoOneAction. Global, but unexported functions, are usually named foo_DoOneAction. Variable, and function ...
...hout casting. Use char * only if the data is interpreted as text characters. For historical reasons, the buffer length is unsigned int, as opposed to size_t. Unfortunately, this can be a source of integer overflow bugs on 64-bit systems. C Features NSS requires C99. However, not all features from C99 are equally available. Variables can be declared, at the point they are first used. The inline keyword can be used. Variadic macro arguments are permitted, but their use should be limited to using __VA_ARGS__. The exact-width integer types in NSPR should be used, in preference to those declared in <stdint.h> (which will be used by NSPR in the future). Universal character names are not permitted, as are wide character types (char16_t and char32_t). NSS source should only include ASCII t...
... in preference to those declared in <stdint.h> (which will be used by NSPR in the future). Universal character names are not permitted, as are wide character types (char16_t and char32_t). NSS source should only include ASCII text. Escape non-printing characters (with \x if there is no special escape such as \r, \n, and \t) and avoid defining string literals that use non-ASCII characters. One line comments starting with // are permitted. Check with nss-dev@ before using a language feature not already used, if you are uncertain. Please update this list if you do. These restrictions are different for C++ unit tests, which can use most C++11 features. The Mozilla C++ language features guide, and the Chromium C++ usage guide, list C++ features that are known to be widely available and comp...
NSS tools : modutil
Name modutil - Manage PKCS #11 module information within the security module database. Synopsis modutil [options] [[arguments]] STATUS This documentation is still work in progress. Please contribute to the initial review in Mozilla NSS bug 836477[1] Description The Security Module Database Tool, modutil, is a command-line utility for managing PKCS #11 module information both within secmod.db files and within hardware tokens. modutil can add and delete PKCS #11 modules, change passwords on security databases, set defaults, list module contents, enable or disable slots, enable or disable FIPS 140-2 compliance, and assign default providers for cryptographic operations. This tool can also create certificate, key, and module security database files. The tasks associated with...
... this file: o It must be declared in the JAR archive's manifest file. o The script can have any name. o The metainfo tag for this is Pkcs11_install_script. To declare meta-information in the manifest file, put it in a file that is passed to signtool. Sample Script For example, the PKCS #11 installer script could be in the file pk11install. If so, the metainfo file for signtool includes a line such as this: + Pkcs11_install_script: pk11install The script must define the platform and version number, the module name and file, and any optional information like supported ciphers and mechanisms. Multiple platforms can be defined in a single install file. ForwardCompatible { IRIX:6.2:mips SUNOS:5.5.1:sparc } Platforms { WINNT::x86 { ModuleName { "Example Module" } ModuleFile { win3...
... combinations of all of them. --> valuelist valuelist --> value valuelist <null> value ---> key_value_pair string key_value_pair --> key { valuelist } key --> string string --> simple_string "complex_string" simple_string --> [^ \t\n\""{""}"]+ complex_string --> ([^\"\\\r\n]|(\\\")|(\\\\))+ Quotes and backslashes must be escaped with a backslash. A complex string must not include newlines or carriage returns.Outside of complex strings, all white space (for example, spaces, tabs, and carriage returns) is considered equal and is used only to delimit tokens. Keys The Java install file uses keys to define the platform and module information. ForwardCompatible gives a list of platforms that are forward compatible. If the current platform cannot be found in the list of supported...
... security databases follow the more common legacy type. Using the SQLite databases must be manually specified by using the sql: prefix with the given security directory. For example: modutil -create -dbdir sql:/home/my/sharednssdb To set the shared database type as the default type for the tools, set the NSS_DEFAULT_DB_TYPE environment variable to sql: export NSS_DEFAULT_DB_TYPE="sql" This line can be added to the ~/.bashrc file to make the change permanent. Most applications do not use the shared database by default, but they can be configured to use them. For example, this how-to article covers how to configure Firefox and Thunderbird to use the new shared NSS databases: o https://wiki.mozilla.org/NSS_Shared_DB_Howto For an engineering draft on the changes in the shared NSS data...
NSS tools : modutil
Mozilla › Projects › NSS › tools › modutil
Name modutil -- Manage PKCS #11 module information within the security module database. Synopsis modutil [options] arguments Description The Security Module Database Tool, modutil, is a command-line utility for managing PKCS #11 module information both within secmod.db files and within hardware tokens. modutil can add and delete PKCS #11 modules, change passwords on security databases, set defaults, list module contents, enable or disable slots, enable or disable FIPS 140-2 compliance, and assign default providers for cryptographic operations. This tool can also create certificate, key, and module security database files. The tasks associated with security module database management are part of a process that typically also involves managing...
...lared in the JAR archive's manifest file. o The script can have any name. o The metainfo tag for this is Pkcs11_install_script. To declare meta-information in the manifest file, put it in a file that is passed to signtool. Sample Script For example, the PKCS #11 installer script could be in the file pk11install. If so, the metainfo file for signtool includes a line such as this: + Pkcs11_install_script: pk11install The script must define the platform and version number, the module name and file, and any optional information like supported ciphers and mechanisms. Multiple platforms can be defined in a single install file. ForwardCompatible { IRIX:6.2:mips SUNOS:5.5.1:sparc } Platforms { WINNT::x86 { ModuleName { "Example Module" ...
...uelist --> value valuelist <null> value ---> key_value_pair string key_value_pair --> key { valuelist } key --> string string --> simple_string "complex_string" simple_string --> [^ \t\n\""{""}"]+ complex_string --> ([^\"\\\r\n]|(\\\")|(\\\\))+ Quotes and backslashes must be escaped with a backslash. A complex string must not include newlines or carriage returns.Outside of complex strings, all white space (for example, spaces, tabs, and carriage returns) is considered equal and is used only to delimit tokens. Keys The Java install file uses keys to define the platform and module information. ForwardCompatible gives a list of platforms that are forward compatible. If the current platform cannot be found in the ...
...bases follow the more common legacy type. Using the SQLite databases must be manually specified by using the sql: prefix with the given security directory. For example: modutil -create -dbdir sql:/home/my/sharednssdb To set the shared database type as the default type for the tools, set the NSS_DEFAULT_DB_TYPE environment variable to sql: export NSS_DEFAULT_DB_TYPE="sql" This line can be set added to the ~/.bashrc file to make the change permanent. Most applications do not use the shared database by default, but they can be configured to use them. For example, this how-to article covers how to configure Firefox and Thunderbird to use the new shared NSS databases: o https://wiki.mozilla.org/NSS_Shared_DB_Howto For an engineering draft on the changes i...
Tutorial: Embedding Rhino
cript functions JavaScript host objects Defining Host Objects Counter example Counter's constructors Class name Dynamic properties Defining JavaScript "methods" Adding Counter to RunScript RunScript: A simple embedding About the simplest embedding of Rhino possible is the RunScript example. All it does it read a script from the command line, execute it, and print a result. Here's an example use of RunScript from a shell command line: $ java RunScript "Math.cos(Math.PI)" -1 $ java RunScript "function f(x){return x+1} f(7)" 8 Note that you'll have to have both the Rhino classes and the RunScript example class file in the classpath. Let's step through the body of main one line at time. Entering a Context The code Context cx = Co...
...o Rhino. It just collects all the arguments and concatenates them together. String s = ""; for (int i=0; i < args.length; i++) { s += args[i]; } Evaluating a script The code Object result = cx.evaluateString(scope, s, "<cmd>", 1, null); uses the Context cx to evaluate a string. Evaluation of the script looks up variables in scope, and errors will be reported with the filename <cmd> and line number 1. Printing the result The code System.out.println(cx.toString(result)); prints the result of evaluating the script (contained in the variable result). result could be a string, JavaScript object, or other values. The toString method converts any JavaScript value to a string. Exiting the Context The code } finally { Context.exit(); } exits the Context. This removes the associ...
...e can see how to implement java.lang.Runnable in a Rhino shell session: js> obj = { run: function() { print("hi"); } } [object Object] js> obj.run() hi js> r = new java.lang.Runnable(obj); [object Object] js> t = new java.lang.Thread(r) Thread[Thread-0,5,main] js> t.start() hi Adding Java objects The next example is RunScript2. ...
...s> obj.run() hi js> r = new java.lang.Runnable(obj); [object Object] js> t = new java.lang.Thread(r) Thread[Thread-0,5,main] js> t.start() hi Adding Java objects The next example is RunScript2. This is the same as RunScript, but with the addition of two extra lines of code: Object wrappedOut = Context.javaToJS(System.out, scope); ScriptableObject.putProperty(scope, "out", wrappedOut); These lines add a global variable out that is a JavaScript reflection of the System.out variable: $ java RunScript2 "out.println(42)" 42.0 undefined Using JavaScript objects from Java After evaluating a script it's possible to query the scope for variables and functions, extracting values and calling JavaScript functions. This is illustrated in the RunScript3 example. This example adds the ability to pr...
Tracing JIT
ls into the native code stored in the fragment. A schematic diagram of the components of the tracing JIT follows: Generic low level component: nanojit/* The files in the nanojit directory define the nanojit component. nanojit/LIR.* The nanojit/LIR.cpp and nanojit/LIR.h files define the intermediate representation LIR, which is used as input to nanojit. LIR is a conventional three-address, linear SSA code. A single instruction of LIR is called a LIns, short for "LIR instruction". LIns values are depicted in blue in the schematic diagram. In contrast, a single native instruction is called a NIns, and is depicted in red in the schematic diagram. The recorder in jstracer inserts LIns values into a LIR buffer held in a page, itself contained within a logical fragment, and the nanojit compi...
.... A single instruction of LIR is called a LIns, short for "LIR instruction". LIns values are depicted in blue in the schematic diagram. In contrast, a single native instruction is called a NIns, and is depicted in red in the schematic diagram. ...
...lation pipeline and Assembler transform the LIns values into NIns values. nanojit/Fragmento.* The nanojit/Fragment.cpp and nanojit/Fragmento.cpp files define the Fragment and Fragmento classes. A Fragmento is a resource-management object that allocates and stores a set of Fragments and Pages, and manages their lifecycle. A Fragmento owns its associated Fragments. A Fragment represents a single linear code sequence, typically terminating in a jump to another Fragment or back to the beginning of the Fragment. A Fragment's code is stored in a set of associated Pages and GuardRecords allocated from the Fragment's owning Fragmento. A Fragment initially holds no pages. As the compilation pipeline inserts LIR instructions (LIns values) into the Fragment, it allocates Pages to store the LIR code. L...
...ey C functions, and reading from and writing to objects in the SpiderMonkey heap. The native code returns a pointer to a structure called a side exit. The monitor inspects the side exit and, depending on the exit condition, reconstructs a certain number of interpreter frames and flushes a certain set of writes back to the SpiderMonkey heap. Frame reconstruction is necessary because a trace may inline a number of function calls, and may exit before those function calls return. Write flushing is necessary because all writes to imported values in the native stack are deferred until trace-exit, as an optimization. If the side exit condition indicates that the trace exited successfully -- simply running out of native code or hitting a branch condition that no native code yet exists to handle -- t...
JSAPI User Guide
object, you first need a JSClass with the JSCLASS_GLOBAL_FLAGS option. The example below defines a very basic JSClass (named global_class) with no methods or properties of its own. Use JS_NewGlobalObject to create a global object. Use JS_InitStandardClasses to populate it with the standard JavaScript globals. This may seem like a lot of pieces for a simple application. It amounts to about 80 lines of code, as shown below. But the JSAPI is designed to scale to applications that need many global objects. It is a fine-grained API, supporting many different combinations of the parts, and giving applications precise control over how SpiderMonkey behaves. Here is the boilerplate code necessary for a minimal JSAPI application. It contains everything described above. #include "jsapi.h" using n...
...ctPropertyStub, JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, nullptr, nullptr, nullptr, nullptr, JS_GlobalObjectTraceHook }; // The error reporter callback. void reportError(JSContext *cx, const char *message, JSErrorReport *report) { fprintf(stderr, "%s:%u:%s\n", report->filename ? report->filename : "[no filename]", (unsigned int) report->lineno, message); } int run(JSContext *cx) { // Enter a request before running anything in the context. JSAutoRequest ar(cx); // Create the global object and a new compartment. RootedObject global(cx); global = JS_NewGlobalObject(cx, &globalClass, nullptr, JS::DontFireOnNewGlobalHook); if (!global) return 1; // Enter t...
..."inherited" by all instances through delegation up the instance's prototype link. */ my_props, my_methods, /* class constructor properties and methods */ my_static_props, my_static_methods); Running scripts /* These should indicate source location for diagnostics. */ char *filename; unsigned int lineno; /* * The return value comes back here -- if it could be a GC thing, you must * add it to the GC's "root set" with JS_Add*Root(cx, &thing) where thing * is a JSString *, JSObject *, or jsdouble *, and remove the root before * rval goes out of scope, or when rval is no longer needed. */ jsval rval; JSBool ok; /* * Some example source in a C string. Larger, non-null-terminated buffers *...
...sdouble *, and remove the root before * rval goes out of scope, or when rval is no longer needed. */ jsval rval; JSBool ok; /* * Some example source in a C string. Larger, non-null-terminated buffers * can be used, if you pass the buffer length to JS_EvaluateScript. */ char *source = "x * f(y)"; ok = JS_EvaluateScript(cx, globalObj, source, strlen(source), filename, lineno, &rval); if (ok) { /* Should get a number back from the example source. */ jsdouble d; ok = JS_ValueToNumber(cx, rval, &d); . . . } Calling functions /* Call a global function named "foo" that takes no arguments. */ ok = JS_CallFunctionName(cx, globalObj, "foo", 0, 0, &rval); jsval argv[2]; /* Call a function in obj's scope named "method", passing two arguments. */ argv[0...
Running Parsemark
Parsemark is a command-line testing utility for measuring parse/emit performance of the SpiderMonkey front-end. The intent is to run a dozen or so large-payload JS sites globbed up from across the web. Yes, it includes GMail. Here's how you get your mitts on it. The test files are not checked into the source tree because they're non-Mozilla JS code. Download the suite of parse tests from Bug 548621 and decompress them. Within js/src/tests, run python parsemark.py -h to see help documentation. Generally you'll want to capture JSON results for your baseline and compare them to the results for the "current" version of your shell. ...
...hey're non-Mozilla JS code. Download the suite of parse tests from Bug 548621 and decompress them. Within js/src/tests, run python parsemark.py -h to see help documentation. Generally you'll want to capture JSON results for your baseline and compare them to the results for the "current" version of your shell. ...
... of parse tests from Bug 548621 and decompress them. Within js/src/tests, run python parsemark.py -h to see help documentation. Generally you'll want to capture JSON results for your baseline and compare them to the results for the "current" version of your shell. ...
...to capture JSON results for your baseline and compare them to the results for the "current" version of your shell. ...
WebReplayRoadmap
bed here) provides an extremely powerful platform for implementing debugging and analysis features. We would like to use Web Replay to radically improve not just the debugging experience but the entire web development experience. To that end, this document will be revised over time as we find new and better ways of helping developers. Time Travel Features More features are planned for the timeline, as described below. Retroactive Console Logging Console logging is one of the primary tools most developers use to debug a page. Seeing messages in the console provides a simple and intuitive view into the order in which events have happened. Without time travel, using the console requires repeatedly updating the source or the debugger's log points, reloading, and reproducing the bug. This ...
...ight click on it to change it to a log point. In a non-recording tab this will update the console whenever the log point's location executes in the future. In a recording tab, however, this will update the console with messages for every time the location has ever been hit. This requires scanning the recording and the console will not update immediately. These messages will show up on the timeline and can be seeked to in the same way as other console messages. DOM/CSS Integration (partially implemented) When paused, the Inspector panel can be used to inspect the DOM and CSS state of the page. New features are possible with time travel, though, which would be nice to support: Supporting the debugger's event breakpoints would allow searching the recording for places where particular DO...
...sed somewhere in the recording and update graphics with the effects of those changes. Object Watching (not yet implemented) It would be nice to log the changes to a specific object or one of its properties, so that the points of those changes can be seeked to later. 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. Code Path Highlighting (not yet implemented) When paused in a frame, the code path taken through the frame (the lines/expressions executed) could be highlighted somehow, which would make it easier to see what happened in the frame. Points on the path could be clicked to seek there, which should offer faster and less clunky navigation than stepping buttons. Hide Uns...
...ms (Linux, Android) will be easier than Windows, due to the overlap with macOS. There is, however, a partial Windows port from an older version of the architecture that can replay a simple page but not rewind, which should make writing a complete Windows port easier. Cloud Integration (partially implemented) Storing recordings in the cloud and interacting with them via the debugger could streamline several features described above: Difficulties when recording and replaying on different machines with incompatible firefox builds or operating systems will be smoothed out. Recordings can be uploaded, and cloud services can locate the correct build and OS needed to replay them. Management of a corpus of recordings (some which may have been made with different builds or operating systems) wi...
Mozilla internal string guide
et knowing the true size need. If the data that actually needs to be written is larger than the best-case estimate but still fits within the rounded-up capacity, there is no need to reallocate despite requesting the best-case capacity. Cache-friendly means that the zero terminator for C compatibility is written after the new content of the string has been written, so the result is a forward-only linear write access pattern instead of a non-linear back-and-forth sequence resulting from using SetLength() followed by BeginWriting(). Low-level means that writing via a raw pointer is possible as with BeginWriting(). BulkWrite() takes four arguments: The new capacity (which may be rounded up), the number of code units at the beginning of the string to preserve (typically the old logical length), ...
...y own a 64-character buffer allocated in the same storage space as the string itself. If the nsAutoString is allocated on the stack, then it has at its disposal a 64-character stack buffer. This allows the implementation to avoid allocating extra memory when dealing with small strings. nsAutoStringN/nsAutoCStringN are more general alternatives that let you choose the number of characters in the inline buffer. ... nsAutoString value; GetValue(value); // if the result is less than 64 code units, // then this just saved us an allocation ... Member variables In general, you should use the concrete classes nsString and nsCString for member variables. class Foo { ... // these store UTF-8 and UTF-16 values respectively nsCString mLocalName; nsString mTitle; }; ...
...pe used in the DOM. The same as AString with a few odd XPConnect exceptions: When the special JavaScript value null is passed to a DOMString parameter of an XPCOM method, it becomes a void DOMString. The special JavaScript value undefined becomes the string "undefined". C++ Signatures In IDL, in parameters are read-only, and the C++ signatures for *String parameters follows the above guidelines by using const nsAString& for these parameters. out and inout parameters are defined simply as nsAString so that the callee can write to them. IDL C++ interface nsIFoo : nsISupports { attribute AString utf16String; AUTF8String getValue(in ACString key); }; class nsIFoo : public nsISupports { NS_IMETHOD GetUtf16String(nsAString& ...
...may need to be decoded when crossing XPConnect boundaries. This can be a performance hit. On the other hand, UTF-8 strings take up less space for strings that are commonly ASCII. UTF-16 strings defined with wstring or AString are fast when the unicode value is required. However, if the value is more often ASCII, then half of the storage space of the underlying string may be wasted. String Guidelines Follow these simple rules in your code to keep your fellow developers, reviewers, and users happy. Use the most abstract string class that you can. Usually this is: nsAString for function parameters nsString for member variables nsAutoString for local (stack-based) variables Use the ""_ns and u""_ns user-defined literals to represent literal strings (e.g. "foo"_ns) as nsAS...
XPCOM Stream Guide
Mozilla › Tech › XPCOM › Guide › Streams
nk with a spout: the tank may be full, or it may be half-full, or it may be empty. The spout controls how much water you can get out of the tank at a time. The spout is a source of water. If we think of the water as data, then the spout represents an input stream: a controller for data coming out of something. At the same time, there may be some way to put water into the tank - say, a main water line. That water line represents an output stream: a controller for data going into something. The actual data going in to and coming out of an object isn't usually important to a stream. Streams simply provide a way to read or write data to some object. In basic C++ programming for a console application, we usually talk about streams to access files, or to interact with the user. Mozilla's use of s...
...@mozilla.org/binaryoutputstream;1 nsIObjectOutputStream (inherits from nsIBinaryOutputStream) Converter Write to an underlying stream with automatic conversion of Unicode characters. ...
...jectOutputStream (inherits from nsIBinaryOutputStream) Converter Write to an underlying stream with automatic conversion of Unicode characters. ...
...nsIBinaryOutputStream) Converter Write to an underlying stream with automatic conversion of Unicode characters. nsConverterOutputStream @mozilla.org/intl/converter-output-stream;1 nsIConverterOutputStream .init(stream, charset, bufferSize, replaceChar) Additional Stream Interfaces The nsILineInputStream interface supports a .readLine() method for reading a single line from an input stream. The nsFileInputStream and nsPartialFileInputStream classes implement this interface. (XXX nsIUnicharInputStream interface) (XXX nsIUnicharLineInputStream interface) (XXX nsISearchableInputStream interface) Stream Converters (TBD: @mozilla.org/streamConverters;1) Forcing an input stream to be read Suppose you already have an input stream, and something to read from th...
Interfacing with the XPCOM cycle collector
ase/nsCycleCollector.h, but there are convenience macros for annotating your classes in xpcom/glue/nsCycleCollectionParticipant.h that are much easier to use. In general, assuming you are modifying class nsFoo with two nsCOMPtr edges mBar and mBaz, the process can be distilled to a few simple modifications: Include the header nsCycleCollectionParticipant.h in both nsFoo.h and nsFoo.cpp. Add a line declaring that your class nsFoo participates in the cycle collection in nsFoo.cpp: NS_IMPL_CYCLE_COLLECTION_CLASS(nsFoo) Change the line NS_DECL_ISUPPORTS to NS_DECL_CYCLE_COLLECTING_ISUPPORTS in the definition of nsFoo. Add a line NS_DECL_CYCLE_COLLECTION_CLASS(nsFoo) within the public portion of definition of nsFoo. Or NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsFoo, nsIBar) if nsFoo in...
...ORTS in the definition of nsFoo. Add a line NS_DECL_CYCLE_COLLECTION_CLASS(nsFoo) within the public portion of definition of nsFoo. Or NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsFoo, nsIBar) if nsFoo inherits from multiple interfaces, where nsIBar is the interface which is returned when you QueryInterface nsFoo to nsISupports. (We call nsIBar the canonical ISupports type for nsFoo.) Add a line NS_INTERFACE_MAP_ENTRIES_CYCLE_COLLECTION(nsFoo) to the interface map of nsFoo in nsFoo.cpp. ...
... Add the appropriate NS_IMPL_CYCLE_COLLECTION_# macro, where # is the number of member variables in your class. ...
...nsFoo) to the interface map of nsFoo in nsFoo.cpp. Or if that doesn't work: NS_INTERFACE_TABLE_HEAD(nsFoo) NS_INTERFACE_TABLE2(nsFoo, nsIBar, nsIBaz) NS_INTERFACE_TABLE_TO_MAP_SEGUE_CYCLE_COLLECTION(nsFoo) NS_INTERFACE_MAP_END Change the line NS_IMPL_ADDREF(nsFoo) to NS_IMPL_CYCLE_COLLECTING_ADDREF(nsFoo) in nsFoo.cpp, and similarly change the line NS_IMPL_RELEASE(nsFoo) to NS_IMPL_CYCLE_COLLECTING_RELEASE(nsFoo) in nsFoo.cpp. Add the appropriate NS_IMPL_CYCLE_COLLECTION_# macro, where # is the number of member variables in your class. For instance, if nsFoo contains two member variables, mBar and mBaz, we'd add NS_IMPL_CYCLE_COLLECTION_2(nsFoo, mBar, mBaz) in nsFoo.cpp. It is possible that your class has more complicated structure than...
Profiling XPCShell
S_PROFILER_OUTPUT=/tmp/profile.txt Now, run the script using xpcshell. After running has finished, the output file will contain a profile. ...
...ript using xpcshell. After running has finished, the output file will contain a profile. A profile will look like this: file:///Users/michiel/Mozilla/tree1/...js/calUtils.js [2,25420] createDateTime() {60-62} 579 {min 0, max 3, avg 0, sum 427, self 427} [2,56810] cp_QI() {860-866} 835 {min 0, max 1, avg 0, sum 950, self 950} The first line tells which file was profiled. ...
...ntain a profile. A profile will look like this: file:///Users/michiel/Mozilla/tree1/...js/calUtils.js [2,25420] createDateTime() {60-62} 579 {min 0, max 3, avg 0, sum 427, self 427} [2,56810] cp_QI() {860-866} 835 {min 0, max 1, avg 0, sum 950, self 950} The first line tells which file was profiled. Then, the next lines shows the amount of time spend in the functions in that file. ...
...eDateTime() {60-62} 579 {min 0, max 3, avg 0, sum 427, self 427} [2,56810] cp_QI() {860-866} 835 {min 0, max 1, avg 0, sum 950, self 950} The first line tells which file was profiled. Then, the next lines shows the amount of time spend in the functions in that file. The line consists of: The compile count of the function; The call count of the function; The functions name; The starting line number; The ending line number; The function's size; The amount of time (in milliseconds) the fastest call took; The time of the slowest call; The average time spend; The total time; The time spend in the function itself is given (that is the total time excluding the time spend in functions called from this function). Notes You need a trunk build from after 2007-05-28. Using an earlier ...
Observer Notifications
ata value is an nsISupportsPRBool). quit-application-granted All observers have agreed to the shutdown. quit-application The application is about to quit. This can be in response to a normal shutdown, or a restart. Note: The data value for this notification is either 'shutdown' or 'restart'. profile-change-net-teardown The network connection is going offline at this point. Note: The data value for this notification is always 'shutdown-persist'. profile-change-teardown Part of the shutdown, profile data is still available at this point. Note: The data value for this notification is always 'shutdown-persist'. profile-before-change Called just before the profile is lost. Note: The data value for this notificat...
...e a WindowGlobalParent is destroyed. By this point, the WGP being destroyed will have cleaned up most of its state, including its BrowsingContext children and JSWindowActors. Additionally, it will have been removed from any WindowContext tree it was part of. IO Notifications These topics can be used to watch the IO service for useful information. Topic Description offline-requested Called to query whether the application can go offline. The attempt to go offline can be canceled. Note: If your code chooses to cancel the attempt to go offline, it must notify the user. network:offline-about-to-go-offline Called just before all network IO is taken offline. network:offline-status-changed Called when the offline state has changed. ...
... network:link-status-changed Called when the network link status changes. HTTP requests These are the topics that you can observe during a HTTP request (see Setting HTTP request headers and Creating Sandboxed HTTP Connections). Both are passed an nsIHttpChannel as the subject parameter. ...
... network:link-status-changed Called when the network link status changes. HTTP requests These are the topics that you can observe during a HTTP request (see Setting HTTP request headers and Creating Sandboxed HTTP Connections). Both are passed an nsIHttpChannel as the subject parameter. ...
jsdIStackFrame
dIExecutionHook which gave it to you. After you return from that handler the bottom frame, and any frame you found attached through it, are invalidated via the jsdIEphemeral interface. Once a jsdIStackFrame has been invalidated all method and property accesses will throw a NS_ERROR_NOT_AVAILABLE exception. Method overview boolean eval(in AString bytes, in AUTF8String fileName, in unsigned long line, out jsdIValue result); Attributes Attribute Type Description callee jsdIValue Function object running in this stack frame. Read only. callingFrame jsdIStackFrame Link to the caller's stack frame. Read only. executionContext jsdIContext Executon context. Read only. functionName AUTF8String Function name executing in this stack frame. Read only. isConstructing boolean True if stack...
... created as a result of a debugger evaluation. Read only. isNative boolean True if stack frame represents a native frame. Read only. Obsolete since Gecko 2.0 JSDContext JSDContext Internal use only. Read only. Native code only! JSDStackFrameInfo JSDStackFrameInfo Internal use only. Read only. Native code only! JSDThreadState JSDThreadState Internal use only. Read only. Native code only! line unsigned long Current line number (using the script's pc to line map.) Read only. pc unsigned long Current program counter in this stack frame. Read only. scope jsdIValue Top object in the scope chain. Read only. script jsdIScript Script running in this stack frame, null for native frames. Read only. thisValue jsdIValue |this| object for this stack frame. Read only. Methods eval() Eval...
...n this stack frame. Read only. scope jsdIValue Top object in the scope chain. Read only. script jsdIScript Script running in this stack frame, null for native frames. Read only. thisValue jsdIValue |this| object for this stack frame. ...
...hisValue jsdIValue |this| object for this stack frame. Read only. Methods eval() Evaluate arbitrary JavaScript in this stack frame. ...
nsIApplicationCache
1.0 66 Introduced Gecko 1.9.1 Inherits from: nsISupports Last changed in Gecko 2.0 (Firefox 4 / Thunderbird 3.3 / SeaMonkey 2.1) Each application cache has a unique client ID for use with nsICacheService.openSession() method, to access the cache's entries. Each entry in the cache can be marked with a set of types, specified in the Constants section. All application caches with the same group ID belong to a cache group. ...
...g typeBits); void unmarkEntry(in ACString key, in unsigned long typeBits); Attributes Attribute Type Description active boolean true if the cache is the active cache for this group, otherwise false. Read only. clientID ACString The client ID for this application cache. Clients can open a session with nsICacheService.createSession() using this client ID and a storage policy of STORE_OFFLINE to access this cache. Read only. groupID ACString The group ID for this cache group. This is the URI of the cache manifest file. Read only. usage unsigned long The disk usage of the application cache, in bytes. Read only. Constants Constant Value Description ITEM_MANIFEST 1 This item is the application manifest. ITEM_EXPLICIT 2 This item was explicitly listed in the application mani...
...nstants for a list of types. unmarkEntry() Removes types from a given entry. If the resulting entry has no types left, the entry is removed. ...
...unmarkEntry( in ACString key, in unsigned long typeBits ); Parameters key The key for the cache entry from which to remove types. ...
nsICachingChannel
ttribute is usually only settable during the processing of a channel's OnStartRequest. The default value of this attribute depends on the particular implementation of nsICachingChannel. cacheFile nsIFile Get the "file" where the cached data can be found. This is valid for as long as a reference to the cache token is held. This may return an error if cacheAsFile is false. Read only. cacheForOfflineUse boolean Specifies whether or not the data should be placed in the offline cache, in addition to normal memory/disk caching. This may fail if the offline cache is not present. The value of this attribute should be set before opening the channel. cacheKey nsISupports Uniquely identifies the data in the cache for this channel. Holding a reference to this key does not prevent the cached data f...
...be set on another instance of nsICachingChannel provided the underlying implementations are compatible. The implementation of nsICachingChannel would be expected to only read from the cache entry identified by the cache token and not try to validate it. The cache token can be QueryInterface'd to a nsICacheEntryInfo if more detail about the cache entry is needed. For example, expiration time. offlineCacheClientID ACString The session into which to cache offline data. If not specified, data will be placed in "HTTP-offline". offlineCacheToken nsISupports The same as cacheToken but accessing the offline app cache token if there is any. Exceptions thrown NS_ERROR_NOT_AVAILABLE When there is not offline cache token. Constants Constant Value Description LOAD_NO_NETWORK_IO 1 << 26 Th...
...complete the request. This flag can be used to find out whether fetching this URL would cause validation of the cache entry via the network. Combining this flag with LOAD_BYPASS_LOCAL_CACHE will cause all loads to fail. This flag differs from LOAD_ONLY_FROM_CACHE in that this flag fails the load if validation is required while LOAD_ONLY_FROM_CACHE skips validation where possible. LOAD_CHECK_OFFLINE_CACHE 1 << 27 This load flag causes the offline cache to be checked when fetching a request. It will be set automatically if the browser is offline. This flag will not be transferred through a redirect. LOAD_BYPASS_LOCAL_CACHE 1 << 28 This load flag causes the local cache to be skipped when fetching a request. Unlike LOAD_BYPASS_CACHE, it does not force an end-to-end load (That is, it does no...
...29 This load flag causes the local cache to be skipped if the request would otherwise block waiting to access the cache. LOAD_ONLY_FROM_CACHE 1 << 30 This load flag inhibits fetching from the net if the data in the cache has been evicted. An error of NS_ERROR_DOCUMENT_NOT_CACHED will be sent to the listener's onStopRequest in this case. This flag is set automatically when the application is offline. LOAD_ONLY_IF_MODIFIED 1 << 31 This load flag controls what happens when a document would be loaded from the cache to satisfy a call to AsyncOpen. If this attribute is set to true, then the document will not be loaded from the cache. A stream listener can check isFromCache() to determine if the AsyncOpen will actually result in data being streamed. If this flag has been set, and the request ca...
nsIDOMStorageManager
dom/interfaces/storage/nsIDOMStorageManager.idlScriptable This interface provides methods for managing data stored in the offline apps cache. 1.0 66 Introduced Gecko 1.9 Inherits from: nsISupports Last changed in Gecko 2.0 (Firefox 4 / Thunderbird 3.3 / SeaMonkey 2.1) Implemented by @mozilla.org/dom/storagemanager;1 as a service: var domStorageManager = Components.classes["@mozilla.org/dom/storagemanager;1"] .getService(Components.interfaces.nsIDOMStorageManager); Method overview void clearOfflineApps(); nsIDOMStorage getLocalStorageForPrincipal(in nsIPrincipal aPrincipal, in DOMString aDocumentURI); long getUsage(in AString aOwnerDomain); Methods clearOfflineApps() Clears keys owned by offline applications. All data o...
...getLocalStorageForPrincipal() Returns the instance of the localStorage object for aURI's origin. This is used to ensure that only one local storage area exists for a given origin. ...
...getLocalStorageForPrincipal() Returns the instance of the localStorage object for aURI's origin. This is used to ensure that only one local storage area exists for a given origin. ...
...value The local storage object for the specified principal. ...
nsIEditor
nUndo); void redo(in unsigned long count); void canRedo(out boolean isEnabled, out boolean canRedo); void beginTransaction(); void endTransaction(); void beginPlaceHolderTransaction(in nsIAtom name); void endPlaceHolderTransaction(); boolean shouldTxnSetSelection(); void setShouldTxnSetSelection(in boolean should); Inline Spellchecking Methods nsIInlineSpellChecker getInlineSpellChecker(in boolean autoCreate); void syncRealTimeSpell(); void setSpellcheckUserOverride(in boolean enable); Clipboard Methods void cut(); boolean canCut(); void copy(); boolean canCopy(); void paste(in long aSelectionType); boolean canPaste(in long a...
...ing(in AString formatType, in unsigned long flags); Example: // flags are declared in base/public/nsIDocumentEncoder.idl // OutputSelectionOnly = 1, OutputFormatted = 2, // OutputRaw = 4, OutputBodyOnly = 8, // OutputPreformatted = 16, OutputWrap = 32, // OutputFormatFlowed = 64, OutputAbsoluteLinks = 258, // OutputEncodeW3CEntities = 256, OutputCRLineBreak = 512, // OutputLFLineBreak = 1024, OutputNoScriptContent = 2048, // OutputNoFramesContent = 4096, OutputNoFormattingInPre = 8192, // OutputEncodeBasicEntities=16384, OutputEncodeLatin1Entities=32768, // OutputEncodeHTMLEntities=65536, OutputPersistNBSP=131072 editorAPI.outputToString('text/html', 2); editorAPI.outputToString('text/plain', 4); // output the body tag, body childr...
... document Document Read only. The DOM Document this editor is associated with. documentCharacterSet ACString Sets the current 'Save' document character set. documentIsEmpty boole...
... document Document Read only. The DOM Document this editor is associated with. documentCharacterSet ACString Sets the current 'Save' document character set. documentIsEmpty boolean Read only. Returns true if ...
nsIHTTPHeaderListener
vide an instance to {GetURL,PostURL}() that implements both nsIPluginStreamListener and nsIHTTPHeaderListener. This instance is passed in through {GetURL,PostURL}()'s streamListener parameter. The browser will then QI this streamListener to see if it implements nsIHTTPHeaderListener. Method overview void newResponseHeader(in string headerName, in string headerValue); void statusLine(in string line); Methods newResponseHeader() Called for each HTTP Response header. Note: You must copy the values of the params. void newResponseHeader( in string headerName, in string headerValue ); Parameters headerName headerValue statusLine() Called once for the HTTP Response status line. Value does not include a terminating newline. Note: You must copy this ...
... Methods newResponseHeader() Called for each HTTP Response header. Note: You must copy the values of the params. ...
...ResponseHeader() Called for each HTTP Response header. Note: You must copy the values of the params. ...
...or each HTTP Response header. Note: You must copy the values of the params. ...
nsIMsgMessageService
IURI aURL); void openAttachment(in string aContentType, in string aFileName, in string aUrl, in string aMessageUri, in nsISupports aDisplayConsumer, in nsIMsgWindow aMsgWindow, in nsIUrlListener aUrlListener); void SaveMessageToDisk(in string aMessageURI, in nsIFileSpec aFile, in boolean aGenerateDummyEnvelope, in nsIUrlListener aUrlListener, out nsIURI aURL, in boolean canonicalLineEnding, in nsIMsgWindow aMsgWindow); void GetUrlForUri(in string aMessageURI, out nsIURI aURL, in nsIMsgWindow aMsgWindow); void DisplayMessageForPrinting(in string aMessageURI, in nsISupports aDisplayConsumer, in nsIMsgWindow aMsgWindow, in nsIUrlListener aUrlListener, out nsIURI aURL); void Search(in nsIMsgSearchSession aSearchSession, in nsIMsgWindow aMsgWindow, in ns...
...ration of course.Note: You must pass in a url listener in order to figure out when the operation is done. ...
... Note: This operation may be obsolete. You always can use streamMessage to get the eml string representation of the message and then write it using File I/O Methods. ...
...aAvailable method, you can write out the stream data to a local file or concatenate it to a string. aUrlListener An nsIUrlListener that is notified when url starts and stops, if we run a url. aLocalOnly Whether data should be retrieved only from local caches. If streaming over the network is required and this is true, then an exception is thrown. This defaults to false. Note If we're offline, then even if aLocalOnly is false, we won't stream over the network Return The URL that gets run, if any isMsgInMemCache() Determines whether a message is in the memory cache. Local folders don't implement this. boolean isMsgInMemCache(in nsIURI aUrl, in nsIMsgFolder aFolder, out nsICacheEntryDescriptor aCacheEntry); Parameters aUrl The...
nsISupports
nsrefcnt AddRef(); Parameters None. ...
...nsrefcnt AddRef(); Parameters None. ...
...nsrefcnt AddRef(); Parameters None. Return value An integer value that is generally ignored. ...
...s a symmetric, transitive, and reflexive operator. void QueryInterface( in nsIIDRef uuid, [iid_is(uuid),retval] out nsQIResult result ); Parameters uuid The uuid of the requested interface result The resulting interface pointer. Exceptions thrown NS_ERROR_NO_INTERFACE The requested interface is not available. Violates the XPCOM interface guidelines Release() Notifies the object that an interface pointer has been destroyed and any resources the object held on behalf of the client can be released. nsrefcnt Release(); Parameters None. Return value An integer value that is generally ignored. Remarks The method descriptions above were taken from Essential COM by Don Box. The point of those descriptions is to highlight the fact that AddRef()...
nsIVariant
ince any nsIVariant object will be automatically converted to a JS type anyway. ...
...etAsAUTF8String(); Native code only! PRBool getAsBool(); Native code only! char getAsChar(); Native code only! DOMString getAsDOMString(); Native code only! double getAsDouble(); Native code only! float getAsFloat(); Native code only! nsresult getAsID(out nsID retval); Violates the XPCOM interface guidelines PRInt16 getAsInt16(); Native code only! PRInt32 getAsInt32(); Native code only! PRInt64 getAsInt64(); Native code only! PRUint8 getAsInt8(); Native code only! void getAsInterface(out nsIIDPtr iid, [iid_is(iid), retval] out nsQIResult iface); Native code only! nsISupports getAsISupports(); Native code ...
...Native code only!getAsACString ACString getAsACString(); Parameters None. Return value The value is converted to an 8-bit string in the ISO-8859-1 character set. If the value was UTF16 then the high bits are lost. If the value was UTF8 then it is converted to UTF16 and the high bits are discarded. Arrays and interface pointers cannot be converted to a string. Violates the XPCOM interface guidelines getAsArray() nsresult getAsArray( out PRUint16 type, out nsIID iid, out PRUint32 count, out voidPtr ptr ); Parameters type The type of the array elements. iid The IID of the array elements, if they are interface pointers. count The number of elements in the array. ptr A copy of the array of underlying elements. (Reference count...
...n value If the internal value is a string, it is converted to a double, if possible. If it is of a numeric type it is cast directly to double. Native code only!getAsFloat float getAsFloat(); Parameters None. Return value If the internal value is a string, it is first converted to a double, if possible. If it is of a numeric type, it is cast directly to float. Violates the XPCOM interface guidelines getAsID() nsresult getAsID( out nsID retval ); Parameters retval If the internal value is an IID then it is returned. If it is of type interface pointer then then IID of the pointer is returned. If it is of string type then an attempt is made to convert the string to an IID. Return value If the conversion succeeds, NS_OK is returned, otherwise NS_ERROR_CANNOT_CONVERT_DATA i...
Using js-ctypes
Before you can use js-ctypes, you need to import the ctypes.jsm code module. This is as simple as including the following line of code in the desired JavaScript scope: Components.utils.import("resource://gre/modules/ctypes.jsm") Loading a native library Once you've imported the code module, you can call the ctypes.open() method to load each native library you wish to use. On Windows, for example, you might load the system user32 library like this: var lib = ctypes.open("user32.dll"); On Mac OS X, you can load the Core Foundation library from the Core Foundation framework like this: var coreFoundation = ctypes.open("/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation"); The returned object is a Library object that you use to declare functions and data types for use wit...
...Line 6 declares msgBox() to be a method that calls the Windows function MessageBoxW. Line 15 calls the msgBox() routine, which displays the alert. The last thing we do is call lib.close() to close the library when we're done using it. Instead of defining the whole path, you may also just give the file name. ABOUT DECLARING THE FUNCTION How we knew h...
...geBoxW", ctypes.winapi_abi, ctypes.int32_t, ctypes.int32_t, ctypes.jschar.ptr, ctypes.jschar.ptr, ctypes.int32_t); var MB_OK = 0; var ret = msgBox(0, "Hello world", "title", MB_OK); lib.close(); In line 3, the user32.dll system library is loaded. Line 6 declares msgBox() to be a method that calls the Windows function MessageBoxW. Line 15 calls the msgBox() routine, which displays the alert. The last thing we do is call lib.close() to close the library when we're done using it. Instead of defining the whole path, you may also just give the file name. ABOUT DECLARING THE FUNCTION How we knew how to declare the function was by going to MSDN s...
... = stdAlert(1, msgErr, msgExp, 0, hit); carbon.close(); The makeStr() function is a utility routine that takes as input a standard JavaScript string and returns a Carbon-style "Pascal" string, which is a length byte followed by the characters of the string itself. Note that this only works correctly if the string is in fact under 256 characters; if it's longer, this will fail spectacularly. In line 9, the Carbon library is loaded from the system's Carbon framework. Line 11 declares the stdAlert() function, which will call the Carbon StandardAlert routine. It uses the default ABI, returns a 16-bit integer (which is a Carbon OSErr value), and accepts an integer (the alert type), two strings, a pointer to a parameter block, which we aren't using, and another integer, which is used to return t...
Edit fonts - Firefox Developer Tools
rols for editing the fonts' characteristics. For standard (static) fonts, you will be able to change the settings listed below Size The font-size for the inspected element. This can be set using em, rem, %, px, vh, or vw units. You can select values using the slider or enter a numeric value directly into the text box. Note: If you want to use a different unit such as pt for font-size or line-height, you can set the property value applied to the currently inspected element to use that unit via the rules view, and the font editor will automatically pick it up and make it available in the associated units dropdown menu. Changing the unit of measure converts the numerical value to its equivalent in the new unit, so the same computed value is maintained. Example: If 1rem is equivalent ...
...that unit via the rules view, and the font editor will automatically pick it up and make it available in the associated units dropdown menu. Changing the unit of measure converts the numerical value to its equivalent in the new unit, so the same computed value is maintained. Example: If 1rem is equivalent to 10 pixels, when you change the unit of measurement from rem to px, 2rem becomes 20px. Line height The line-height of the inspected element. This can be set using unitless, em, %, or px units. You can select values using the slider or enter a numeric value directly into the text box. Changing the unit of measure changes the value relative to the font-size setting. Example: If the font is 20 pixels high and the line-height is 1.5em, when you change the unit of measure from em to px...
...alue directly into the text box. For non-variable fonts the slider ranges from 100 to 900 in increments of 100. Note: For variable fonts (see below) that define a wght variation axis, this range is custom. Italic The font-style for the inspected element. This setting toggles between italic and normal values for the font-style CSS property. Note: As you change settings, Firefox applies inline styles to the element to make the changes instantly visible on the page. All fonts on page The remaining area, at the bottom of the Fonts tab, shows an expandable list of all of the fonts in use on the page. The list is useful because you can easily determine whether a font is a web font or a font hosted on your system. Each font listed in this section shows you: The font-family identif...
...This makes it easy to see exactly what is being applied where, when font stacks are specified. ...
View Source - Firefox Developer Tools
TML or XML source for the page you're viewing. To activate View Source: context-click in the page and select View Page Source press Ctrl + U on Windows and Linux, or Cmd + U on macOS The command opens a new tab with the source for the current page. View Source features View Source has three additional features, which can be accessed from the context menu in the View Source tab: Go to Line Scrolls to the specified line. If the number is higher than the lines in a file, you receive an error message. Wrap Long Lines (toggle) Wraps long lines to the width of the page. Syntax Highlighting (toggle) Applies syntax highlighting to the code.When syntax highlighting is on, View Source also highlights parsing errors in red. Hovering your mouse over errors displays a tooltip explaining t...
... Link to a line number It is possible to link to a particular line, by adding the #lineNNN anchor to the url the browser will jump to the NNN line. ...
... (toggle) Applies syntax highlighting to the code.When syntax highlighting is on, View Source also highlights parsing errors in red. Hovering your mouse over errors displays a tooltip explaining the error. This feature is useful when you're looking for HTML errors. To access Go to Line from the keyboard, press Control + Option + L on macOS, or Alt + Shift + L on Windows or Linux. ...
...hen syntax highlighting is on, View Source also highlights parsing errors in red. Hovering your mouse over errors displays a tooltip explaining the error. This feature is useful when you're looking for HTML errors. To access Go to Line from the keyboard, press Control + Option + L on macOS, or Alt + Shift + L on Windows or Linux. Link to a line number It is possible to link to a particular line, by adding the #lineNNN anchor to the url the browser will jump to the NNN line. For example view-source:https://www.mozilla.org/#line100 View Selection Source If you select part of a web page and conext-click, you'll see a context menu item labeled "View Selection Source", that behaves just like "View Page Source", except you only see the source for the selection. View MathML Source If you ...
Console messages - Firefox Developer Tools
Not all console messages contain icons. The following icons may be used: Informational message Warning Error Blocked; for network messages In addition, a disclosure triangle indicates that further information is available; clicking it displays or collapses that information. Message The message itself. Number of occurrences If a line that generates a warning or error is executed more than once, it is only logged once and this counter appears to indicate how many times it was encountered. Filename and line number For JavaScript, CSS and console API messages, the message can be traced to a specific line of code. The console then provides a link to the filename and line number that generated the message. ...
...message display pane. Export Visible Messages To Clipboard copies all messages available in the display pane to the clipboard. File opens a file dialog box so you can save an export of all messages available in the display pane. Message categories Network Network log messages are not shown by default. Use the filtering feature to show them. Network requests are logged with a line that looks like this: Time The time the message was recorded. Method The specific HTTP request method. If the request was made as an XMLHttpRequest, there's an additional "XHR" tag indicating this. If more information is available, a disclosure triangle lets you display it, in an embedded panel that is identical to the Network Monitor request details. ...
...riggered them. Reflow events are logged as "Reflow" messages, as distinct from CSS errors or warnings. By default, they are disabled. You can enable them by clicking the "CSS" button in the toolbar and selecting "Reflows". Each message is labeled "reflow" and shows the time taken to execute the reflow. If the reflow is a synchronous reflow triggered from JavaScript, it also shows a link to the line of code that triggered the reflow. Click the link to open the file in the Debugger. Synchronous and asynchronous reflows If a change is made that invalidates the current layout -- for example, the browser window is resized or some JavaScript modifies an element's CSS -- the layout is not recalculated immediately. Instead, the reflow happens asynchronously, the next time the browser decides it n...
...their effect at once. However, if some JavaScript code reads a style that has been modified, then the browser must perform a synchronous reflow in order to calculate the computed style to return. For example, code like this will cause an immediate, synchronous, reflow, when it calls window.getComputedStyle(thing).height: var thing = document.getElementById("the-thing"); thing.style.display = "inline-block"; var thingHeight = window.getComputedStyle(thing).height; Because of this, it's a good idea to avoid interleaving write and read calls to an element's styles when manipulating the DOM, because every time you read back a style that has been invalidated by a previous write call, you force a synchronous reflow. Security The security messages shown in the Web Console help developers find po...
Web Console remoting - Firefox Developer Tools
he same as the request object in the above example request packet. Page errors Page errors come from the nsIConsoleService. Each allowed page error is an nsIScriptError object. The pageError packet is: { "from": "conn0.console9", "type": "pageError", "pageError": { "errorMessage": "ReferenceError: foo is not defined", "sourceName": "http://localhost/~mihai/mozilla/test.js", "lineText": "", "lineNumber": 6, "columnNumber": 0, "category": "content javascript", "timeStamp": 1347294508210, "error": false, "warning": false, "exception": true, "strict": false, "private": false, } } The packet is similar to nsIScriptError - for simplicity. We only removed several unneeded properties and changed how flags work. The private flag tells if th...
...1347294508210, "error": false, "warning": false, "exception": true, "strict": false, "private": false, } } The packet is similar to nsIScriptError - for simplicity. We only removed several unneeded properties and changed how flags work. The private flag tells if the error comes from a private window/tab (added in Firefox 24). Starting with Firefox 24 the errorMessage and lineText properties can be long string actor grips if the string is very long. Console API messages The window.console API calls send internal messages throughout Gecko which allow us to do whatever we want for each call. The Web Console actor sends these messages to the remote debugging client. We use the ObjectActor from dbg-script-actors.js without a ThreadActor, to avoid slowing down the page s...
...Console API messages come through the nsIOb serverService - the console object implementation lives in dom/base/ConsoleAPI.js. ...
...tActor and frameActor options to the evaluateJS request packet. Firefox 24: new private flags for the console actor notifications, bug 874061. Also added the lastPrivateContextExited notification for the global console actor. Firefox 24: new isXHR flag for the networkEvent notification, bug 859046. Firefox 24: removed the message property from the pageError packet notification, bug 877773. The lineText and errorMessage properties can be long string actors now. Firefox 25: added the url option to the evaluateJS request packet. Firefox 25: added the getPreferences and sendHTTPRequest request packets to the console actor, bug 886067 and bug 731311. Conclusions As of this writing, this document is a dense summary of the work we did in bug 768096 and subsequent changes. We try to keep this ...
Animation - Web APIs
Web › API › Animation
Animation.effect Gets and sets the AnimationEffectReadOnly associated with this animation. This will usually be a KeyframeEffect object. ...
... Animation.effect Gets and sets the AnimationEffectReadOnly associated with this animation. This will usually be a KeyframeEffect object. ...
...animation. Animation.ready Read only Returns the current ready Promise for this animation. animation.replaceState Returns the replace state of the animation. This will be active if the animation has been replaced, or persisted if Animation.persist() has been invoked on it. Animation.startTime Gets or sets the scheduled time when an animation's playback should begin. Animation.timeline Gets or sets the timeline associated with this animation. Event handlers Animation.oncancel Gets and sets the event handler for the cancel event. Animation.onfinish Gets and sets the event handler for the finish event. animation.onremove Allows you to set and run an event handler that fires when the animation is removed (i.e., put into an active replace state). Methods Animation.c...
...ing or disabling animation, as well as using the Reduced Motion Media Query to create a complimentary experience for users who have expressed a preference for no animated experiences. Designing Safer Web Animation For Motion Sensitivity . An A List Apart Article An Introduction to the Reduced Motion Media Query | CSS-Tricks Responsive Design for Motion | WebKit MDN Understanding WCAG, Guideline 2.2 explanations Understanding Success Criterion 2.2.2 | W3C Understanding WCAG 2.0 Specifications Specification Status Comment Web AnimationsThe definition of 'Animation' in that specification. Working Draft Initial definition ...
AnimationEvent - Web APIs
The AnimationEvent interface represents events providing information related to animations. ...
... The AnimationEvent interface represents events providing information related to animations. ...
...play: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 70" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/Event" target="_top"><rect x="1" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="38.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">Event</text></a><polyline points="76,25 86,20 86,30 76,25" stroke="#D4DDE4" fill="none"/><line x1="86" y1="25" x2="116" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/AnimationEvent" target="_top"><rect x="116" y="1" width="140" height="50" fill="#F4F7F8" stroke="#D4DDE4" stroke-width="2px" /><text x="186" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monos...
... Properties Also inherits properties from its parent Event. ...
AudioNode - Web APIs
Web › API › AudioNode
The AudioNode interface is a generic interface for representing an audio processing module. Examples include: an audio source (e.g. an HTML <audio> or <video> element, an OscillatorNode, etc.), the audio destination, intermediate processing module (e.g. ...
...<audio> or <video> element, an OscillatorNode, etc.), the audio destination, intermediate processing module (e.g. ...
... inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 70" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/AudioNode" target="_top"><rect x="151" y="1" width="90" height="50" fill="#F4F7F8" stroke="#D4DDE4" stroke-width="2px" /><text x="196" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,...
... Description The audio routing graph Each AudioNode has inputs and outputs, and multiple audio nodes are connected to build a processing graph. ...
BeforeInstallPromptEvent - Web APIs
The BeforeInstallPromptEvent is fired at the Window.onbeforeinstallprompt handler before a user is prompted to "install" a web site to a home screen on mobile. This interface inherits from the Event interface. ...
...reInstallPromptEvent is fired at the Window.onbeforeinstallprompt handler before a user is prompted to "install" a web site to a home screen on mobile. This interface inherits from the Event interface. ...
...play: inline-block; position: absolute; top: 0; left: 0;" viewbox="-20 0 700 60" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/Event" target="_top"><rect x="1" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="38.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">Event</text></a><polyline points="76,25 86,20 86,30 76,25" stroke="#D4DDE4" fill="none"/><line x1="86" y1="25" x2="116" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/BeforeInstallPromptEvent" target="_top"><rect x="116" y="1" width="240" height="50" fill="#F4F7F8" stroke="#D4DDE4" stroke-width="2px" /><text x="236" y="30" font-size="12px" font-family="Consolas,Monaco,Andale ...
... Properties Inherits properties from its parent, Event. ...
BeforeUnloadEvent - Web APIs
alue Event property, a dialog box appears, asking the users for confirmation to leave the page (see example below). When no value is provided, the event is processed silently. Some implementations only show the dialog box if the frame or any embedded frame receives a user gesture or user interaction. See Browser compatibility for more information. ...
... provided, the event is processed silently. Some implementations only show the dialog box if the frame or any embedded frame receives a user gesture or user interaction. See Browser compatibility for more information. ...
...lay: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/Event" target="_top"><rect x="1" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="38.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">Event</text></a><polyline points="76,25 86,20 86,30 76,25" stroke="#D4DDE4" fill="none"/><line x1="86" y1="25" x2="116" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/BeforeUnloadEvent" target="_top"><rect x="116" y="1" width="170" height="50" fill="#F4F7F8" stroke="#D4DDE4" stroke-width="2px" /><text x="201" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,mo...
...6,30 76,25" stroke="#D4DDE4" fill="none"/><line x1="86" y1="25" x2="116" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/BeforeUnloadEvent" target="_top"><rect x="116" y="1" width="170" height="50" fill="#F4F7F8" stroke="#D4DDE4" stroke-width="2px" /><text x="201" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">BeforeUnloadEvent</text></a></svg></div> a:hover text { fill: #0095DD; pointer-events: all;} Bubbles No Cancelable Yes Target objects defaultView Interface Event Examples window.addEventListener("beforeunload", function( event ) { event.returnValue = "\o/"; }); // is equivalent to window.addEventListener("beforeunload",...
BluetoothDevice - Web APIs
The BluetoothDevice interface of the Web Bluetooth API represents a Bluetooth device inside a particular script execution environment. ...
... The BluetoothDevice interface of the Web Bluetooth API represents a Bluetooth device inside a particular script execution environment. ...
... inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 70" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/BluetoothDevice" target="_top"><rect x="151" y="1" width="150" height="50" fill="#F4F7F8" stroke="#D4DDE4" stroke-width="2px" /><text x="226" y="30" font-size="12px" font-family="Consolas,Monaco,Andal...
...name; readonly attribute BluetoothRemoteGATTServer? ...
BroadcastChannel - Web APIs
d channel that any browsing context of a given origin can subscribe to. It allows communication between different documents (in different windows, tabs, frames or iframes) of the same origin. Messages are broadcasted via a message event fired at all BroadcastChannel objects listening to the channel. Note: This feature is available in Web Workers. ...
...abs, frames or iframes) of the same origin. Messages are broadcasted via a message event fired at all BroadcastChannel objects listening to the channel. Note: This feature is available in Web Workers. ...
... inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 70" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/BroadcastChannel" target="_top"><rect x="151" y="1" width="160" height="50" fill="#F4F7F8" stroke="#D4DDE4" stroke-width="2px" /><text x="231" y="30" font-size="12px" font-family="Consolas,Monaco,Anda...
... Properties This interface also inherits properties from its parent, EventTarget. ...
CSSCounterStyleRule - Web APIs
The CSSCounterStyleRule interface represents an @counter-style at-rule. ...
... The CSSCounterStyleRule interface represents an @counter-style at-rule. ...
...ay: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 70" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/CSSRule" target="_top"><rect x="1" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="38.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">CSSRule</text></a><polyline points="76,25 86,20 86,30 76,25" stroke="#D4DDE4" fill="none"/><line x1="86" y1="25" x2="116" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/CSSCounterStyleRule" target="_top"><rect x="116" y="1" width="190" height="50" fill="#F4F7F8" stroke="#D4DDE4" stroke-width="2px" /><text x="211" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mon...
... CSSCounterStyleRule.name Is a DOMString object that contains the serialization of the <counter-style-name> defined for the associated rule. ...
CSSPrimitiveValue - Web APIs
e converted to a centimeter value.) Percentage values can't be converted since they are relative to the parent value (or another property value). There is one exception for color percentage values: since a color percentage value is relative to the range 0-255, a color percentage value can be converted to a number (see also the RGBColor interface). ...
...ere is one exception for color percentage values: since a color percentage value is relative to the range 0-255, a color percentage value can be converted to a number (see also the RGBColor interface). ...
...lay: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 70" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/CSSValue" target="_top"><rect x="1" y="1" width="80" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="41" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">CSSValue</text></a><polyline points="81,25 91,20 91,30 81,25" stroke="#D4DDE4" fill="none"/><line x1="91" y1="25" x2="121" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/CSSPrimitiveValue" target="_top"><rect x="121" y="1" width="170" height="50" fill="#F4F7F8" stroke="#D4DDE4" stroke-width="2px" /><text x="206" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono...
... CSSPrimitiveValue.primitiveType Read only An unsigned short representing the type of the value. ...
CSSValueList - Web APIs
he CSSValue interface and provides the abstraction of an ordered collection of CSS values. Some properties allow an empty list in their syntax. In that case, these properties take the none identifier. So, an empty list means that the property has the value none. The items in the CSSValueList are accessible via an integral index, starting from 0. ...
...that case, these properties take the none identifier. So, an empty list means that the property has the value none. The items in the CSSValueList are accessible via an integral index, starting from 0. ...
...lay: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 70" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/CSSValue" target="_top"><rect x="1" y="1" width="80" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="41" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">CSSValue</text></a><polyline points="81,25 91,20 91,30 81,25" stroke="#D4DDE4" fill="none"/><line x1="91" y1="25" x2="121" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/CSSValueList" target="_top"><rect x="121" y="1" width="120" height="50" fill="#F4F7F8" stroke="#D4DDE4" stroke-width="2px" /><text x="181" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,mono...
... CSSValueList.lengthRead only An unsigned long representing the number of CSSValues in the list. ...
Using the CSS properties and values API - Web APIs
ions! When a property isn't registered, the browser doesn't know how to treat it, so it assumes that any value can be used and therefore can't animate it. ...
...le to animate it! ...
...ice that with the registered property the transition works, but that it doesn't with the unregistered property! ...
...registered: #c0ffee; background-image: linear-gradient(to right, #fff, var(--unregistered)); transition: --unregistered 1s ease-in-out; } .unregistered:hover, .unregistered:focus { --unregistered: #b4d455; } <button class="registered">Background Registered</button> <button class="unregistered">Background Not Registered</button> .registered { --registered: #c0ffee; background-image: linear-gradient(to right, #fff, var(--registered)); transition: --registered 1s ease-in-out; } .registered:hover, .registered:focus { --registered: #b4d455; } .unregistered { --unregistered: #c0ffee; background-image: linear-gradient(to right, #fff, var(--unregistered)); transition: --unregistered 1s ease-in-out; } .unregistered:hover, .unregistered:focus { --unregistered: #b4d455; } b...
CanvasRenderingContext2D.closePath() - Web APIs
After that, the triangle's base is created with the closePath() method, which automatically connects the shape's first and last points. ...
...current point to the start of the current sub-path. If the shape has already been closed or has only one point, this function does nothing. This method doesn't draw anything to the canvas directly. You can render the path using the stroke() or fill() methods. Syntax void ctx.closePath(); Examples Closing a triangle This example creates the first two (diagonal) sides of a triangle using the lineTo() method. After that, the triangle's base is created with the closePath() method, which automatically connects the shape's first and last points. HTML <canvas id="canvas"></canvas> JavaScript The triangle's corners are at (20, 150), (120, 20), and (220, 150). const canvas = document.getElementById('canvas'); const ctx = canvas.getContext('2d'); ctx.beginPath(); ctx.moveTo(20, 140); // ...
...le's base is created with the closePath() method, which automatically connects the shape's first and last points. HTML <canvas id="canvas"></canvas> JavaScript The triangle's corners are at (20, 150), (120, 20), and (220, 150). const canvas = document.getElementById('canvas'); const ctx = canvas.getContext('2d'); ctx.beginPath(); ctx.moveTo(20, 140); // Move pen to bottom-left corner ctx.lineTo(120, 10); // Line to top corner ctx.lineTo(220, 140); // Line to bottom-right corner ctx.closePath(); // Line to bottom-left corner ctx.stroke(); Result Closing just one sub-path This example draws a smiley face consisting of three disconnected sub-paths. Note: Although closePath() is called after all the arcs have been created, only the last arc (sub-path) gets closed. HTML ...
...d. HTML <canvas id="canvas"></canvas> JavaScript The first two arcs create the face's eyes. The last arc creates the mouth. const canvas = document.getElementById('canvas'); const ctx = canvas.getContext('2d'); ctx.beginPath(); ctx.arc(240, 20, 40, 0, Math.PI); ctx.moveTo(100, 20); ctx.arc(60, 20, 40, 0, Math.PI); ctx.moveTo(215, 80); ctx.arc(150, 80, 65, 0, Math.PI); ctx.closePath(); ctx.lineWidth = 6; ctx.stroke(); Result Specifications Specification Status Comment HTML Living StandardThe definition of 'CanvasRenderingContext2D.closePath' in that specification. Living Standard ...
CanvasRenderingContext2D.strokeRect() - Web APIs
This method draws directly to the canvas without modifying the current path, so any subsequent fill() or stroke() calls will have no effect on it. Syntax void ctx.strokeRect(x, y, width, height); The strokeRect() method draws a stroked rectangle whose starting point is at (x, y) and whose size is specified by width and height. Parameters x The x-axis coordinate of the rectangle's starting point. y The y-axis coordinate of the rectangle's starting point. width The rectangle's width. ...
...ight. Parameters x The x-axis coordinate of the rectangle's starting point. y The y-axis coordinate of the rectangle's starting point. width The rectangle's width. Positive values are to the right, and negative to the left. height The rectangle's height. Positive values are down, and negative are up. Examples A simple stroked rectangle This example draws a rectangle with a green outline using the strokeRect() method. HTML <canvas id="canvas"></canvas> JavaScript The rectangle's top-left corner is at (20, 10). It has a width of 160 and a height of 100. const canvas = document.getElementById('canvas'); const ctx = canvas.getContext('2d'); ctx.strokeStyle = 'green'; ctx.strokeRect(20, 10, 160, 100); Result Applying various context settings This example draws a rectangle...
...nvas id="canvas"></canvas> JavaScript The rectangle's top-left corner is at (20, 10). It has a width of 160 and a height of 100. ...
...anvas.getContext('2d'); ctx.strokeStyle = 'green'; ctx.strokeRect(20, 10, 160, 100); Result Applying various context settings This example draws a rectangle with a drop shadow and thick, beveled outlines. HTML <canvas id="canvas"></canvas> JavaScript const canvas = document.getElementById('canvas'); const ctx = canvas.getContext('2d'); ctx.shadowColor = '#d53'; ctx.shadowBlur = 20; ctx.lineJoin = 'bevel'; ctx.lineWidth = 15; ctx.strokeStyle = '#38f'; ctx.strokeRect(30, 30, 160, 90); Result Specifications Specification Status Comment HTML Living StandardThe definition of 'CanvasRenderingContext2D.strokeRect' in that specification. Living Standard ...
Content Index API - Web APIs
The Content Index API allows developers to register their offline enabled content with the browser. Concepts and Usage As it stands, offline web content is not easily discoverable by users. Content indexing allows developers to tell the browser about their specific offline content. This allows users to discover and view what is available, whilst giving developers the ability to add and manage this content. Examples could be a news website prefetching the latest articles in the background, or a content streaming app registering downloaded content. ...
...nd manage this content. Examples could be a news website prefetching the latest articles in the background, or a content streaming app registering downloaded content. The Content Index API is an extension to service workers, which allows developers to add URLs and metadata of already cached pages, under the scope of the current service worker. The browser can then use these entries to display offline reading to a user. As a developer you can also display these entries within your application. Indexed entries do not automatically expire. It's good practice to present an interface for clearing out entries, or periodically remove older entries. The API supports indexing URLs corresponding to HTML documents. A URL for a cached media file, for example, can't be indexed directly. Instead, you ...
...hin your application. Indexed entries do not automatically expire. It's good practice to present an interface for clearing out entries, or periodically remove older entries. The API supports indexing URLs corresponding to HTML documents. A URL for a cached media file, for example, can't be indexed directly. Instead, you need to provide a URL for a page that displays media, and which works offline. Interfaces ContentIndex The ContentIndex interface provides functionality to register content available offline. ContentIndexEvent The ContentIndexEvent interface of the Content Index API defines the object used to represent the contentdelete event. Service worker additions The following additions to the ServiceWorker have been specified in the Content Index API spec to provide...
...orker.ready; // get our index entries const entries = await registration.index.getAll(); // create a containing element const readingListElem = document.createElement('div'); // test for entries if (!Array.length) { // if there are no entries, display a message const message = document.createElement('p'); message.innerText = 'You currently have no articles saved for offline reading.' readingListElem.append(message); } else { // if entries are present, display in a list of links to the content const listElem = document.createElement('ul'); for (const entry of entries) { const listItem = document.createElement('li'); const anchorElem = document.createElement('a'); anchorElem.innerText = entry.title; anchorElem.setAttribut...
DOMRect - Web APIs
Web › API › DOMRect
epresents a rectangle. The type of box represented by the DOMRect is specified by the method or property that returned it. For example, VREyeParameters.renderRect from the defunct WebVR API specified the viewport of a canvas into which visuals for one eye of a head mounted display should be rendered. It inherits from its parent, DOMRectReadOnly. ...
...ters.renderRect from the defunct WebVR API specified the viewport of a canvas into which visuals for one eye of a head mounted display should be rendered. It inherits from its parent, DOMRectReadOnly. ...
...ine-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 70" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/DOMRectReadOnly" target="_top"><rect x="1" y="1" width="150" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="76" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">DOMRectReadOnly</text></a><polyline points="151,25 161,20 161,30 151,25" stroke="#D4DDE4" fill="none"/><line x1="161" y1="25" x2="191" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/DOMRect" target="_top"><rect x="191" y="1" width="75" height="50" fill="#F4F7F8" stroke="#D4DDE4" stroke-width="2px" /><text x="228.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale M...
... Properties DOMRect inherits properties from its parent, DOMRectReadOnly. The difference is that they are not read-only anymore. ...
Document Object Model (DOM) - Web APIs
GFilterPrimitiveStandardAttributes SVGFontElement SVGFontFaceElement SVGFontFaceFormatElement SVGFontFaceNameElement SVGFontFaceSrcElement SVGFontFaceUriElement SVGForeignObjectElement SVGGElement SVGGeometryElement SVGGlyphElement SVGGlyphRefElement SVGGradientElement SVGGraphicsElement SVGHatchElement SVGHatchpathElement SVGHKernElement SVGImageElement SVGLinearGradientElement SVGLineElement SVGMarkerElement SVGMaskElement SVGMeshElement SVGMeshGradientElement SVGMeshpatchElement SVGMeshrowElement SVGMetadataElement SVGMissingGlyphElement SVGMPathElement SVGPathElement SVGPatternElement SVGPolylineElement SVGPolygonElement SVGRadialGradientElement SVGRectElement SVGScriptElement SVGSetElement SVGSolidcolorElement SVGSt...
...SVG data type interfaces Here are the DOM APIs for data types used in the definitions of SVG properties and attributes. ...
...s Here are the DOM APIs for data types used in the definitions of SVG properties and attributes. ...
...nceList SVGLength SVGLengthList SVGMatrix SVGNameList SVGNumber SVGNumberList SVGPaint SVGPathSeg SVGPathSegClosePath SVGPathSegMovetoAbs SVGPathSegMovetoRel SVGPathSegLinetoAbs SVGPathSegLinetoRel SVGPathSegCurvetoCubicAbs SVGPathSegCurvetoCubicRel SVGPathSegCurvetoQuadraticAbs SVGPathSegCurvetoQuadraticRel SVGPathSegArcAbs SVGPathSegArcRel SVGPathSegLinetoHorizontalAbs SVGPathSegLinetoHorizontalRel SVGPathSegLinetoVerticalAbs SVGPathSegLinetoVerticalRel SVGPathSegCurvetoCubicSmoothAbs SVGPathSegCurvetoCubicSmoothRel SVGPathSegCurvetoQuadraticSmoothAbs SVGPathSegCurvetoQuadraticSmoothRel SVGPathSegList SVGPoint SVGPointList SVGPreserveAspectRatio SVGRect SVGStringList SVGTransform SVGTransformList Animated...
Element: mousedown event - Web APIs
the same element. mousedown is fired the moment the button is initially pressed. Bubbles Yes Cancelable Yes Interface MouseEvent Event handler property onmousedown Examples The following example uses the mousedown, mousemove, and mouseup events to allow the user to draw on an HTML5 canvas. Its functionality is simple: the thickness of the line is set to 1, and the color is always black. When the page loads, constants myPics and context are created to store a reference to the canvas and the 2d context we will use to draw. Drawing begins when the mousedown event fires. First we store the x and y coordinates of the mouse pointer in the variables x and y, and then set isDrawing to true. As the mouse moves over the page, the mousemove ev...
..., constants myPics and context are created to store a reference to the canvas and the 2d context we will use to draw. Drawing begins when the mousedown event fires. First we store the x and y coordinates of the mouse pointer in the variables x and y, and then set isDrawing to true. As the mouse moves over the page, the mousemove event fires. If isDrawing is true, the event handler calls the drawLine function to draw a line from the stored x and y values to the current location. When the drawLine() function returns, we adjust the coordinates and then save them in x and y. The mouseup event draws the final line segment, sets x and y to 0, and stops further drawing by setting isDrawing to false. HTML <h1>Drawing with mouse events</h1> <canvas id="myPics" width="560" height="360"></canvas> ...
...etElementById('myPics'); const context = myPics.getContext('2d'); // event.offsetX, event.offsetY gives the (x,y) offset from the edge of the canvas. ...
... listeners for mousedown, mousemove, and mouseup myPics.addEventListener('mousedown', e => { x = e.offsetX; y = e.offsetY; isDrawing = true; }); myPics.addEventListener('mousemove', e => { if (isDrawing === true) { drawLine(context, x, y, e.offsetX, e.offsetY); x = e.offsetX; y = e.offsetY; } }); window.addEventListener('mouseup', e => { if (isDrawing === true) { drawLine(context, x, y, e.offsetX, e.offsetY); x = 0; y = 0; isDrawing = false; } }); function drawLine(context, x1, y1, x2, y2) { context.beginPath(); context.strokeStyle = 'black'; context.lineWidth = 1; context.moveTo(x1, y1); context.lineTo(x2, y2); context.stroke(); context.closePath(); } Result Specifications Specification Status UI EventsTh...
Element: mousemove event - Web APIs
ointing device (usually a mouse) is moved while the cursor's hotspot is inside it. Bubbles Yes Cancelable Yes Interface MouseEvent Event handler property onmousemove Examples The following example uses the mousedown, mousemove, and mouseup events to allow the user to draw on an HTML5 canvas. Its functionality is simple: the thickness of the line is set to 1, and the color is always black. When the page loads, constants myPics and context are created to store a reference to the canvas and the 2d context we will use to draw. Drawing begins when the mousedown event fires. First we store the x and y coordinates of the mouse pointer in the variables x and y, and then set isDrawing to true. As the mouse moves over the page, the mousemove ev...
..., constants myPics and context are created to store a reference to the canvas and the 2d context we will use to draw. Drawing begins when the mousedown event fires. First we store the x and y coordinates of the mouse pointer in the variables x and y, and then set isDrawing to true. As the mouse moves over the page, the mousemove event fires. If isDrawing is true, the event handler calls the drawLine function to draw a line from the stored x and y values to the current location. When the drawLine() function returns, we adjust the coordinates and then save them in x and y. The mouseup event draws the final line segment, sets x and y to 0, and stops further drawing by setting isDrawing to false. HTML <h1>Drawing with mouse events</h1> <canvas id="myPics" width="560" height="360"></canvas> ...
...etElementById('myPics'); const context = myPics.getContext('2d'); // event.offsetX, event.offsetY gives the (x,y) offset from the edge of the canvas. ...
... listeners for mousedown, mousemove, and mouseup myPics.addEventListener('mousedown', e => { x = e.offsetX; y = e.offsetY; isDrawing = true; }); myPics.addEventListener('mousemove', e => { if (isDrawing === true) { drawLine(context, x, y, e.offsetX, e.offsetY); x = e.offsetX; y = e.offsetY; } }); window.addEventListener('mouseup', e => { if (isDrawing === true) { drawLine(context, x, y, e.offsetX, e.offsetY); x = 0; y = 0; isDrawing = false; } }); function drawLine(context, x1, y1, x2, y2) { context.beginPath(); context.strokeStyle = 'black'; context.lineWidth = 1; context.moveTo(x1, y1); context.lineTo(x2, y2); context.stroke(); context.closePath(); } Result Specifications Specification Status UI EventsTh...
Element: mouseup event - Web APIs
inter is located inside it. mouseup events are the counterpoint to mousedown events. Bubbles Yes Cancelable Yes Interface MouseEvent Event handler property onmouseup Examples The following example uses the mousedown, mousemove, and mouseup events to allow the user to draw on an HTML5 canvas. Its functionality is simple: the thickness of the line is set to 1, and the color is always black. When the page loads, constants myPics and context are created to store a reference to the canvas and the 2d context we will use to draw. Drawing begins when the mousedown event fires. First we store the x and y coordinates of the mouse pointer in the variables x and y, and then set isDrawing to true. As the mouse moves over the page, the mousemove ev...
..., constants myPics and context are created to store a reference to the canvas and the 2d context we will use to draw. Drawing begins when the mousedown event fires. First we store the x and y coordinates of the mouse pointer in the variables x and y, and then set isDrawing to true. As the mouse moves over the page, the mousemove event fires. If isDrawing is true, the event handler calls the drawLine function to draw a line from the stored x and y values to the current location. When the drawLine() function returns, we adjust the coordinates and then save them in x and y. The mouseup event draws the final line segment, sets x and y to 0, and stops further drawing by setting isDrawing to false. HTML <h1>Drawing with mouse events</h1> <canvas id="myPics" width="560" height="360"></canvas> ...
...etElementById('myPics'); const context = myPics.getContext('2d'); // event.offsetX, event.offsetY gives the (x,y) offset from the edge of the canvas. ...
... listeners for mousedown, mousemove, and mouseup myPics.addEventListener('mousedown', e => { x = e.offsetX; y = e.offsetY; isDrawing = true; }); myPics.addEventListener('mousemove', e => { if (isDrawing === true) { drawLine(context, x, y, e.offsetX, e.offsetY); x = e.offsetX; y = e.offsetY; } }); window.addEventListener('mouseup', e => { if (isDrawing === true) { drawLine(context, x, y, e.offsetX, e.offsetY); x = 0; y = 0; isDrawing = false; } }); function drawLine(context, x1, y1, x2, y2) { context.beginPath(); context.strokeStyle = 'black'; context.lineWidth = 1; context.moveTo(x1, y1); context.lineTo(x2, y2); context.stroke(); context.closePath(); } Result Specifications Specification Status UI EventsTh...
ExtendableEvent - Web APIs
ExtendableEvent handler, the browser should throw an InvalidStateError; note also that multiple calls will stack up, and the resulting promises will be added to the list of extend lifetime promises. Note: The behaviour described in the above paragraph was fixed in Firefox 43 (see bug 1180274.) This interface inherits from the Event interface. ...
...ll be added to the list of extend lifetime promises. Note: The behaviour described in the above paragraph was fixed in Firefox 43 (see bug 1180274.) This interface inherits from the Event interface. ...
...play: inline-block; position: absolute; top: 0; left: 0;" viewbox="-20 0 700 60" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/Event" target="_top"><rect x="1" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="38.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">Event</text></a><polyline points="76,25 86,20 86,30 76,25" stroke="#D4DDE4" fill="none"/><line x1="86" y1="25" x2="116" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/ExtendableEvent" target="_top"><rect x="116" y="1" width="150" height="50" fill="#F4F7F8" stroke="#D4DDE4" stroke-width="2px" /><text x="191" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,mono...
...It is not available when it is a Window, or the scope of another kind of worker. ...
Using files from web applications - Web APIs
(As of time of writ...
...(As of time of writing, Firefox doesn't show this visual cue for <input type="file"> eleme...
...(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. The first step is to establish a drop zone. ...
...that every thumbnail image is in the CSS class obj with the corresponding File attached in a file attribute. This allows us to select all of the images the user has chosen for uploading using Document.querySelectorAll(), like this: function sendFiles() { const imgs = document.querySelectorAll(".obj"); for (let i = 0; i < imgs.length; i++) { new FileUpload(imgs[i], imgs[i].file); } } Line 2 fetches a NodeList, called imgs, of all the elements in the document with the CSS class obj. In our case, these will be all of the image thumbnails. Once we have that list, it's trivial to go through it and create a new FileUpload instance for each. Each of these handles uploading the corresponding file. Handling the upload process for a file The FileUpload function accepts two inputs: an ima...
File - Web APIs
Web › API › File
or from the mozGetAsFile() API on an HTMLCanvasElement. A File object is a specific kind of a Blob, and can be used in any context that a Blob can. In particular, FileReader, URL.createObjectURL(), createImageBitmap(), and XMLHttpRequest.send() accept both Blobs and Files. See Using files from web applications for more information and examples. ...
.... In particular, FileReader, URL.createObjectURL(), createImageBitmap(), and XMLHttpRequest.send() accept both Blobs and Files. See Using files from web applications for more information and examples. ...
...splay: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 70" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/Blob" target="_top"><rect x="1" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="38.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">Blob</text></a><polyline points="76,25 86,20 86,30 76,25" stroke="#D4DDE4" fill="none"/><line x1="86" y1="25" x2="116" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/File" target="_top"><rect x="116" y="1" width="75" height="50" fill="#F4F7F8" stroke="#D4DDE4" stroke-width="2px" /><text x="153.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill...
... Instance properties File.prototype.lastModified Read only Returns the last modified time of the file, in millisecond since the UNIX epoch (January 1st, 1970 at Midnight). ...
Introduction to the File and Directory Entries API - Web APIs
nous and synchronous versions of the interfaces. The asynchronous API can be used in cases where you don't want an outstanding operation to block the UI. The synchronous API, on the other hand, allows for simpler programming model, but it must be used with WebWorkers. Usefulness of the API The File and Directory Entries API is an important API for the following reasons: It lets apps have offline and storage features that involve large binary blobs. It can improve performance by letting an app pre-fetch assets in the background and cache locally. It lets users of your web app directly edit a binary file that's in their local file directory. It provides a storage API that is already familiar to your users, who are used to working with file systems. For examples of features you can cr...
...ing, connectivity getting interrupted, or the computer getting shut down. Video game or other apps with lots of media assets The app downloads one or several large tarballs and expands them locally into a directory structure. The app pre-fetches assets in the background, so the user can go to the next task or game level without waiting for a download. Audio or photo editor with offline access or local cache (great for performance and speed) The app can write to files in place (for example, overwriting just the ID3/EXIF tags and not the entire file). Offline video viewer The app can download large files (>1GB) for later viewing. The app can access partially downloaded files (so that you can watch the first chapter of your DVD, even if the app is still downloading ...
... The client caches attachments for later upload. ...
...eb apps. How storage space is granted or allocated and how you can manage storage are idiosyncratic to the browser, so you need to check the respective documentation of the browser. Google Chrome, for example, allows temporary storage beyond the 5 MB required in the specifications and supports the Quota Management API. To learn more about the Chrome-specific implementation, see Managing HTML5 Offline Storage. The File and Directory Entries API has asynchronous and synchronous versions The File and Directory Entries API comes with asynchronous and synchronous versions. Both versions of the API offer the same capabilities and features. In fact, they are almost alike, except for a few differences. WebWorkers. The asynchronous API can be used in either the document or WebWorkers context, whi...
GlobalEventHandlers.onerror - Web APIs
d with a window.addEventListener configured with useCapture set to True. Installing a global error event handler is useful for automated collection of error reports. Syntax For historical reasons, different arguments are passed to window.onerror and element.onerror handlers (as well as on error-type window.addEventListener handlers). ...
...nt arguments are passed to window.onerror and element.onerror handlers (as well as on error-type window.addEventListener handlers). window.onerror window.onerror = function(message, source, lineno, colno, error) { ... }; Function parameters: message: error message (string). Available as event (sic!) in HTML onerror="" handler. source: URL of the script where the error was raised (string) lineno: Line number where error was raised (number) colno: Column number for the line where the error occurred (number) error: Error Object (object) When the function returns true, this prevents the firing of the default event handler. window.addEventListener('error') window.addEventListener('error', function(event) { ... }) event of type ErrorEvent contains all the information about the eve...
... reported is simply "Script error." This behavior can be overriden in some browsers using the crossorigin attribute on <script> and having the server send the appropriate CORS HTTP response headers. A workaround is to isolate "Script error." and handle it knowing that the error detail is only viewable in the browser console and not accessible via JavaScript. ...
...or detail is only viewable in the browser console and not accessible via JavaScript. window.onerror = function (msg, url, lineNo, columnNo, error) { var string = msg.toLowerCase(); var substring = "script error"; if (string.indexOf(substring) > -1){ alert('Script Error: See Browser Console for Detail'); } else { var message = [ 'Message: ' + msg, 'URL: ' + url, 'Line: ' + lineNo, 'Column: ' + columnNo, 'Error object: ' + JSON.stringify(error) ].join(' - '); alert(message); } return false; }; When using the inline HTML markup (<body onerror="alert('an error occurred')">), the HTML specification requires arguments passed to onerror to be named event, source, lineno, colno, error. In browsers that have not implemented this requirement,...
HTMLFormControlsCollection - Web APIs
The HTMLFormControlsCollection interface represents a collection of HTML form control elements. It represents the lists returned by the HTMLFormElement interface's elements property and the HTMLFieldSetElement interface's elements property. This interface replaces one method from HTMLCollection, on which it is based. ...
...s returned by the HTMLFormElement interface's elements property and the HTMLFieldSetElement interface's elements property. This interface replaces one method from HTMLCollection, on which it is based. ...
...line-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 70" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/HTMLCollection" target="_top"><rect x="1" y="1" width="140" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="71" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">HTMLCollection</text></a><polyline points="141,25 151,20 151,30 141,25" stroke="#D4DDE4" fill="none"/><line x1="151" y1="25" x2="181" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/HTMLFormControlsCollection" target="_top"><rect x="181" y="1" width="260" height="50" fill="#F4F7F8" stroke="#D4DDE4" stroke-width="2px" /><text x="311" y="30" font-size="12px" font-family="Consola...
... Methods This interface inherits the methods of its parent, HTMLCollection. ...
HTMLOptionsCollection - Web APIs
The HTMLOptionsCollection interface represents a collection of <option> HTML elements (in document order) and offers methods and properties for selecting from the list as well as optionally altering its items. This object is returned only by the options property of select. ...
...TML elements (in document order) and offers methods and properties for selecting from the list as well as optionally altering its items. This object is returned only by the options property of select. ...
...line-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 70" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/HTMLCollection" target="_top"><rect x="1" y="1" width="140" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="71" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">HTMLCollection</text></a><polyline points="141,25 151,20 151,30 141,25" stroke="#D4DDE4" fill="none"/><line x1="151" y1="25" x2="181" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/HTMLOptionsCollection" target="_top"><rect x="181" y="1" width="210" height="50" fill="#F4F7F8" stroke="#D4DDE4" stroke-width="2px" /><text x="286" y="30" font-size="12px" font-family="Consolas,Mon...
...141,25" stroke="#D4DDE4" fill="none"/><line x1="151" y1="25" x2="181" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/HTMLOptionsCollection" target="_top"><rect x="181" y="1" width="210" height="50" fill="#F4F7F8" stroke="#D4DDE4" stroke-width="2px" /><text x="286" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">HTMLOptionsCollection</text></a></svg></div> a:hover text { fill: #0095DD; pointer-events: all;} Properties Name Type Description length unsigned long As optionally allowed by the spec, this property isn't read-only. You can either remove options from the end by lowering the value, or add blank options at the end by raising the value. Mozilla ...
HTMLTableElement.rules - Web APIs
The HTMLTableElement.rules property indicates which cell borders to render in the table. ...
... The HTMLTableElement.rules property indicates which cell borders to render in the table. ...
... The HTMLTableElement.rules property indicates which cell borders to render in the table. ...
... The HTMLTableElement.rules property indicates which cell borders to render in the table. ...
HashChangeEvent - Web APIs
The HashChangeEvent interface represents events that fire when the fragment identifier of the URL has changed. The fragment identifier is the part of the URL that follows (and includes) the # symbol. ...
... The HashChangeEvent interface represents events that fire when the fragment identifier of the URL has changed. The fragment identifier is the part of the URL that follows (and includes) the # symbol. ...
...play: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 70" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/Event" target="_top"><rect x="1" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="38.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">Event</text></a><polyline points="76,25 86,20 86,30 76,25" stroke="#D4DDE4" fill="none"/><line x1="86" y1="25" x2="116" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/HashChangeEvent" target="_top"><rect x="116" y="1" width="150" height="50" fill="#F4F7F8" stroke="#D4DDE4" stroke-width="2px" /><text x="191" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,mono...
... HashChangeEvent.newURL Read only The new URL to which the window is navigating. ...
IDBCursorWithValue - Web APIs
rsor enables an application to asynchronously process all the records in the cursor's range. You can have an unlimited number of cursors at the same time. You always get the same IDBCursorWithValue object representing a given cursor. Operations are performed on the underlying index or object store. Note: This feature is available in Web Workers. ...
...e time. You always get the same IDBCursorWithValue object representing a given cursor. Operations are performed on the underlying index or object store. Note: This feature is available in Web Workers. ...
...ay: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 70" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/IDBCursor" target="_top"><rect x="1" y="1" width="90" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="46" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">IDBCursor</text></a><polyline points="91,25 101,20 101,30 91,25" stroke="#D4DDE4" fill="none"/><line x1="101" y1="25" x2="131" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/IDBCursorWithValue" target="_top"><rect x="131" y="1" width="180" height="50" fill="#F4F7F8" stroke="#D4DDE4" stroke-width="2px" /><text x="221" y="30" font-size="12px" font-family="Consolas,Monaco,Andale...
... Properties Inherits properties from its parent interface, IDBCursor. IDBCursorWithValue.value Read only Returns the value of the current cursor. ...
IDBRequest - Web APIs
and an event indicating success is fired at the request (IDBRequest.onsuccess). If an error occurs while performing the operation, the exception is made available through the result property and an error event is fired (IDBRequest.onerror). The interface IDBOpenDBRequest is derived from IDBRequest. Note: This feature is available in Web Workers. ...
...made available through the result property and an error event is fired (IDBRequest.onerror). The interface IDBOpenDBRequest is derived from IDBRequest. Note: This feature is available in Web Workers. ...
... inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 70" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/IDBRequest" target="_top"><rect x="151" y="1" width="100" height="50" fill="#F4F7F8" stroke="#D4DDE4" stroke-width="2px" /><text x="201" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mon...
... IDBRequest.error Read only Returns a DOMException in the event of an unsuccessful request, indicating what went wrong. ...
IDBTransaction - Web APIs
ading and writing of data is done within transactions. You use IDBDatabase to start transactions, IDBTransaction to set the mode of the transaction (e.g. is it readonly or readwrite), and you access an IDBObjectStore to make a request. You can also use an IDBTransaction object to abort transactions. Note: This feature is available in Web Workers. ...
...(e.g. is it readonly or readwrite), and you access an IDBObjectStore to make a request. You can also use an IDBTransaction object to abort transactions. Note: This feature is available in Web Workers. ...
... inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 70" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/IDBTransaction" target="_top"><rect x="151" y="1" width="140" height="50" fill="#F4F7F8" stroke="#D4DDE4" stroke-width="2px" /><text x="221" y="30" font-size="12px" font-family="Consolas,Monaco,Andale...
...21,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/IDBTransaction" target="_top"><rect x="151" y="1" width="140" height="50" fill="#F4F7F8" stroke="#D4DDE4" stroke-width="2px" /><text x="221" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">IDBTransaction</text></a></svg></div> a:hover text { fill: #0095DD; pointer-events: all;} Transactions are started when the transaction is created, not when the first request is placed; for example consider this: var trans1 = db.transaction("foo", "readwrite"); var trans2 = db.transaction("foo", "readwrite"); var objectStore2 = trans2.objectStore("foo") var objectStore1 = tran...
Timing element visibility with the Intersection Observer API - Web APIs
turns out that one of the most common uses of Flash or other script in advertising on the Web is to record how long each ad is visible, for the purpose of billing and payment of revenues. Without the Intersection Observer API, this winds up being done using intervals and timeouts for each individual ad, or other techniques that tend to slow the page down. Using this API lets everything get streamlined by the browser to reduce the impact on performance substantially. Let's get started! Site structure: The HTML The site's structure is not too complicated. We'll be using 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> <n...
...olumn and at most all remaining available space. The first row will be used specially for the site header. The rows are sized the same way as the columns: the first one is automatically sized and the one uses the remaining space, but at least enough space to provide room for all elements within it. The wrapper's width is fixed at 700px so that it will fit in the available space when presented inline on MDN below. The header The header is fairly simple, since for this example all it contains is some text. Its style looks like this: header { grid-column: 1 / -1; grid-row: 1; background-color: aliceblue; } grid-row is set to 1, since we want the header to be placed in the top row of the site's grid. More interesting is our use of grid-column here; here we specify that we want the colu...
...all it contains is some text. Its style looks like this: header { grid-column: 1 / -1; grid-row: 1; background-color: aliceblue; } grid-row is set to 1, since we want the header to be placed in the top row of the site's grid. More interesting is our use of grid-column here; here we specify that we want the column to start in the first column and ends in the first column past the last grid line--in other words, the header spans across all of the columns within the grid. Perfect for our needs. The sidebar Our sidebar is used to present links to other pages on the site. None of them work in our example here, but they exist to help with the presentation of a blog-like experience. The sidebar is represented using an <aside> element, and is styled as follows: aside { grid-column: 1; g...
...when you update the ad, which could happen if you first delete the old element then insert a new one. ...
MediaKeyMessageEvent - Web APIs
The MediaKeyMessageEvent interface of the EncryptedMediaExtensions API contains the content and related data when the content decryption module generates a message for the session. ...
... The MediaKeyMessageEvent interface of the EncryptedMediaExtensions API contains the content and related data when the content decryption module generates a message for the session. ...
...play: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 70" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/Event" target="_top"><rect x="1" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="38.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">Event</text></a><polyline points="76,25 86,20 86,30 76,25" stroke="#D4DDE4" fill="none"/><line x1="86" y1="25" x2="116" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/MediaKeyMessageEvent" target="_top"><rect x="116" y="1" width="200" height="50" fill="#F4F7F8" stroke="#D4DDE4" stroke-width="2px" /><text x="216" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono...
... Properties Inherits properties from its parent, Event. ...
MediaKeySession.onkeystatuseschange - Web APIs
The onkeystatuseschange property of the MediaKeySession is an event handler, fired whenever a keystatuschange event ocurrs, denoting there has been a change in the keys or their statuses within a session. This interface inherits from the ExtendableEvent interface. ...
...vent handler, fired whenever a keystatuschange event ocurrs, denoting there has been a change in the keys or their statuses within a session. This interface inherits from the ExtendableEvent interface. ...
... inline-block; position: absolute; top: 0; left: 0;" viewbox="-20 0 700 60" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/MediaKeySession" target="_top"><rect x="151" y="1" width="150" height="50" fill="#F4F7F8" stroke="#D4DDE4" stroke-width="2px" /><text x="226" y="30" font-size="12px" font-family="Consolas,Monaco,Andal...
...} Specifications Specification Status Comment Encrypted Media ExtensionsThe definition of 'onkeystatuseschange' in that specification. ...
MediaKeySession.onmessage - Web APIs
The onmessage property of the MediaKeySession is an event handler, fired whenever a MediaKeyMessageEvent occurs, denoting a message is generated by the content decryption module. This interface inherits from the ExtendableEvent interface. ...
...ySession is an event handler, fired whenever a MediaKeyMessageEvent occurs, denoting a message is generated by the content decryption module. This interface inherits from the ExtendableEvent interface. ...
... inline-block; position: absolute; top: 0; left: 0;" viewbox="-20 0 700 60" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/MediaKeySession" target="_top"><rect x="151" y="1" width="150" height="50" fill="#F4F7F8" stroke="#D4DDE4" stroke-width="2px" /><text x="226" y="30" font-size="12px" font-family="Consolas,Monaco,Andal...
...} Specifications Specification Status Comment Encrypted Media ExtensionsThe definition of 'onmessage' in that specification. ...
MediaSource - Web APIs
The MediaSource interface of the Media Source Extensions API represents a source of media data for an HTMLMediaElement object. A MediaSource object can be attached to a HTMLMediaElement to be played in the user agent. ...
...interface of the Media Source Extensions API represents a source of media data for an HTMLMediaElement object. A MediaSource object can be attached to a HTMLMediaElement to be played in the user agent. ...
... inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 70" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/MediaSource" target="_top"><rect x="151" y="1" width="110" height="50" fill="#F4F7F8" stroke="#D4DDE4" stroke-width="2px" /><text x="206" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mo...
... 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/MediaSource" target="_top"><rect x="151" y="1" width="110" height="50" fill="#F4F7F8" stroke="#D4DDE4" stroke-width="2px" /><text x="206" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">MediaSource</text></a></svg></div> a:hover text { fill: #0095DD; pointer-events: all;} Constructor MediaSource() Constructs and returns a new MediaSource object with no associated source buffers. Properties MediaSource.sourceBuffers Read only Returns a SourceBufferList object containing the list of SourceBuffer objects associated with this MediaSource. MediaSource.a...
MediaStreamTrackEvent - Web APIs
The MediaStreamTrackEvent interface represents events which indicate that a MediaStream has had tracks added to or removed from the stream through calls to Media Stream API methods. These events are sent to the stream when these changes occur. ...
...ents events which indicate that a MediaStream has had tracks added to or removed from the stream through calls to Media Stream API methods. These events are sent to the stream when these changes occur. ...
...play: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 70" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/Event" target="_top"><rect x="1" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="38.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">Event</text></a><polyline points="76,25 86,20 86,30 76,25" stroke="#D4DDE4" fill="none"/><line x1="86" y1="25" x2="116" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/MediaStreamTrackEvent" target="_top"><rect x="116" y="1" width="210" height="50" fill="#F4F7F8" stroke="#D4DDE4" stroke-width="2px" /><text x="221" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mon...
... track Read only A MediaStreamTrack object representing the track which was added to the stream. ...
MessageEvent - Web APIs
hannels (see Broadcastchannel.postMessage()) and BroadcastChannel.onmessage). WebRTC data channels (see RTCDataChannel.onmessage). The action triggered by this event is defined in a function set as the event handler for the relevant message event (e.g. using an onmessage handler as listed above). Note: This feature is available in Web Workers. ...
...ggered by this event is defined in a function set as the event handler for the relevant message event (e.g. using an onmessage handler as listed above). Note: This feature is available in Web Workers. ...
...play: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 80" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/Event" target="_top"><rect x="1" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="38.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">Event</text></a><polyline points="76,25 86,20 86,30 76,25" stroke="#D4DDE4" fill="none"/><line x1="86" y1="25" x2="116" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/MessageEvent" target="_top"><rect x="116" y="1" width="120" height="50" fill="#F4F7F8" stroke="#D4DDE4" stroke-width="2px" /><text x="176" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospa...
... Properties This interface also inherits properties from its parent, Event. MessageEvent.data Read only The data sent by the message emitter. ...
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. ...
... The PageTransitionEvent event object is available inside handler functions for the pageshow and pagehide events, fired when a document is being loaded or unloaded. ...
...lay: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/Event" target="_top"><rect x="1" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="38.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">Event</text></a><polyline points="76,25 86,20 86,30 76,25" stroke="#D4DDE4" fill="none"/><line x1="86" y1="25" x2="116" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/PageTransitionEvent" target="_top"><rect x="116" y="1" width="190" height="50" fill="#F4F7F8" stroke="#D4DDE4" stroke-width="2px" /><text x="211" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,...
... PageTransitionEvent.persisted Read only Indicates if the document is loading from a cache. ...
PerformanceLongTaskTiming - Web APIs
The PerformanceLongTaskTiming interface of the the Long Tasks API reports instances of long tasks. ...
... The PerformanceLongTaskTiming interface of the the Long Tasks API reports instances of long tasks. ...
...ne-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 70" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/PerformanceEntry" target="_top"><rect x="1" y="1" width="160" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="81" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">PerformanceEntry</text></a><polyline points="161,25 171,20 171,30 161,25" stroke="#D4DDE4" fill="none"/><line x1="171" y1="25" x2="201" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/PerformanceLongTaskTiming" target="_top"><rect x="201" y="1" width="250" height="50" fill="#F4F7F8" stroke="#D4DDE4" stroke-width="2px" /><text x="326" y="30" font-size="12px" font-family="Consol...
...25" stroke="#D4DDE4" fill="none"/><line x1="171" y1="25" x2="201" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/PerformanceLongTaskTiming" target="_top"><rect x="201" y="1" width="250" height="50" fill="#F4F7F8" stroke="#D4DDE4" stroke-width="2px" /><text x="326" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">PerformanceLongTaskTiming</text></a></svg></div> a:hover text { fill: #0095DD; pointer-events: all;} Properties PerformanceLongTaskTiming.attribution Read only Returns a sequence of TaskAttributionTiming instances. Specifications Specification Status Comment Long Tasks API 1The definition of 'PerformanceLongTaskTiming' in that specification. W...
PerformanceNavigationTiming - Web APIs
The PerformanceNavigationTiming interface provides methods and properties to store and retrieve metrics regarding the browser's document navigation events. For example, this interface can be used to determine how much time it takes to load or unload a document. ...
...nd properties to store and retrieve metrics regarding the browser's document navigation events. For example, this interface can be used to determine how much time it takes to load or unload a document. ...
...ne-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 70" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/PerformanceEntry" target="_top"><rect x="1" y="1" width="160" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="81" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">PerformanceEntry</text></a><polyline points="161,25 171,20 171,30 161,25" stroke="#D4DDE4" fill="none"/><line x1="171" y1="25" x2="201" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/PerformanceNavigationTiming" target="_top"><rect x="201" y="1" width="270" height="50" fill="#F4F7F8" stroke="#D4DDE4" stroke-width="2px" /><text x="336" y="30" font-size="12px" font-family="Cons...
..." stroke="#D4DDE4" fill="none"/><line x1="171" y1="25" x2="201" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/PerformanceNavigationTiming" target="_top"><rect x="201" y="1" width="270" height="50" fill="#F4F7F8" stroke="#D4DDE4" stroke-width="2px" /><text x="336" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">PerformanceNavigationTiming</text></a></svg></div> a:hover text { fill: #0095DD; pointer-events: all;} Properties This interface extends the following PerformanceEntry properties for navigation performance entry types by qualifying and constraining them as follows: PerformanceEntry.entryType Read only Returns "navigation". PerformanceEntry.name Read only Returns the do...
PerformancePaintTiming - Web APIs
during web page construction. "Paint" refers to conversion of the render tree to on-screen pixels. An application can register a PerformanceObserver for "paint" performance entry types and the observer can retrieve the times that paint events occur. Use this information to help identify areas that take too long to provide a good user experience. ...
...er for "paint" performance entry types and the observer can retrieve the times that paint events occur. Use this information to help identify areas that take too long to provide a good user experience. ...
...ne-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 70" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/PerformanceEntry" target="_top"><rect x="1" y="1" width="160" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="81" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">PerformanceEntry</text></a><polyline points="161,25 171,20 171,30 161,25" stroke="#D4DDE4" fill="none"/><line x1="171" y1="25" x2="201" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/PerformancePaintTiming" target="_top"><rect x="201" y="1" width="220" height="50" fill="#F4F7F8" stroke="#D4DDE4" stroke-width="2px" /><text x="311" y="30" font-size="12px" font-family="Consolas,...
...61,25" stroke="#D4DDE4" fill="none"/><line x1="171" y1="25" x2="201" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/PerformancePaintTiming" target="_top"><rect x="201" y="1" width="220" height="50" fill="#F4F7F8" stroke="#D4DDE4" stroke-width="2px" /><text x="311" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">PerformancePaintTiming</text></a></svg></div> a:hover text { fill: #0095DD; pointer-events: all;} Properties This interface has no properties but it extends the following PerformanceEntry properties (for "paint" performance entry types) by qualifying and constraining the properties as follows: PerformanceEntry.entryType Returns "paint". PerformanceEntry.name Returns eith...
Performance API - Web APIs
occurs in the given browsing context, such as the page was navigated to from history, the page was navigated to by following a link, etc. Interfaces Performance Provides methods and properties containing timing-related performance information for the given page. PerformanceEntry Provides methods and properties the encapsulate a single performance metric that is part of the performance timeline. PerformanceFrameTiming Provides methods and properties containing frame timing data about the browser's event loop. PerformanceMark An abstract interface for performance entries with an entry type of "mark". Entries of this type are created by calling performance.mark() to add a named DOMHighResTimeStamp (the mark) to the browser's performance timeline. PerformanceMeasure An abstract inter...
...is type are created by calling performance.mark() to add a named DOMHighResTimeStamp (the mark) to the browser's performance timeline. PerformanceMeasure An abstract interface for performance entries with an entry type of "measure". Entries of this type are created by calling performance.measure() to add a namedDOMHighResTimeStamp (the measure) between two marks to the browser's performance timeline. PerformanceNavigationTiming Provides methods and properties to store and retrieve high resolution timestamps or metrics regarding the browser's document navigation events. PerformanceObserver Provides methods and properties used to observe performance measurement events and be notified of new performance entries as they are recorded in the browser's performance timeline. PerformanceResource...
...ng and PerformanceNavigation interfaces. Adds timing and navigation properties to the Performance interface. Navigation Timing Level 2 Working Draft Adds the PerformanceNavigationTiming interface. Obsolete's the the PerformanceTiming interface, the PerformanceNavigation interface, as well as the timing and navigation properties to the Performance interface. ...
...e PerformanceTiming interface, the PerformanceNavigation interface, as well as the timing and navigation properties to the Performance interface. Performance Timeline Recommendation Adds the PerformanceEntry interface, the PerformanceEntryList type, as well as the getEntries(), getEntriesByType(), and getEntriesByName() methods on the Performance interface. Performance Timeline Level 2 Candidate Recommendation Adds serializer to the PerformanceEntry interface as well as adding the PerformanceObserver interface and callback Resource Timing Level 1 Candidate Recommendation Adds the PerformanceResourceTiming interface. Adds the clearResourceTimings() method, the setResourceTimingBufferSize() method, and the onresourcetimingbufferfull event handler to t...
ProgressEvent - Web APIs
The ProgressEvent interface represents events measuring progress of an underlying process, like an HTTP request (for an XMLHttpRequest, or the loading of the underlying resource of an <img>, <audio>, <video>, <style> or <link>). ...
... represents events measuring progress of an underlying process, like an HTTP request (for an XMLHttpRequest, or the loading of the underlying resource of an <img>, <audio>, <video>, <style> or <link>). ...
...play: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 70" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/Event" target="_top"><rect x="1" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="38.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">Event</text></a><polyline points="76,25 86,20 86,30 76,25" stroke="#D4DDE4" fill="none"/><line x1="86" y1="25" x2="116" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/ProgressEvent" target="_top"><rect x="116" y="1" width="130" height="50" fill="#F4F7F8" stroke="#D4DDE4" stroke-width="2px" /><text x="181" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monosp...
... Properties Also inherits properties from its parent Event. ...
PromiseRejectionEvent - Web APIs
The PromiseRejectionEvent interface represents events which are sent to the global script context when JavaScript Promises are rejected. These events are particularly useful for telemetry and debugging purposes. For details on promise rejection events, see Promise rejection events in Using Promises. ...
...cript context when JavaScript Promises are rejected. These events are particularly useful for telemetry and debugging purposes. For details on promise rejection events, see Promise rejection events in Using Promises. ...
...lay: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 120" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/Event" target="_top"><rect x="1" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="38.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">Event</text></a><polyline points="76,25 86,20 86,30 76,25" stroke="#D4DDE4" fill="none"/><line x1="86" y1="25" x2="116" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/PromiseRejectionEvent" target="_top"><rect x="116" y="1" width="210" height="50" fill="#F4F7F8" stroke="#D4DDE4" stroke-width="2px" /><text x="221" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mon...
... Properties Also inherits properties from its parent Event. ...
RTCDTMFSender - Web APIs
DTMF support is to allow WebRTC-based communication clients to be connected to a public-switched telephone network (PSTN) or other legacy telephone service, including extant voice over IP (VoIP) services. For that reason, DTMF can't be used between two WebRTC-based devices, because there is no mechanism provided by WebRTC for receiving DTMF codes. ...
...service, including extant voice over IP (VoIP) services. For that reason, DTMF can't be used between two WebRTC-based devices, because there is no mechanism provided by WebRTC for receiving DTMF codes. ...
... inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 70" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/RTCDTMFSender" target="_top"><rect x="151" y="1" width="130" height="50" fill="#F4F7F8" stroke="#D4DDE4" stroke-width="2px" /><text x="216" y="30" font-size="12px" font-family="Consolas,Monaco,Andale ...
...121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/RTCDTMFSender" target="_top"><rect x="151" y="1" width="130" height="50" fill="#F4F7F8" stroke="#D4DDE4" stroke-width="2px" /><text x="216" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">RTCDTMFSender</text></a></svg></div> a:hover text { fill: #0095DD; pointer-events: all;} Properties RTCDTMFSender.toneBuffer Read only A DOMString which contains the list of DTMF tones currently in the queue to be transmitted (tones which have already been played are no longer included in the string). See toneBuffer for details on the format of the tone buffer. Methods ...
RTCError - Web APIs
Web › API › RTCError
ed long integer value indicating the fatal DTLS error which was received from the network. Only valid if the errorDetail string is dtls-failure. If null, no DTLS error was received. sctpCauseCode Read only If errorDetail is sctp-failure, this property is a long integer specifying the SCTP cause code indicating the cause of the failed SCTP negotiation. null if the error isn't an SCTP error. sdpLineNumber Read only If errorDetail is sdp-syntax-error, this property is a long integer identifying the line number of the SDP on which the syntax error occurred. null if the error isn't an SDP syntax error. sentAlert Read only If errorDetail is dtls-failure, this property is an unsigned long integer indicating the fatal DTLS error that was sent out by this device. If null, no DTLS error was tra...
...dicating the fatal DTLS error that was sent out by this device. If null, no DTLS error was transmitted. All RTCError objects have their name set to OperationError. Examples In this example, a handler is established for an RTCDataChannel's error event. ...
...al DTLS error that was sent out by this device. If null, no DTLS error was transmitted. All RTCError objects have their name set to OperationError. Examples In this example, a handler is established for an RTCDataChannel's error event. ...
...s have their name set to OperationError. Examples In this example, a handler is established for an RTCDataChannel's error event. 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 dis...
RTCErrorEvent.error - Web APIs
ed long integer value indicating the fatal DTLS error which was received from the network. Only valid if the errorDetail string is dtls-failure. If null, no DTLS error was received. sctpCauseCode Read only If errorDetail is sctp-failure, this property is a long integer specifying the SCTP cause code indicating the cause of the failed SCTP negotiation. null if the error isn't an SCTP error. sdpLineNumber Read only If errorDetail is sdp-syntax-error, this property is a long integer identifying the line number of the SDP on which the syntax error occurred. null if the error isn't an SDP syntax error. sentAlert Read only If errorDetail is dtls-failure, this property is an unsigned long integer indicating the fatal DTLS error that was sent out by this device. If null, no DTLS error was tra...
...ndicating the fatal DTLS error that was sent out by this device. If null, no DTLS error was transmitted. All RTCError objects have their name set to OperationError. Examples In this example, a handler is established for an RTCDataChannel's error event. ...
...tal DTLS error that was sent out by this device. If null, no DTLS error was transmitted. All RTCError objects have their name set to OperationError. Examples In this example, a handler is established for an RTCDataChannel's error event. ...
...ts have their name set to OperationError. Examples In this example, a handler is established for an RTCDataChannel's error event. 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 dis...
RTCPeerConnection.addIceCandidate() - Web APIs
missing or a value of null is given when calling addIceCandidate(), the added ICE candidate is an "end-of-candidates" indicator. The same is the case if the value of the specified object's candidate is either missing or an empty string (""), it signals that all remote candidates have been delivered. The end-of-candidates notification is transmitted to the remote peer using a candidate with an a-line value of end-of-candidates. During negotiation, your app will likely receive many candidates which you'll deliver to the ICE agent in this way, allowing it to build up a list of potential connection methods. This is covered in more detail in the articles WebRTC connectivity and Signaling and video calling. Syntax aPromise = pc.addIceCandidate(candidate); addIceCandidate(candidate, successCall...
...ceCandidateInit dictionary, or an RTCIceCandidate object; the contents of the object should be constructed from a message received over the signaling channel, describing a newly received ICE candidate that's ready to be delivered to the local ICE agent. If no candidate object is specified, or its value is null, an end-of-candidates signal is sent to the remote peer using the end-of-candidates a-line, formatted simply like this: a=end-of-candidates Deprecated parameters In older code and documentation, you may see a callback-based version of this function. This has been deprecated and its use is strongly discouraged. You should update any existing code to use the Promise-based version of addIceCandidate() instead. The parameters for this form of addIceCandidate() are described below, t...
...mote peer's description by the ICE agent. The promise does not receive any input parameters. Exceptions When an error occurs while attempting to add the ICE candidate, the Promise returned by this method is rejected, returning one of the errors below as the name attribute in the specified DOMException object passed to the rejection handler. ...
... The specified ufrag doesn't match the ufrag field in any of the remote descriptions being considered. One or more of the values in the candidate string are invalid or could not be parsed. Attempting to add the candidate fails for any reason. ...
RTCPeerConnection - Web APIs
The RTCPeerConnection interface represents a WebRTC connection between the local computer and a remote peer. It provides methods to connect to a remote peer, maintain and monitor the connection, and close the connection once it's no longer needed. ...
...ebRTC connection between the local computer and a remote peer. It provides methods to connect to a remote peer, maintain and monitor the connection, and close the connection once it's no longer needed. ...
... inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 70" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/RTCPeerConnection" target="_top"><rect x="151" y="1" width="170" height="50" fill="#F4F7F8" stroke="#D4DDE4" stroke-width="2px" /><text x="236" y="30" font-size="12px" font-family="Consolas,Monaco,And...
...30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/RTCPeerConnection" target="_top"><rect x="151" y="1" width="170" height="50" fill="#F4F7F8" stroke="#D4DDE4" stroke-width="2px" /><text x="236" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">RTCPeerConnection</text></a></svg></div> a:hover text { fill: #0095DD; pointer-events: all;} ConstructorRTCPeerConnection() The RTCPeerConnection() constructor returns a newly-created RTCPeerConnection, which represents a connection between the local device and a remote peer.PropertiesAlso inherits properties from: EventTargetcanTrickleIceCandidatesThe read-only RTCPeerConnect...
RadioNodeList - Web APIs
The RadioNodeList interface represents a collection of radio elements in a <form> or a <fieldset> element. ...
... The RadioNodeList interface represents a collection of radio elements in a <form> or a <fieldset> element. ...
...lay: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 70" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/NodeList" target="_top"><rect x="1" y="1" width="80" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="41" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">NodeList</text></a><polyline points="81,25 91,20 91,30 81,25" stroke="#D4DDE4" fill="none"/><line x1="91" y1="25" x2="121" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/RadioNodeList" target="_top"><rect x="121" y="1" width="130" height="50" fill="#F4F7F8" stroke="#D4DDE4" stroke-width="2px" /><text x="186" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,mon...
... RadioNodeList.value If the underlying element collection contains radio buttons, the value property represents the checked radio button. ...
Range.commonAncestorContainer - Web APIs
n to highlight them. HTML <ul> <li>Strings <ul> <li>Cello</li> <li>Violin <ul> <li>First Chair</li> <li>Second Chair</li> </ul> </li> </ul> </li> <li>Woodwinds <ul> <li>Clarinet</li> <li>Oboe</li> </ul> </li> </ul> CSS The .highlight class created below uses a set of CSS @keyframes to animate a fading outline. ...
...ngs <ul> <li>Cello</li> <li>Violin <ul> <li>First Chair</li> <li>Second Chair</li> </ul> </li> </ul> </li> <li>Woodwinds <ul> <li>Clarinet</li> <li>Oboe</li> </ul> </li> </ul> CSS The .highlight class created below uses a set of CSS @keyframes to animate a fading outline. ...
...n <ul> <li>First Chair</li> <li>Second Chair</li> </ul> </li> </ul> </li> <li>Woodwinds <ul> <li>Clarinet</li> <li>Oboe</li> </ul> </li> </ul> CSS The .highlight class created below uses a set of CSS @keyframes to animate a fading outline. ...
...air</li> <li>Second Chair</li> </ul> </li> </ul> </li> <li>Woodwinds <ul> <li>Clarinet</li> <li>Oboe</li> </ul> </li> </ul> CSS The .highlight class created below uses a set of CSS @keyframes to animate a fading outline. ...
SourceBuffer - Web APIs
The SourceBuffer interface represents a chunk of media to be passed into an HTMLMediaElement and played, via a MediaSource object. This can be made up of one or several media segments. ...
... The SourceBuffer interface represents a chunk of media to be passed into an HTMLMediaElement and played, via a MediaSource object. This can be made up of one or several media segments. ...
... inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 70" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/SourceBuffer" target="_top"><rect x="151" y="1" width="120" height="50" fill="#F4F7F8" stroke="#D4DDE4" stroke-width="2px" /><text x="211" y="30" font-size="12px" font-family="Consolas,Monaco,Andale M...
... SourceBuffer.appendWindowStart Controls the timestamp for the start of the append window. ...
SourceBufferList - Web APIs
rface represents a simple container list for multiple SourceBuffer objects. The source buffer list containing the SourceBuffers appended to a particular MediaSource can be retrieved using the MediaSource.sourceBuffers property. The individual source buffers can be accessed using array operator (i.e. []) or functions such as forEach() for example. ...
...cular MediaSource can be retrieved using the MediaSource.sourceBuffers property. The individual source buffers can be accessed using array operator (i.e. []) or functions such as forEach() for example. ...
... inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 70" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/SourceBufferList" target="_top"><rect x="151" y="1" width="160" height="50" fill="#F4F7F8" stroke="#D4DDE4" stroke-width="2px" /><text x="231" y="30" font-size="12px" font-family="Consolas,Monaco,Anda...
... Event handlers SourceBufferList.onaddsourcebuffer The event handler for the addsourcebuffer event. ...
StaticRange - Web APIs
The DOM StaticRange interface extends AbstractRange to provide a method to specify a range of content in the DOM whose contents don't update to reflect changes which occur within the DOM tree. It offers the same set of properties and methods as AbstractRange. AbstractRange and StaticRange are not available from web workers. ...
...ts don't update to reflect changes which occur within the DOM tree. It offers the same set of properties and methods as AbstractRange. AbstractRange and StaticRange are not available from web workers. ...
...nline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 70" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/AbstractRange" target="_top"><rect x="1" y="1" width="130" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="66" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">AbstractRange</text></a><polyline points="131,25 141,20 141,30 131,25" stroke="#D4DDE4" fill="none"/><line x1="141" y1="25" x2="171" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/StaticRange" target="_top"><rect x="171" y="1" width="110" height="50" fill="#F4F7F8" stroke="#D4DDE4" stroke-width="2px" /><text x="226" y="30" font-size="12px" font-family="Consolas,Monaco,Andale ...
... Properties The properties below are inherited from its parent interface, AbstractRange. ...
StorageEvent - Web APIs
A StorageEvent is sent to a window when a storage area it has access to is changed within the context of another document. ...
... A StorageEvent is sent to a window when a storage area it has access to is changed within the context of another document. ...
...play: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 70" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/Event" target="_top"><rect x="1" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="38.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">Event</text></a><polyline points="76,25 86,20 86,30 76,25" stroke="#D4DDE4" fill="none"/><line x1="86" y1="25" x2="116" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/StorageEvent" target="_top"><rect x="116" y="1" width="120" height="50" fill="#F4F7F8" stroke="#D4DDE4" stroke-width="2px" /><text x="176" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospa...
...20 86,30 76,25" stroke="#D4DDE4" fill="none"/><line x1="86" y1="25" x2="116" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/StorageEvent" target="_top"><rect x="116" y="1" width="120" height="50" fill="#F4F7F8" stroke="#D4DDE4" stroke-width="2px" /><text x="176" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">StorageEvent</text></a></svg></div> a:hover text { fill: #0095DD; pointer-events: all;} Method overview void initStorageEvent( in DOMString type, in boolean canBubble, in boolean cancelable, in DOMString key, in DOMString oldValue, in DOMString newValue, in USVString url, in Storage storageArea ); Attributes Attribute Type Description ...
TaskAttributionTiming - Web APIs
The TaskAttributionTiming interface of the Long Tasks API returns information about the work involved in a long task and its associate frame context. The frame context, also called the container, is the iframe, embed or object that is being implicated, on the whole, for a long task. ...
...t the work involved in a long task and its associate frame context. The frame context, also called the container, is the iframe, embed or object that is being implicated, on the whole, for a long task. ...
...ne-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 70" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/PerformanceEntry" target="_top"><rect x="1" y="1" width="160" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="81" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">PerformanceEntry</text></a><polyline points="161,25 171,20 171,30 161,25" stroke="#D4DDE4" fill="none"/><line x1="171" y1="25" x2="201" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/TaskAttributionTiming" target="_top"><rect x="201" y="1" width="210" height="50" fill="#F4F7F8" stroke="#D4DDE4" stroke-width="2px" /><text x="306" y="30" font-size="12px" font-family="Consolas,M...
... TaskAttributionTiming.containerSrc Read only Returns the container's src attribute. ...
TimeEvent - Web APIs
Web › API › TimeEvent
The TimeEvent interface, a part of SVG SMIL animation, provides specific contextual information associated with Time events. ...
... The TimeEvent interface, a part of SVG SMIL animation, provides specific contextual information associated with Time events. ...
...play: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 70" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/Event" target="_top"><rect x="1" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="38.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">Event</text></a><polyline points="76,25 86,20 86,30 76,25" stroke="#D4DDE4" fill="none"/><line x1="86" y1="25" x2="116" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/TimeEvent" target="_top"><rect x="116" y="1" width="90" height="50" fill="#F4F7F8" stroke="#D4DDE4" stroke-width="2px" /><text x="161" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" ...
...For this event type, indicates the repeat number for the animation. ...
UIEvent - Web APIs
Web › API › UIEvent
e events. UIEvent derives from Event. Although the UIEvent.initUIEvent() method is kept for backward compatibility, you should create a UIEvent object using the UIEvent() constructor. Several interfaces are direct or indirect descendants of this one: MouseEvent, TouchEvent, FocusEvent, KeyboardEvent, WheelEvent, InputEvent, and CompositionEvent. ...
...ect using the UIEvent() constructor. Several interfaces are direct or indirect descendants of this one: MouseEvent, TouchEvent, FocusEvent, KeyboardEvent, WheelEvent, InputEvent, and CompositionEvent. ...
...play: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 70" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/Event" target="_top"><rect x="1" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="38.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">Event</text></a><polyline points="76,25 86,20 86,30 76,25" stroke="#D4DDE4" fill="none"/><line x1="86" y1="25" x2="116" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/UIEvent" target="_top"><rect x="116" y="1" width="75" height="50" fill="#F4F7F8" stroke="#D4DDE4" stroke-width="2px" /><text x="153.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" ...
... Properties This interface also inherits properties of its parent, Event. UIEvent.cancelBubble Is a Boolean indicating whether the bubbling of the event has been canceled or not. ...
WebGLContextEvent - Web APIs
The WebContextEvent interface is part of the WebGL API and is an interface for an event that is generated in response to a status change to the WebGL rendering context. Inheritance This interface inherits properties and methods from its parent interface, Event. ...
...n interface for an event that is generated in response to a status change to the WebGL rendering context. Inheritance This interface inherits properties and methods from its parent interface, Event. ...
...play: inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 70" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/Event" target="_top"><rect x="1" y="1" width="75" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="38.5" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">Event</text></a><polyline points="76,25 86,20 86,30 76,25" stroke="#D4DDE4" fill="none"/><line x1="86" y1="25" x2="116" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/WebGLContextEvent" target="_top"><rect x="116" y="1" width="170" height="50" fill="#F4F7F8" stroke="#D4DDE4" stroke-width="2px" /><text x="201" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,mo...
... WebGLContextEvent.statusMessage A read-only property containing additional information about the event. ...
WebGL model view projection - Web APIs
// y depth : -1.5, // z color : [0.4, 0.4, 1, 1] // blue }); The results View on JSFiddle Exercise A helpful exercise at this point is to move the boxes around the clip space by varying the code to get a feel for how points get clipped and moved around in clip space. Try drawing a picture like a boxy smiley face with a background. Homogeneous coordinates The main line of the previous clip space vertex shader contained this code: gl_Position = vec4(position, 1.0); The position variable was defined in the draw() method and passed in as an attribute to the shader. This is a three dimensional point, but the gl_Position variable that ends up getting passed down through the pipeline is actually 4 dimensional -- instead of (x, y, z) it is (x, y, z, w). There is no...
...th dimension is labeled w. In the above example the w coordinate is set to 1.0. The obvious question is "why the extra dimension?" It turns out that this addition allows for lots of nice techniques for manipulating 3D data. This added dimension introduces the notion of perspective into the coordinate system; with it in place, we can map 3D coordinates into 2D space--thereby allowing two parallel lines to intersect as they recede into the distance. The value of w is used as a divisor for the other components of the coordinate, so that the true values of x, y, and z are computed as x/w, y/w, and z/w (and w is then also w/w, becoming 1). A three dimensional point is defined in a typical Cartesian coordinate system. The added fourth dimension changes this point into a homogeneous coordinate. It ...
... In the box demo, an additional computeSimpleProjectionMatrix() method is added. This is called in the draw() method and has the scale factor passed to it. The...
...ArrayOfMatrices([ // Exercise: rotate the camera view position ]); // Inverse the operation for camera movements, because we are actually // moving the geometry in the scene, not the camera itself. this.transforms.view = MDN.invertMatrix(matrix); }; The shader now uses three matrices. gl_Position = projection * view * model * vec4(position, 1.0); After this step, the GPU pipeline will clip the out of range vertices, and send the model down to the fragment shader for rasterization. The results View on JSFiddle Relating the coordinate systems At this point it would be beneficial to take a step back and look at and label the various coordinate systems we use. First off, the cube's vertices are defined in model space. To move the model around the scene. these vertices n...
Rendering and the WebXR frame animation callback - Web APIs
e frame. For example, a 60 Hz display has 1/60th of a second to render a single frame, or 0.0166667 seconds. And if the device's refresh rate is 120 Hz, you only have 0.00883333 seconds to render each frame if you want to avoid dropping frames. Even if the hardware is actually 120 Hz, though, you can get by with just refreshing 60 times per second anyway, and targeting that is usually a good baseline to follow. 60 FPS is already beyond the point at which most people can easily detect that the animation isn't simply a series of still images going by really fast. In other words, when in doubt, you can assume that the display is refreshing at 60 Hz. As long as your code is written properly, everything will be fine. Renderer performance concerns Clearly, you have very little time to render your...
...2D surfaces. This is illustrated in the diagram below, in which we see how each eye perceives a die located directly in front of the viewer. While this diagram exaggerates the effect in some respects for illustrative purposes, the concept is the same. Each eye sees an area whose boundaries make up an arc in front of the eye. Because each eye is offset to one side or the other of the head's centerline, and each eye sees about the same field of view, the result is that each eye sees a slightly different part of the world in front of it, and from a slightly different angle. The left eye sees the die from a little bit to the left of center, and the right eye sees it from a bit to the right of center. As a result, the left eye sees just a little bit more of the left side of the object and a lit...
...at as possible, remembering that there's more going on than just your code in this one function. You need to make sure that the main thread doesn't need to run for more time per frame than the duration of the frame itself. A basic renderer In this version of the WebXR renderering callback, we use a very straightforward approach that works great for relatively simple projects. This pseudocode outlines that process: for each view in the pose's views list: get the WebXR GL layer's viewport set the WebGL viewport to match for each object in the scene bindProgram() bindVertices() bindMatrices() bindUniforms() bindBuffers() bindTextures() drawMyObject() Put simply, this form of renderer is using view-first order. Each of the two views making up the XR device's ...
...bindVertices() bindMatrices() drawMyObject() By changing things up in this way, we only bind programs, uniforms, buffers, textures, and potentially other things once per frame instead of twice for each object found in the scene. This reduces overhead by a potentially very large margin. Limiting the frame rate If you need to intentionally cap your frame rate in order to establish a baseline frame rate to try to maintain while allowing more time for other code to run, you can do so by skipping frames intentionally, on a timed basis. For example, to reduce the frame rate by 50%, just skip every other frame: let tick = 0; function drawFrame(time, frame) { animationFrameRequestID = frame.session.requestAnimationFrame(drawFrame); if (!(tick % 2)) { /* Draw the scene */ } ...
Using the Web Animations API - Web APIs
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. We're going to focus on just Alice for this tutorial. Here's the simplified CSS that controls Alice's animation: #alice { animation: aliceTumbling infinite 3s linear; } @keyframes aliceTumbling { 0% { color: #000; transform: rotate(0) translate3D(-50%, -50%, 0); } 30% { color: #431236; } 100% { color: #000; transform: rotate(360deg) translate3D(-50%, -50%, 0); } } This changes Alice's color and her transform's rotation over 3 seconds at a constant (linear) rate and loops infinitely. In the @keyframes block we can see that 3...
...y used in CSS Animations and the terminology used in Web Animations. For instance, Web Animations doesn't use the string "infinite", but instead uses the JavaScript keyword Infinity. And instead of timing-function we use easing. We aren't listing an easing value here because, unlike CSS Animations where the default animation-timing-function is ease, in the Web Animations API the default easing is linear -- which is what we want here. Bring the pieces together Now it's time to bring them both together with the Element.animate() method: document.getElementById("alice").animate( aliceTumbling, aliceTiming ) And boom: the animation starts playing (see the finished version on Codepen). The animate() method can be called on any DOM element that could be animated with CSS. And it can be wri...
...ce: aliceChange.currentTime = aliceChange.effect.getComputedTiming().duration / 2; effect lets us access the animation's keyframes and timing properties -- aliceChange.effect.getComputedTiming() points to Alice's timing object (which is of type ComputedEffectTiming) -- this contains her ComputedEffectTiming.duration. We can divide her duration in half to get the midpoint for her animation's timeline, setting her to be normal height. Now we can reverse and play her animation in either direction to make her grow smaller or larger! And we can do the same thing when setting the cake and bottle durations: var drinking = document.getElementById('liquid').animate( [ { height: '100%' }, { height: '0' } ], { fill: 'forwards', duration: aliceChange.effect.getComputedTiming().duration / 2 });...
... are presented with depends on how far along Alice was in her animation, whether she grew too big and can't get in the tiny door anymore or too small and cannot reach the key to open the door. We can figure out whether she's on the large end or small end of her animation by getting her animation's currentTime and dividing it by her activeDuration: var endGame = function() { // get Alice's timeline's playhead location var alicePlayhead = aliceChange.currentTime; var aliceTimeline = aliceChange.effect.getComputedTiming().activeDuration; // stops Alice's and other animations stopPlayingAlice(); // depending on which third it falls into var aliceHeight = alicePlayhead / aliceTimeline; if (aliceHeight <= .333){ // Alice got smaller! ... } else if (aliceHeight >= .666...
Migrating from webkitAudioContext - Web APIs
l = "equalpower"; // equalpower panning panner.panningModel = "HRTF"; // HRTF panning PannerNode.distanceModel PannerNode's distanceModel property has been changed to use Web IDL enums. ...
.../ equalpower panning panner.panningModel = "HRTF"; // HRTF panning PannerNode.distanceModel PannerNode's distanceModel property has been changed to use Web IDL enums. ...
...Instead of setting a gain property directly on an audio source, you connect the sou...
...r panner = context.createPanner(); panner.distanceModel = panner.LINEAR_DISTANCE; // linear distance model panner.distanceModel = panner.INVERSE_DISTANCE; // inverse distance model panner.distanceModel = panner.EXPONENTIAL_DISTANCE; // exponential distance model // Mew standard AudioContext code: var panner = context.createPanner(); panner.distanceModel = "linear"; // linear distance model panner.distanceModel = "inverse"; // inverse distance model panner.distanceModel = "exponential"; // exponential distance model Gain control moved to its own node type The Web Audio standard now controls all gain using the GainNode. Instead of setting a gain property directly on an audio source, you connect the source to a gain node and then con...
Visualizations with Web Audio API - Web APIs
here, we use requestAnimationFrame() to keep looping the drawing function once it has been started: var drawVisual = requestAnimationFrame(draw); Next, we grab the time domain data and copy it into our array analyser.getByteTimeDomainData(dataArray); Next, fill the canvas with a solid colour to start canvasCtx.fillStyle = 'rgb(200, 200, 200)'; canvasCtx.fillRect(0, 0, WIDTH, HEIGHT); Set a line width and stroke colour for the wave we will draw, then begin drawing a path canvasCtx.lineWidth = 2; canvasCtx.strokeStyle = 'rgb(0, 0, 0)'; canvasCtx.beginPath(); Determine the width of each segment of the line to be drawn by dividing the canvas width by the array length (equal to the FrequencyBinCount, as defined earlier on), then define an x variable to define the position to move to for dr...
...or the wave we will draw, then begin drawing a path canvasCtx.lineWidth = 2; canvasCtx.strokeStyle = 'rgb(0, 0, 0)'; canvasCtx.beginPath(); Determine the width of each segment of the line to be drawn by dividing the canvas width by the array length (equal to the FrequencyBinCount, as defined earlier on), then define an x variable to define the position to move to for drawing each segment of the line. ...
...al to the FrequencyBinCount, as defined earlier on), then define an x variable to define the position to move to for drawing each segment of the line. ...
...the wave for each point in the buffer at a certain height based on the data point value form the array, then moving the line across to the place where the next wave segment should be drawn: for(var i = 0; i < bufferLength; i++) { var v = dataArray[i] / 128.0; var y = v * HEIGHT/2; if(i === 0) { canvasCtx.moveTo(x, y); } else { canvasCtx.lineTo(x, y); } x += sliceWidth; } Finally, we finish the line in the middle of the right hand side of the canvas, then draw the stroke we've defined: canvasCtx.lineTo(canvas.width, canvas.height/2); canvasCtx.stroke(); }; At the end of this section of code, we invoke the draw() function to start off the whole process: draw(); This gives us a nice wavefo...
XMLHttpRequest.getAllResponseHeaders() - Web APIs
These are essentially delimiters separating each of the headers. Note: In modern browsers, the header names are returned in all lower case, as per the latest spec. Example This example examines the headers in the request's readystatechange event handler, XMLHttpRequest.onreadystatechange. The code shows how to obtain the ...
... 21:04:30 GMT\r\n content-encoding: gzip\r\n x-content-type-options: nosniff\r\n server: meinheld/0.6.1\r\n x-frame-options: DENY\r\n content-type: text/html; charset=utf-8\r\n connection: keep-alive\r\n strict-transport-security: max-age=63072000\r\n vary: Cookie, Accept-Encoding\r\n content-length: 6502\r\n x-xss-protection: 1; mode=block\r\n Each line is terminated by both carriage return and line feed characters (\r\n). These are essentially delimiters separating each of the headers. Note: In modern browsers, the header names are returned in all lower case, as per the latest spec. Example This example examines the headers in the request's readystatechange event handler, XMLHttpRequest.onreadystatechange. The code shows how to obtain the raw header string, as well as how to convert it...
... Specifications Specification Status Comment ...
... Specifications Specification Status Comment XMLHttpRequestThe definit...
XMLHttpRequestEventTarget - Web APIs
XMLHttpRequestEventTarget is the interface that describes the event handlers you can implement in an object that will handle events for an XMLHttpRequest. ...
... XMLHttpRequestEventTarget is the interface that describes the event handlers you can implement in an object that will handle events for an XMLHttpRequest. ...
... inline-block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 70" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/EventTarget" target="_top"><rect x="1" y="1" width="110" height="50" fill="#fff" stroke="#D4DDE4" stroke-width="2px" /><text x="56" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">EventTarget</text></a><polyline points="111,25 121,20 121,30 111,25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/XMLHttpRequestEventTarget" target="_top"><rect x="151" y="1" width="250" height="50" fill="#F4F7F8" stroke="#D4DDE4" stroke-width="2px" /><text x="276" y="30" font-size="12px" font-family="Consolas,Mo...
...25" stroke="#D4DDE4" fill="none"/><line x1="121" y1="25" x2="151" y2="25" stroke="#D4DDE4"/><a xlink:href="/docs/Web/API/XMLHttpRequestEventTarget" target="_top"><rect x="151" y="1" width="250" height="50" fill="#F4F7F8" stroke="#D4DDE4" stroke-width="2px" /><text x="276" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">XMLHttpRequestEventTarget</text></a></svg></div> a:hover text { fill: #0095DD; pointer-events: all;} Properties XMLHttpRequestEventTarget.onabort Contains the function to call when a request is aborted and the abort event is received by this object. XMLHttpRequestEventTarget.onerror Contains the function to call when a request encounters an error and the error event is re...
ARIA Test Cases - Accessibility
When the user navigates to the slider, the screen reader should announce the label, role and position of the slider. When not in a virtual buffer mode, the user can control the slider using keys suc...
...As the user moves the slider, JAWS announces the new position. The same is true for the second thumb (slider). Markup used: Notes: Results: AT Firefox IE Opera Safari JAWS 9 - - n/a n/a JAWS 10 - - - ...
... - - - - Orca - - - - Textbox dojo nightly build Expected AT Behavior: (MZ) When focus first lands on the textbox, its label and role should be indicated. If it also contains content, an indication should be given as for regular textboxes. If the text is automatically selected on focus, this should be indicated. ...
...build Expected AT Behavior: (MZ) When focus first lands on the textbox, its label and role should be indicated. If it also contains content, an indication should be given as for regular textboxes. If the text is automatically selected on focus, this should be indicated. Arrow keys should read by character or line as usual. (AL) I think we need more here. ...
An overview of accessible web applications and widgets - Accessibility
value. The techniques described above should be used to declare CSS to visually hide an element using display:none. Here is an example of a tooltip that uses aria-hidden to control the visibility of the tooltip. The example shows a simple web form with tooltips containing instructions associated with the entry fields. In this example, the HTML for the tooltip has the form shown in Example 2a. Line 9 sets the aria-hidden state to true. Example 2a. HTML for a tooltip <div class="text"> <label id="tp1-label" for="first">First Name:</label> <input type="text" id="first" name="first" size="20" aria-labelledby="tp1-label" aria-describedby="tp1" aria-required="false" /> <div id="tp1" class="tooltip" role="tooltip" aria-hidden="true"...
...me="first" size="20" aria-labelledby="tp1-label" aria-describedby="tp1" aria-required="false" /> <div id="tp1" class="tooltip" role="tooltip" aria-hidden="true">Your first name is optional</div> </div> The CSS for this markup is shown in Example 2b. Note that there is no custom classname used, only the status of the aria-hidden attribute on line 1. Example 2b. Attribute-based selector for indicating state div.tooltip[aria-hidden="true"] { display: none; } The JavaScript to update the aria-hidden property has the form shown in Example 2c. Note that the script only updates the aria-hidden attribute (line 2); it does not need to also add or remove a custom classname. Example 2c. JavaScript to update the aria-checked attribute var s...
...to update the aria-checked attribute var showTip = function(el) { el.setAttribute('aria-hidden', 'false'); } Role changes ARIA allows developers to declare a semantic role for an element that otherwise offers incorrect or no semantics. The role of an element should not change. Instead, remove the original element and replace it with an element with the new role. For example, consider an "inline edit" widget: a component that allows users to edit a piece of text in place, without switching contexts. This component has a "view" mode, in which the text is not editable, but is activatable, and an "edit" mode, in which the text can be edited. A developer might be tempted to implement the "view" mode using a read-only text <input> element and setting its ARIA role to button, then switching t...
... should also be controllable with the keyboard, without requiring a mouse. In practice, this usually involves following the conventions supported by similar widgets on the desktop, taking full advantage of the Tab, Enter, Spacebar, and arrow keys. Traditionally, keyboard navigation on the web has been limited to the Tab key. A user presses Tab to focus each link, button, or form on the page in a linear order, using Shift-Tab to navigate backwards. It's a one-dimensional form of navigation--forward and back, one element at a time. On fairly dense pages, a keyboard-only user often has to press the Tab key dozens of times before accessing the needed section. Implementing desktop-style keyboard conventions on the web has the potential to significantly speed up navigation for many users. Here's a...
Keyboard-navigable JavaScript widgets - Accessibility
ndex="-1">Sans-serif</li> <li id="serif" tabindex="-1">Serif</li> <li id="monospace" tabindex="-1">Monospace</li> <li id="fantasy" tabindex="-1">Fantasy</li> </ul> </li> <li id="mb1_menu2" tabindex="-1"> Style <ul id="styleMenu" title="Style" tabindex="-1"> <li id="italic" tabindex="-1">Italics</li> <li id="bold" tabindex="-1">Bold</li> <li id="underline" tabindex="-1">Underlined</li> </ul> </li> <li id="mb1_menu3" tabindex="-1"> Justification <ul id="justificationMenu" title="Justication" tabindex="-1"> <li id="left" tabindex="-1">Left</li> <li id="center" tabindex="-1">Centered</li> <li id="right" tabindex="-1">Right</li> <li id="justify" tabindex="-1">Justify</li> </ul> </li> </ul> Disabled controls ...
...the descendent element that currently has the virtual focus. The event handler on the container must respond to key and mouse events by updating the value of aria-activedescendant and ensuring that the current item is styled appropriately (for example, with a border or background color). See the source code of this ARIA radiogroup example for a direct illustration of how this works. General Guidelines Use onkeydown to trap key events, not onkeypress IE will not fire keypress events for non-alphanumeric keys. Use onkeydown instead. Ensure that keyboard and mouse produce the same experience To ensure that the user experience is consistent regardless of input device, keyboard and mouse event handlers should share code where appropriate. For example, the code that updates the tabindex or the ...
...lso be bound to keyboard events. For example, to ensure that the Enter key will activate an element, if you have an onclick="doSomething()", you should bind doSomething() to the key down event as well: onkeydown="return event.keyCode != 13 || doSomething();". Always draw the focus for tabindex="-1" items and elements that receive focus programatically IE will not automatically draw the focus outline for items that programatically receive focus. Choose between changing the background color via something like this.style.backgroundColor = "gray"; or add a dotted border via this.style.border = "1px dotted invert". In the dotted border case you will need to make sure those elements have an invisible 1px border to start with, so that the element doesn't grow when the border style is applied (borde...
...ose between changing the background color via something like this.style.backgroundColor = "gray"; or add a dotted border via this.style.border = "1px dotted invert". In the dotted border case you will need to make sure those elements have an invisible 1px border to start with, so that the element doesn't grow when the border style is applied (borders take up space, and IE doesn't implement CSS outlines). Prevent used key events from performing browser functions If your widget handles a key event, prevent the browser from also handling it (for example, scrolling in response to the arrow keys) by using your event handler's return code. If your event handler returns false, the event will not be propagated beyond your handler. For example: <span tabindex="-1" onkeydown="return handleKeyDown();...
Mobile accessibility checklist - Accessibility
evelopers. It is intended to continuously evolve as more patterns arise. Colour Colour contrast MUST comply with WCAG 2.1 AA level requirements: Contrast ratio of 4.5:1 for normal text (less than 18 point or 14 point bold.) Contrast ratio of 3:1 for large text (at least 18 point or 14 point bold.) Information conveyed via colour MUST be also available by other means too (underlined text for links, etc.) Visibility Content hiding techniques such as zero opacity, z-index order and off-screen placement MUST NOT be used exclusively to handle visibility. Everything other than the currently visible screen MUST be truly invisible (especially relevant for single page apps with multiple cards): USE the hidden attribute or visibility or display style properties. Unles...
...ontrols state changes must be provided via ARIA States such as aria-checked, aria-disabled, aria-selected, aria-expanded, and aria-pressed. Orientation Content should not be restricted to a single orientation, such as portrait or landscape, unless essential. WCAG 2.1: Orientation Examples of when an orientation is esssential is a piano application or a bank cheque. General Guidelines An app title MUST be provided. Headings MUST not break hierarchical structure <h1>Top level heading</h1> <h2>Secondary heading</h2> <h2>Another secondary heading</h2> <h3>Low level heading</h3> ARIA Landmark Roles SHOULD be used to describe an app or document structure, such as banner, complementary, contentinfo, main, navigation, search. For touch events, at least one of the f...
... Note: The original version of this document was written by Yura Zenevich. ...
... Note: The original version of this document was written by Yura Zenevich. ...
Robust - Accessibility
This article provides practical advice on how to write your web content so that it conforms to the success criteria outlined in the Robust principle of the Web Content Accessibility Guidelines (WCAG) 2.0 and 2.1. Robust states that content must be robust enough that it can be interpreted reliably by a wide variety of user agents, including assistive technologies. This can generally be achieved by following web standards and testing rigorously. ...
...riteria outlined in the Robust principle of the Web Content Accessibility Guidelines (WCAG) 2.0 and 2.1. Robust states that content must be robust enough that it can be interpreted reliably by a wide variety of user agents, including assistive technologies. This can generally be achieved by following web standards and testing rigorously. Note: To read the W3C definitions for Robust and its guidelines and success criteria, see Principle 4: Robust -- Content must be robust enough that it can be interpreted reliably by a wide variety of user agents, including assistive technologies. ...
...ide variety of user agents, including assistive technologies. This can generally be achieved by following web standards and testing rigorously. Note: To read the W3C definitions for Robust and its guidelines and success criteria, see Principle 4: Robust -- Content must be robust enough that it can be interpreted reliably by a wide variety of user agents, including assistive technologies. Guideline 4.1 -- Compatible: Maximize compatibility with current and future user agents, including assistive technologies This guideline focuses on making content as compatible as possible, not only with current user agents (e.g. browsers), but also with future ones too. Success criteria How to conform to the criteria Practical resource 4.1.1 Parsing (A) Content should...
...d, e.g. not only by sighted mouse users, but also by screenreader users, keyboard-only users, etc. See HTML: A good basis for accessibility and WAI-ARIA basics. 4.1.3 Status Messages (AA) added in 2.1 Assistive technology users are made aware of new status messages added to the page. Understanding Status Messages Note: Also see the WCAG description for Guideline 4.1: Compatible: Maximize compatibility with current and future user agents, including assistive technologies. See Also WCAG Perceivable Operable Understandable Robust ...
Understandable - Accessibility
This article provides practical advice on how to write your web content so that it conforms to the success criteria outlined in the Understandable principle of the Web Content Accessibility Guidelines (WCAG) 2.0 and 2.1. Understandable states that information and the operation of user interface must be understandable. Note: To read the W3C definitions for Understandable and its guidelines and success criteria, see Principle 3: Understandable -- Information and the operation of user interface must be understandable. Guideline 3.1 -- Readable: Make text content readable and understandable This guideline focuses on making text content as understandable as possible. Success criteria How to conform to the criteria Practical resource 3.1.1 Language of Page (...
... can be used to create a control that allows the reader to play back an audio file containing the correct pronounciation, and it also makes sense to include a textual pronounciation guide after difficult words, in the same way that you find in dictionary entries. See Video and audio content, and Pronunciation Guide for English Dictionary Note: Also see the WCAG description for Guideline 3.1 Readable: Make text content readable and understandable. Guideline 3.2 -- Predictable: Make Web pages appear and operate in predictable ways This guideline focuses on making user interfaces intuitive and understandable. Success criteria How to conform to the criteria Practical resource 3.2.1 On Focus (A) When a control or other page feature receives foc...
...urrent view (e.g. content or controls), let the user control when they want that change to occur (e.g. 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. Better to avoid such functionality if possible. Note: Also see the WCAG description for Guideline 3.2 Predictable: Make Web pages appear and operate in predictable ways. Guideline 3.3 -- Input Assistance: Help users avoid and correct mistakes This guideline centers around helping users enter correct information when required with the minimum of mistakes. Success criteria How to conform to the criteria Practical resource 3.3.1 Error Identification (A) Wh...
...ices, e.g. providing a dedicated link to a help page or service on each page, providing examples showing what successful completion should look like. 3.3.6 Error Prevention (All) (AAA) This principle builds on 3.3.4, extending its requirements to all user input situations, not just ones involving sensitive data. Again, see 3.3.4. Note: Also see the WCAG description for Guideline 3.3 Input Assistance: Help users avoid and correct mistakes. See Also WCAG Perceivable Operable Understandable Robust ...
:focus-visible - CSS: Cascading Style Sheets
rom elements styled with :focus. <input value="Default styles"><br> <button>Default styles</button><br> <input class="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. This matches the native focus behavior for controls like <button>. <custom-button tabindex="0" role="button">Click Me</cust...
...: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. This matches the native focus behavior for controls like <button>. ...
...tton, can use :focus-visible to selectively apply a focus indicator only on keyboard-focus. This matches the native focus behavior for controls like <button>. ...
... Accessibility concerns Low vision Make sure the visual focus indicator can be seen by people with low vision. This will also benefit anyone use a screen in a brightly lit space (like outside in the sun). ...
Handling content breaks in multicol - CSS: Cascading Style Sheets
d into a new column away from the image it refers to and ending a column with a heading looks strange. The fragmentation properties give us ways to exercise some control over this. There are various places we might want to control our breaks: Breaks inside boxes, for example inside a figure element. Breaks before and after boxes, which would include our heading example above. Breaks between lines. Breaks inside boxes To control breaks inside boxes use the break-inside property. This property takes values of: auto avoid avoid-page avoid-column avoid-region In the example below, we have applied break-inside to the figure element to prevent the caption from becoming separated from the image. Breaks before and after boxes The break-before and break-after properties are used t...
...figure element to prevent the caption from becoming separated from the image. Breaks before and after boxes The break-before and break-after properties are used to control breaks before and after elements. They take the following values when in a multicol context: auto avoid avoid-column column In this next example, we are forcing a column break before an h2 element. ...
...er boxes The break-before and break-after properties are used to control breaks before and after elements. They take the following values when in a multicol context: auto avoid avoid-column column In this next example, we are forcing a column break before an h2 element. Breaks between lines The orphans and widows properties are also useful. The orphans property controls the number of lines left on their own at the end of a fragment. The widows property controls the number left on their own at the start of a fragment. The orphans and widows properties take an integer as a value, which represents the number of lines to keep together at the end and start of a fragment, respectively. Note that these properties only work inside a block container, such as a paragraph. If the block has ...
... on their own at the end of a fragment. The widows property controls the number left on their own at the start of a fragment. The orphans and widows properties take an integer as a value, which represents the number of lines to keep together at the end and start of a fragment, respectively. Note that these properties only work inside a block container, such as a paragraph. If the block has fewer lines in it than the number that you specify as a value, all lines will be kept together. In the example below, we are using the orphans property to control the number of lines left at the bottom of a column. You can change that value to see the effect on the breaking of the content. When things don't work as expected If you have small amounts of content and are trying to control breaks in a numb...
CSS Display - CSS: Cascading Style Sheets
CSS Display is a module of CSS that defines how the CSS formatting box tree is generated from the document element tree and defines properties controlling it. ...
...isplay is a module of CSS that defines how the CSS formatting box tree is generated from the document element tree and defines properties controlling it. ...
...c concepts of flexbox Aligning Items in a Flex Container Controlling Ratios of Flex Items Along the Main Axis Cross-browser Flexbox mixins Mastering Wrapping of Flex Items Ordering Flex Items Relationship of flexbox to other layout methods Backwards Compatibility of Flexbox Typical use cases of Flexbox display: grid Basic Concepts of Grid Layout Relationship to other layout methods Line-based placement Grid template areas Layout using named grid lines Auto-placement in grid layout Box alignment in grid layout Grids, logical values and writing modes CSS Grid Layout and Accessibility CSS Grid Layout and Progressive Enhancement Realizing common layouts using grids Specifications Specification Status Comment CSS Display Module Level 3The defini...
...sing grids Specifications Specification Status Comment CSS Display Module Level 3The definition of 'display' in that specification. Candidate Recommendation Added run-in, flow, flow-root, contents and multi-keyword values. CSS Level 2 (Revision 1)The definition of 'display' in that specification. Recommendation Added the table model values and inline-block. CSS Level 1The definition of 'display' in that specification. Recommendation Initial definition. Basic values: none, block, inline and list-item. In addition to the CSS Display Specification Level 3, further specifications define the behavior of various values of display. ...
In Flow and Out of Flow - CSS: Cascading Style Sheets
All of the elements can be said to be in flow. Appearing on the page in the order that they are in the source. ...
... All of the elements can be said to be in flow. Appearing on the page in the order that they are in the source. ...
... All of the elements can be said to be in flow. Appearing on the page in the order that they are in the source. ...
...example I have a div, and then two paragraphs. I've added a background colour to the paragraphs, and then floated the div left. The div is now out of flow. As a float it is first laid out according to where it would be in normal flow, then taken out of flow and moved to the left as far as possible. You can see the background colour of the following paragraph running underneath, it is only the line boxes of that paragraph that have been shortened to cause the effect of wrapping content around the float. The box of our paragraph is still displaying according to the rules of normal flow. This is why, to make space around a floated item, you must add a margin to the item, in order to push the line boxes away from it. You cannot apply anything to the following in-flow content to achieve that. ...
CSS Flow Layout - CSS: Cascading Style Sheets
Normal Flow, or Flow Layout, is the way that Block and Inline elements are displayed on a page before any changes are made to their layout. The flow is essentially a set of things that are all working together and know about each other in your layout. Once something is taken out of flow it works independently. In normal flow, inline elements display in the inline direction, that is in the direction words are displayed in a sentence according to the Writing Mode of the document. Block elements display one after the other, as paragraphs do in the Writing Mode of that document. In English therefore, inline elements display one after the other, starting on the left, and block elements start at the top and move down the page. ...
...rection words are displayed in a sentence according to the Writing Mode of the document. Block elements display one after the other, as paragraphs do in the Writing Mode of that document. In English therefore, inline elements display one after the other, starting on the left, and block elements start at the top and move down the page. Basic Example The following example demonstrates Block and Inline Level boxes. The two paragraph elements with a green border are Block Level, displaying one under the other. The first sentence also includes a span element with a blue background. ...
...h therefore, inline elements display one after the other, starting on the left, and block elements start at the top and move down the page. Basic Example The following example demonstrates Block and Inline Level boxes. The two paragraph elements with a green border are Block Level, displaying one under the other. The first sentence also includes a span element with a blue background. This is inline level and therefore displays in place in the sentence. ...
...lock elements start at the top and move down the page. Basic Example The following example demonstrates Block and Inline Level boxes. The two paragraph elements with a green border are Block Level, displaying one under the other. The first sentence also includes a span element with a blue background. This is inline level and therefore displays in place in the sentence. ...
CSS Scroll Snap - CSS: Cascading Style Sheets
may end at after a scrolling operation has completed. Note: The previous version of this module was called Scroll Snap Points and has been deprecated. CSS Scroll Snap is the current implementation. ...
...lling operation has completed. Note: The previous version of this module was called Scroll Snap Points and has been deprecated. CSS Scroll Snap is the current implementation. ...
.... Note: The previous version of this module was called Scroll Snap Points and has been deprecated. CSS Scroll Snap is the current implementation. ...
...ll-padding-top scroll-padding-right scroll-padding-bottom scroll-padding-left scroll-padding-inline scroll-padding-inline-start scroll-padding-inline-end scroll-padding-block scroll-padding-block-start scroll-padding-block-end CSS Properties on Children scroll-snap-align scroll-margin scroll-margin-top scroll-margin-right scroll-margin-bottom scroll-margin-left scroll-margin-inline scroll-margin-inline-start scroll-margin-inline-end scroll-margin-block scroll-margin-block-start scroll-margin-block-end Guides Basic concepts of CSS Scroll Snap Browser Compatibility and Scroll Snap Specification Specification Status Comment CSS Scroll Snap Module Level 1 Candidate Recommendation Initial definition ...
Overview of CSS Shapes - CSS: Cascading Style Sheets
on describes geometric shapes in CSS. They are, in Level 1 of the specification, designed to be applied to floated items. This article provides an overview of what you can do with shapes. You could for example float an item left, which would cause the text to wrap round the right and bottom of the item in a rectangular fashion. If you then apply a circle shape, the text would then wrap round the line of the circle. There are a number of ways to create these Shapes and in these guides we will find out how CSS Shapes work, and consider some ways you might like to use them. What does the specification define? The specification defines three new properties: shape-outside -- allows definition of basic shapes shape-image-threshold -- Sets an opacity threshold value. If an image is being used...
...of a rectangular box as before. If they do have Shapes support then the visual display is enhanced. Basic Shapes The value circle(50%) is an example of a Basic Shape. The specification defines four <basic-shape> values, which are: inset() circle() ellipse() polygon() Using the value inset() wraps text around a rectangular shape however you are able to add offset values, thus pulling the line boxes of any wrapping content closer to the object than would otherwise happen. We have already seen how circle() creates a circular shape. An ellipse() is essentially a squashed circle. If none of these simple shapes do the trick you can create a polygon() and make the shape as complex as you want. In our Guide to Basic Shapes we explore each of the possible Basic Shapes and how to create them...
...use a gradient as the image on which to define our shape. In the example below, if you change the threshold the path that the shape takes changes based on the level of opacity you have selected. We take a deeper look at creating shapes from images in the Shapes from Images guide. The shape-margin property The shape-margin property adds a margin to shape-outside. This will further shorten the line boxes of any content wrapping the shape, pushing it away from the shape itself. In the example below we have added a shape-margin to a basic shape. Change the margin to push the text further away from the path the shape would take by default. Using Generated Content as the floated item In the examples above we have used images or a visible element to define the shape, meaning that you can se...
...a shape-margin to a basic shape. Change the margin to push the text further away from the path the shape would take by default. Using Generated Content as the floated item In the examples above we have used images or a visible element to define the shape, meaning that you can see the shape on the page. Instead, you might simply want to cause some text to flow along a non-rectangular invisible line. You can do this with Shapes, however you will still need a floated item, which you can then make invisible. That could be a redundant element inserted into the document, an empty <div> or <span> perhaps, but our preference is to use generated content. This means we can keep things used for styling inside the CSS. In this next example, we use generated content to insert an element with height an...
Column layouts - CSS: Cascading Style Sheets
d, Flexbox or Multi-column layout will depend on what you are trying to achieve, and in this recipe we explore these options. Requirements There are a number of design patterns you might want to achieve with your columns: A continuous thread of content broken up into newspaper-style columns. A single row of items arranged as columns, with all heights being equal. Multiple rows of columns lined up by row and column. The recipes You need to choose different layout methods in order to achieve your requirements. A continuous thread of content -- multi-column layout If you create columns using multi-column layout your text will remain as a continuous stream filling each column in turn. The columns must all be the same size, and you are unable to target an individual column or the cont...
...t you saw with multicol. There is currently no way to add a rule between flex items, and browser support for the column-gap and row-gap properties is limited. Therefore to create gaps between items use a margin. Download this example Flexbox can also be used to create layouts where the flex items wrap onto new rows, by setting the flex-wrap property on the container to wrap. These new flex lines will distribute space along that line only -- the items in the new line will not line up with items in the line above, as you'll see in the example below. This is why flexbox is described as one-dimensional. It is designed for controlling layout as a row or a column, but not both at the same time. Download this example Use flexbox: For single rows or columns of items. When you want to ...
...l see in the example below. This is why flexbox is described as one-dimensional. It is designed for controlling layout as a row or a column, but not both at the same time. Download this example Use flexbox: For single rows or columns of items. When you want to do alignment on the cross axis after laying out your items. When you are happy for wrapped items to share out space along their line only and not line up with items in other lines. Lining items up in rows and columns -- grid layout If what you want is a layout where items line up in rows and columns then you should choose CSS Grid Layout. Grid Layout works on the direct children of the grid container in a similar way to the manner in which flexbox works on the direct children of the flex container, however with CSS Grid you...
... and not line up with items in other lines. Lining items up in rows and columns -- grid layout If what you want is a layout where items line up in rows and columns then you should choose CSS Grid Layout. Grid Layout works on the direct children of the grid container in a similar way to the manner in which flexbox works on the direct children of the flex container, however with CSS Grid you can line your items up in rows and columns -- it is described as two-dimensional. Download this example Use Grid: For multiple rows or columns of items. When you want to be able to align the items on the block and inline axes. When you want items to line up in rows and columns. ...
Specificity - CSS: Cascading Style Sheets
es selectors (e.g., [type="radio"]) and pseudo-classes (e.g., :hover). ID selectors (e.g., #example). Universal selector (*), combinators (+, >, ~, ' ', ||) and negation pseudo-class (:not()) have no effect on specificity. (The selectors declared inside :not() do, however.) For more information, visit: "Specificity" in "Cascade and inheritance", you can also visit: https://specifishity.com Inline styles added to an element (e.g., style="font-weight: bold;") always overwrite any styles in external stylesheets, and thus can be thought of as having the highest specificity. The !important exception When an important rule is used on a style declaration, this declaration overrides any other declarations. Although technically !important has nothing to do with specificity, it interacts directly...
...will be green because that rule is most specific. (Also, the rule for blue overwrites the rule for red, notwithstanding the order of the rules) As a nonsense special case for (2), duplicate simple selectors to increase specificity when you have nothing more to specify. ...
...otwithstanding the order of the rules) As a nonsense special case for (2), duplicate simple selectors to increase specificity when you have nothing more to specify. #myId#myId span { color: yellow; } .myClass.myClass span { color: orange; } How !important can be used: A) Overriding inline styles Your global CSS file that sets visual aspects of your site globally may be overwritten by inline styles defined directly on individual elements. Both inline styles and !important are considered very bad practice, but sometimes you need the latter to override the former. In this case, you could set certain styles in your global CSS file as !important, thus overriding inline styles set directly on elements. <div class="foo" style="color: red;">What color am I?</div> .foo[style*="color: red...
...considered very bad practice, but sometimes you need the latter to override the former. In this case, you could set certain styles in your global CSS file as !important, thus overriding inline styles set directly on elements. <div class="foo" style="color: red;">What color am I?</div> .foo[style*="color: red"] { color: firebrick !important; } Many JavaScript frameworks and libraries add inline styles. Using !important with a very targeted selector is one way to override these inline styles. B) Overriding high specificity #someElement p { color: blue; } p.awesome { color: red; } How do you make awesome paragraphs always turn red, even ones inside #someElement? Without !important, the first rule will have more specificity and will win over the second rule. How to override !impor...
appearance (-moz-appearance, -webkit-appearance) - CSS: Cascading Style Sheets
-apple-pay-button div{ color: black; -webkit-appearance: -apple-pay-button; } <div>Lorem</div> Safari iOS and macOS only. Available on the web starting in iOS 10.1 and ma...
... -apple-pay-button div{ color: black; -webkit-appearance: -apple-pay-button; } <div>Lorem</div> Safari iOS and macOS only. Available on the web starting in iOS 10.1 and macOS 10.12.1 Obsolete values The following values were at some p...
...ppearance: slider-thumb-horizontal; } <div>Lorem</div> Chrome Safari Edge sliderthumb-vertical div{ color: black; -webkit-appearance: slider-thumb-vertical; } <div>Lorem</div> Chrome Safari Edge textfield-multiline div { color: black; -moz-appearance: textfield-multiline; -webkit-appearance: textfield-multiline; } <div>Lorem</div> Firefox Use textarea instead. -apple-pay-button div{ color: black; -webkit-appearance: -apple-pay-button; } <div>Lorem</div> Safari iOS and macOS only. Available on the web starting in iOS 10.1 and macOS 10.12.1 Obsolete values The following values were at some point implemented for a prefixed property,...
... in Firefox 64. toolbox Firefox Removed in Firefox 64. tooltip Firefox Removed in Firefox 64. treeheader Firefox Removed in Firefox 64. treeheadercell Firefox Removed in Firefox 64. treeheadersortarrow Firefox Removed in Firefox 64. treeitem Firefox Removed in Firefox 64. treeline Firefox Removed in Firefox 64. treetwisty Firefox Removed in Firefox 64. treetwistyopen Firefox Removed in Firefox 64. treeview Firefox Removed in Firefox 64. -moz-win-borderless-glass Firefox Removed in Firefox 64. -moz-win-browsertabbar-toolbox Firefox Removed in Firefox 64. -moz-wi...
border-bottom - CSS: Cascading Style Sheets
) | rgb( <number>{3} [ / <alpha-value>...
...) | rgb( <number>{3} [ / <alpha-value> ]? ) | rgb( <p...
...) | rgb( <number>{3} [ / <alpha-value> ]? ) | rgb( <percentage>#{3} , <alpha-valu...
...) | rgb( <number>{3} [ / <alpha-value> ]? ) | rgb( <percentage>#{3} , <alpha-value>? ) | rgb( <number>#{3} , <alpha-value>? )<rg...
border-image - CSS: Cascading Style Sheets
der-style in case the border image fails to load. Indeed, this is required according to the specification, although not all browsers implement this requirement. ...
...ent. Constituent properties This property is a shorthand for the following CSS properties: border-image-outset border-image-repeat border-image-slice border-image-source border-image-width Syntax /* source | slice */ border-image: linear-gradient(red, blue) 27; /* source | slice | repeat */ border-image: url("/images/border.png") 27 space; /* source | slice | width */ border-image: linear-gradient(red, blue) 27 / 35px; /* source | slice | width | outset | repeat */ border-image: url("/images/border.png") 27 23 / 50px 30px / 1rem round space; The border-image property may be specified with anywhere from one to five of the values listed below. Note: If the computed value of border-image-source is none, or if the image cannot be displayed, the border-style will be displayed in...
...ge regions of the source image are adjusted to fit the dimensions of the border image. Up to two values may be specified. See border-image-repeat. Accessibility concerns Assistive technology cannot parse border images. If the image contains information critical to understanding the page's overall purpose, it is better to describe it semantically in the document. MDN Understanding WCAG, Guideline 1.1 explanations Understanding Success Criterion 1.1.1 | Understanding WCAG 2.0 Formal definition Initial valueas each of the properties of the shorthand:border-image-source: noneborder-image-slice: 100%border-image-width: 1border-image-outset: 0border-image-repeat: stretchApplies toall elements, except internal table elements when border-collapse is collapse. It also applies to ::first-lett...
... Candidate Recommendation Initial definition Initial valueas each of the properties of the shorthand:border-image-source: noneborder-image-s...
border-left - CSS: Cascading Style Sheets
) | rgb( <number>{3} [ / <alpha-value>...
...) | rgb( <number>{3} [ / <alpha-value> ]? ) | rgb( <p...
...) | rgb( <number>{3} [ / <alpha-value> ]? ) | rgb( <percentage>#{3} , <alpha-valu...
...) | rgb( <number>{3} [ / <alpha-value> ]? ) | rgb( <percentage>#{3} , <alpha-value>? ) | rgb( <number>#{3} , <alpha-value>? )<rg...
border-right - CSS: Cascading Style Sheets
) | rgb( <number>{3} [ / <alpha-value>...
...) | rgb( <number>{3} [ / <alpha-value> ]? ) | rgb( <p...
...) | rgb( <number>{3} [ / <alpha-value> ]? ) | rgb( <percentage>#{3} , <alpha-valu...
...) | rgb( <number>{3} [ / <alpha-value> ]? ) | rgb( <percentage>#{3} , <alpha-value>? ) | rgb( <number>#{3} , <alpha-value>? )<rg...
border-style - CSS: Cascading Style Sheets
The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...specified, the first style applies to the top and bottom, the second to the left and right. When three values are specified, the first style applies to the top, the second to the left and right, the third to the bottom. When four values are specified, the styles apply to the top, right, bottom, and left in that order (clockwise). Each value is a keyword chosen from the list below. Values <line-style> Describes the style of the border. It can have the following values: none Like the hidden keyword, displays no border. Unless a background-image is set, the computed value of the same side's border-width will be 0, even if the specified value is something else. In the case of table cell and border collapsing, the none value has the lowest priority: if any ...
...f any other conflicting border is set, it won't be displayed. dotted Displays a series of rounded dots. The spacing of the dots is not defined by the specification and is implementation-specific. The radius of the dots is half the computed value of the same side's border-width. dashed Displays a series of short square-ended dashes or line segments. The exact size and length of the segments are not defined by the specification and are implementation-specific. solid Displays a single, straight, solid line. double Displays two straight lines that add up to the pixel size defined by border-width. groove Displays a border with a carved appea...
...the shorthand:border-top-style: noneborder-right-style: noneborder-bottom-style: noneborder-left-style: noneApplies toall elements. It also applies to ::first-letter.InheritednoComputed valueas each of the properties of the shorthand:border-bottom-style: as specifiedborder-left-style: as specifiedborder-right-style: as specifiedborder-top-style: as specifiedAnimation typediscrete Formal syntax <line-style>{1,4}where <line-style> = none | hidden | dotted | dashed | solid | double | groove | ridge | inset | outset Examples Table with all property values Here is an example of all the property values. HTML <table> <tr> <td class="b1">none</td> <td class="b2">hidden</td> <td class="b3">dotted</td> <td class="b4">dashed</td> </tr> <tr> <td class="b5">solid</td> <...
border-top - CSS: Cascading Style Sheets
ts. ...
...) | rgb( <number>{3} [ / <alpha-value> ]? ) | rgb( <p...
...) | rgb( <number>{3} [ / <alpha-value> ]? ) | rgb( <percentage>#{3} , <alpha-valu...
...) | rgb( <number>{3} [ / <alpha-value> ]? ) | rgb( <percentage>#{3} , <alpha-value>? ) | rgb( <number>#{3} , <alpha-value>? )<rg...
box-align - CSS: Cascading Style Sheets
Web › CSS › box-align
e draft, and has been replaced by a newer standard. The box-align CSS property specifies how an element aligns its contents across its layout in a perpendicular direction. The effect of the property is only visible if there is extra space in the box. See flexbox for information about the current standard. /* Keyword values */ box-align: start; box-align: center; box-align: end; box-align: baseline; box-align: stretch; /* Global values */ box-lines: inherit; box-lines: initial; box-lines: unset; The direction of layout depends on the element's orientation: horizontal or vertical. Syntax The box-align property is specified as one of the keyword values listed below. Values start The box aligns contents at the start, leaving any extra space at the end. center The box aligns content...
...orizontal or vertical. Syntax The box-align property is specified as one of the keyword values listed below. Values start The box aligns contents at the start, leaving any extra space at the end. center The box aligns contents in the center, dividing any extra space equally between the start and the end. end The box aligns contents at the end, leaving any extra space at the start. baseline The box aligns the baselines of the contents (lining up the text). This only applies if the box's orientation is horizontal. stretch The box stretches the contents so that there is no extra space in the box. Notes The edge of the box designated the start for alignment purposes depends on the box's orientation: Horizontal top Vertical left The edge opposite to...
... The edge of the box designated the start for alignment purposes depends on the box's orientation: Horizontal top Vertical left The edge opposite to the start is designated the end. If the alignment is set using the element's align attribute, then the style is ignored. ...
...orizontal top Vertical left The edge opposite to the start is designated the end. If the alignment is set using the element's align attribute, then the style is ignored. ...
box-decoration-break - CSS: Cascading Style Sheets
The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...-decoration-break: clone; /* Global values */ box-decoration-break: initial; box-decoration-break: inherit; box-decoration-break: unset; The box-decoration-break property is specified as one of the keyword values listed below. Values slice The element is initially rendered as if its box were not fragmented, after which the rendering for this hypothetical box is sliced into pieces for each line/column/page. Note that the hypothetical box can be different for each fragment since it uses its own height if the break occurs in the inline direction, and its own width if the break occurs in the block direction. See the CSS specification for details. clone Each box fragment is rendered independently with the specified border, padding, and margin wrapping each fragment. The border-radius, bor...
...age, and box-shadow are applied to each fragment independently. The background is also drawn independently for each fragment, which means that a background image with background-repeat: no-repeat may nevertheless repeat multiple times. Formal definition Initial valuesliceApplies toall elementsInheritednoComputed valueas specifiedAnimation typediscrete Formal syntax slice | clone Examples Inline box fragments An inline element that contains line breaks styled with: .example { background: linear-gradient(to bottom right, yellow, green); box-shadow: 8px 8px 10px 0px deeppink, -5px -5px 5px 0px blue, 5px 5px 15px 0px yellow; padding: 0em 1em; border-radius: 16px; border-style: solid; margin-left: 10px; font: 24px sans-serif; line-height: 2; } ... <span class="...
...5px 15px 0px yellow; padding: 0em 1em; border-radius: 16px; border-style: solid; margin-left: 10px; font: 24px sans-serif; line-height: 2; } ... <span class="example">The<br>quick<br>orange fox</span> ... results in: Adding box-decoration-break: clone to the above styles: -webkit-box-decoration-break: clone; box-decoration-break: clone; ... results in: You can try the two inline examples above in your browser. Here's an example of an inline element using a large border-radius value. The second "iM" has a line-break between the "i" and the "M". For comparison, the first "iM" is without line breaks. Note that if you stack the rendering of the two fragments horizontally next to each other it will result in the non-fragmented rendering. Try the above example in your brow...
box-orient - CSS: Cascading Style Sheets
This is a property of the original CSS Flexible Box Layout Module draft, and has been replaced by a newer standard. See flexbox for information about the current standard. The box-orient CSS property sets whether an element lays out its contents horizontally or vertically. /* Keyword values */ box-orient: horizontal; box-orient: vertical; box-orient: inline-axis; box-orient: block-axis; /* Global values */ box-orient: inherit; box-orient: initial; box-orient: unset; Syntax The box-orient property is specified as one of the keyword values listed below. Values horizontal The box lays out its contents horizontally. vertical The box lays out its contents vertically. inline-axis (HTML) The box displays its children along the inline axis. block-axis (HTML) The box display...
...orient: initial; box-orient: unset; Syntax The box-orient property is specified as one of the keyword values listed below. Values horizontal The box lays out its contents horizontally. vertical The box lays out its contents vertically. inline-axis (HTML) The box displays its children along the inline axis. block-axis (HTML) The box displays its children along the block axis. The inline and block axes are the writing-mode dependent keywords which, in English, map to horizontal and vertical respectively. ...
.... vertical The box lays out its contents vertically. inline-axis (HTML) The box displays its children along the inline axis. block-axis (HTML) The box displays its children along the block axis. The inline and block axes are the writing-mode dependent keywords which, in English, map to horizontal and vertical respectively. Description HTML DOM elements lay out their contents along the inline-axis by default. This CSS property will only apply to HTML elements with a CSS display value of box or inline-box. ...
...x displays its children along the block axis. The inline and block axes are the writing-mode dependent keywords which, in English, map to horizontal and vertical respectively. Description HTML DOM elements lay out their contents along the inline-axis by default. This CSS property will only apply to HTML elements with a CSS display value of box or inline-box. Formal definition Initial valueinline-axis (horizontal in XUL)Applies toelements with a CSS display value of box or inline-boxInheritednoComputed valueas specifiedAnimation typediscrete Formal syntax horizontal | vertical | inline-axis | block-axis | inherit Examples Setting horizontal box orientation Here, he box-orient property will cause the two <p> sections in the example to display in the same line. HTML <div class="examp...
conic-gradient() - CSS: Cascading Style Sheets
r properties that use the <color> data type. Why is it called a "conic" gradient? If the color stops are much lighter on one side than the other, it can look like a cone from above. Composition of a conic gradient The conic-gradient syntax is similar to the radial-gradient syntax, but the color-stops are placed around a gradient arc, the circumference of a circle, rather than on the gradient line emerging from the center of the gradient. With conic gradients, the colors transition as as if spun around the center of a circle, starting at the top and going clockwise. In a radial gradient, the colors transition from the center of an ellipse, outward, in all directions. A conic gradient is specified by indicating a rotation angle, the center of the gradient, and then specifying a list of c...
...center of the gradient. With conic gradients, the colors transition as as if spun around the center of a circle, starting at the top and going clockwise. In a radial gradient, the colors transition from the center of an ellipse, outward, in all directions. A conic gradient is specified by indicating a rotation angle, the center of the gradient, and then specifying a list of color-stops. Unlike linear and radial gradients, whose color-stops are placed by specifying a length, the color-stops of a conic gradient are specified with an angle. Units include deg for degrees, grad for gradients, rad for radians, and turn for turns. There are 360 degrees, 400 gradians, 2? radians, and 1 turn in a circle. Browsers supporting conic gradients also accept percent values, with 100% equaling 360 degrees, ...
...e 10% mark, transitions from red to blue over 80% of the turn, with the final 10% being solid blue. The midpoint of the red to blue gradient change, however, is at the 20% mark rather than the 50% mark as would have happened without the 80grad, or 20%, color hint. conic-gradient(red 40grad, 80grad, blue 360grad); If two or more color stops are at the same location, the transition will be a hard line between the first and last colors declared at that location. To use conic gradients to create pie charts --- which is NOT the correct way to create pie charts as background images are not accessible -- use hard color stops, where the color stop angles for two adjacent color stops are the same. The easiest way to do this is to use multip position colors stops. The following two declarations are eq...
... checkerboards, and other effects with conic gradients, CSS images provide no native way to assign alternative text, and therefore the image represented by the conic gradient will not be accessible to screen reader users. If the image contains information critical to understanding the page's overall purpose, it is better to describe it semantically in the document. ...
<display-legacy> - CSS: Cascading Style Sheets
CSS 2 used a single-keyword syntax for the display property, requiring separate keywords for block-level and inline-level variants of the same layout mode. This page details those values. Syntax Valid <display-legacy> values: inline-block The element generates a block element box that will be flowed with surrounding content as if it were a single inline box (behaving much like a replaced element would). It is equivalent to inline flow-root. inline-table The inline-table value does not have a direct mapping in HTML. It behaves like an HTML <table> element, but as an inline box, rather than a block-level box. Inside the table box is a block-level context. ...
...e flowed with surrounding content as if it were a single inline box (behaving much like a replaced element would). It is equivalent to inline flow-root. inline-table The inline-table value does not have a direct mapping in HTML. It behaves like an HTML <table> element, but as an inline box, rather than a block-level box. Inside the table box is a block-level context. It is equivalent to inline table. inline-flex The element behaves like an inline element and lays out its content according to the flexbox model. It is equivalent to inline flex. inline-grid The element behaves like an inline element and lays out its content according to the grid model. It is equivalent to inline grid. ...
...l context. It is equivalent to inline table. inline-flex The element behaves like an inline element and lays out its content according to the flexbox model. It is equivalent to inline flex. inline-grid The element behaves like an inline element and lays out its content according to the grid model. It is equivalent to inline grid. Examples In the below example, we are creating an inline flex container with the legacy keyword inline-flex. HTML <div class="container"> <div>Flex Item</div> <div>Flex Item</div> </div> Not a flex item CSS .container { display: inline-flex; } Result In the new syntax the inline flex container would be created using two values, inline for the outer display type, and flex for the inner display type. ...
... inline flex container with the legacy keyword inline-flex. HTML <div class="container"> <div>Flex Item</div> <div>Flex Item</div> </div> Not a flex item CSS .container { display: inline-flex; } Result In the new syntax the inline flex container would be created using two values, inline for the outer display type, and flex for the inner display type. .container { display: inline flex; } Specifications Specification Status CSS Display Module Level 3The definition of 'display-legacy' in that specification. Candidate Recommendation ...
<display-outside> - CSS: Cascading Style Sheets
y the element's outer display type, which is essentially its role in flow layout. These keywords are used as values of the display property, and can be used for legacy purposes as a single keyword, or as defined in the Level 3 specification alongside a value from the <display-inside> keywords. Syntax Valid <display-outside> values: block The element generates a block element box, generating line breaks both before and after the element when in the normal flow. inline The element generates one or more inline element boxes that do not generate line breaks before or after themselves. In normal flow, the next element will be on the same line if there is space run-in The element generates a run-in box. If the adjacent sibling of the element defined as display: run-in box is a block box,...
...ement when in the normal flow. inline The element generates one or more inline element boxes that do not generate line breaks before or after themselves. In normal flow, the next element will be on the same line if there is space run-in The element generates a run-in box. If the adjacent sibling of the element defined as display: run-in box is a block box, the run-in box becomes the first inline box of the block box that follows it. Run-in elements act like inlines or blocks, depending on the surrounding elements. That is: If the run-in box contains a block box, same as block. If a block box follows the run-in box, the run-in box becomes the first inline box of the block box. If an inline box follows, the run-in box becomes a block box. Note: Browsers that support the two value sy...
...ocks, depending on the surrounding elements. That is: If the run-in box contains a block box, same as block. If a block box follows the run-in box, the run-in box becomes the first inline box of the block box. If an inline box follows, the run-in box becomes a block box. Note: Browsers that support the two value syntax, on finding the outer value only, such as when display: block or display: inline is specified, will set the inner value to flow. ...
...follows, the run-in box becomes a block box. Note: Browsers that support the two value syntax, on finding the outer value only, such as when display: block or display: inline is specified, will set the inner value to flow. This will result in expected behavior; for example if you specify an element to be block, you would expect that the children of that element would participate in block and inline normal flow layout. Examples In the following example, span elements (normally displayed as inline elements) are set to display: block and so break onto new lines and expand to fill their container in the inline dimension. HTML <span>span 1</span> <span>span 2</span> CSS span { display: block; border: 1px solid rebeccapurple; } Result Specifications Specification S...
<easing-function> - CSS: Cascading Style Sheets
s, such as left or right, this creates a kind of "bouncing" effect. However, certain properties will restrict the output if it goes outside an allowable range. For example, a color component greater than 255 or smaller than 0 will be clipped to the closest allowed value (255 and 0, respectively). Some cubic-bezier() curves exhibit this property. Syntax There are three types of easing function: linear, cubic Bezier curves, and staircase functions. The value of an <easing-function> type describes the easing function using one of those three types. Easing functions CSS supports three kinds of easing functions: linear, the subset of the cubic Bezier curves that are functions, and staircase functions. The most useful of these functions are given a keyword that allows them to be easily referenc...
...This keyword represents the easing function cubic-bezier(0.0, 0.0, 1.0, 1.0). ...
...This keyword represents the easing function cubic-bezier(0.0, 0.0, 1.0, 1.0). ...
... the available keywords, plus a couple of cubic-bezier() and steps() options. The idea is to provide an easy comparison between different easing functions. ...
font-variant-position - CSS: Cascading Style Sheets
These glyphs are typically used in <sub> and <sup> elements. ...
...*/ font-variant-position: inherit; font-variant-position: initial; font-variant-position: unset; When the usage of these alternate glyphs is activated, if one character in the run doesn't have such a typographically-enhanced glyph, the whole set of characters of the run is rendered using a fallback method, synthesizing these glyphs. These alternate glyphs share the same em-box and the same baseline as the rest of the font. They are merely graphically enhanced, and have no effect on the line-height and other box characteristics. Syntax The font-variant-position property is specified as one of the keyword values listed below. Values normal Deactivates alternate superscript and subscript glyphs. sub Activates subscript alternate glyphs. If, in a given run, one such glyph is not avail...
...h is not available for a character, all the characters in the run are rendered using synthesized glyphs. super Activates superscript alternate glyphs. If, in a given run, one such glyph is not available for a character, all the characters in the run are rendered using synthesized glyphs. Formal definition Initial valuenormalApplies toall elements. ...
...ing synthesized glyphs. Formal definition Initial valuenormalApplies toall elements. It also applies to ::first-letter and ::first-line.InheritedyesComputed valueas specifiedAnimation typediscrete Formal syntax normal | sub | super Examples Setting superscript and subscript forms HTML <p class="normal">Normal!</p> <p class="super">Super!</p> <p class="sub">Sub!</p> CSS p { display: inline; } .normal { font-variant-position: normal; } .super { font-variant-position: super; } .sub { font-variant-position: sub; } Result Specifications Specification Status Comment CSS Fonts Module Level 3The definition of 'font-variant-position' in that specification. Candidate Recommendation Initial definition. Browser compatibility The compati...
grid-template - CSS: Cascading Style Sheets
active-examples and send us a pull request. ...
...e longhand properties to none, meaning there is no explicit grid. There are no named grid areas. Rows and columns will be implicitly generated; their size will be determined by the grid-auto-rows and grid-auto-columns properties. <'grid-template-rows'> / <'grid-template-columns'> Sets grid-template-rows and grid-template-columns to the specified values, and sets grid-template-areas to none. [ <line-names>? <string> <track-size>? <line-names>? ]+ [ / <explicit-track-list> ]? Sets grid-template-areas to the strings listed, grid-template-rows to the track sizes following each string (filling in auto for any missing sizes), and splicing in the named lines defined before/after each size, and grid-template-columns to the track listing specified after the slash (or none, if not specified). No...
... Note: The grid shorthand accepts the same syntax, but also resets the implicit grid properties to their initial values. ...
...of the content areaComputed valueas each of the properties of the shorthand:grid-template-columns: as specified, but with relative lengths converted into absolute lengthsgrid-template-rows: as specified, but with relative lengths converted into absolute lengthsgrid-template-areas: as specifiedAnimation typediscrete Formal syntax none | [ <'grid-template-rows'> / <'grid-template-columns'> ] | [ <line-names>? <string> <track-size>? <line-names>? ]+ [ / <explicit-track-list> ]?where <line-names> = '[' <custom-ident>* ']'<track-size> = <track-breadth> | minmax( <inflexible-breadth> , <track-breadth> ) | fit-content( [ <length> | <percentage> ] )<explicit-track-list> = [ <line-names>? <track-size> ]+ <line-names>?where <track-breadth> = <length-percentage> | <flex> | min-content | max-content | a...
grid - CSS: Cascading Style Sheets
Web › CSS › grid
their initial value, as normal for shorthands. Also, the gutter properties are NOT reset by this shorthand. ...
...as normal for shorthands. Also, the gutter properties are NOT reset by this shorthand. ...
.../ grid: none; grid: "a" 100px "b" 1fr; grid: [linename1] "a" 100px [linename2]; grid: "a" 200px "b" min-content; grid: "a" minmax(100px, max-content) "b" 20%; grid: 100px / 200px; grid: minmax(400px, min-content) / repeat(auto-fill, 50px); /* <'grid-template-rows'> / [ auto-flow && dense? ] <'grid-auto-columns'>? values */ grid: 200px / auto-flow; grid: 30% / auto-flow dense; grid: repeat(3, [line1 line2 line3] 200px) / auto-flow 300px; grid: [line1] minmax(20em, max-content) / auto-flow dense 40%; /* [ auto-flow && dense? ] <'grid-auto-rows'>? ...
... dense? ] <'grid-auto-columns'>? values */ grid: 200px / auto-flow; grid: 30% / auto-flow dense; grid: repeat(3, [line1 line2 line3] 200px) / auto-flow 300px; grid: [line1] minmax(20em, max-content) / auto-flow dense 40%; /* [ auto-flow && dense? ] <'grid-auto-rows'>? / <'grid-template-columns'> values */ grid: auto-flow / 200px; grid: auto-flow dense / 30%; grid: auto-flow 300px / repeat(3, [line1 line2 line3] 200px); grid: auto-flow dense 40% / [line1] minmax(20em, max-content); /* Global values */ grid: inherit; grid: initial; grid: unset; Values <'grid-template'> Defines the grid-template including grid-template-columns, grid-template-rows and grid-template-areas. <'grid-template-rows'> / [ auto-flow && dense? ] <'grid-auto-columns'>? Sets up an auto-flow by setting the row tr...
<length> - CSS: Cascading Style Sheets
Web › CSS › length
listed below. As with all CSS dimensions, there is no space between the unit literal and the number. The length unit is optional after the number 0. Note: Some properties allow negative <length>s, while others do not. Units Relative length units Relative lengths represent a measurement in terms of some other distance. Depending on the unit, this can be the size of a specific character, the line height, or the size of the viewport. Font-relative lengths Font-relative lengths define the <length> value in terms of the size of a particular character or font attribute in the font currently in effect in an element or its parent. Note: These units, especially em and rem, are often used to create scalable layouts, which maintain the vertical rhythm of the page even when the user changes the...
...tself, it represents the inherited font-size of the element. ex Represents the x-height of the element's font. On fonts with the "x" letter, this is generally the height of lowercase letters in the font; 1ex ? 0.5em in many fonts. ic Equal to the used advance measure of the "?" (CJK water ideograph, U+6C34) glyph found in the font used to render it. ...
... Equal to the computed value of the line-height property of the element on which it is used, converted to an absolute length. rem Represents the font-size of the root element (typically <html>). When used within the root element font-size, it represents its initial value (a common browser default is 16px, but user-defined preferences may modify this). rlh Equal to the computed value of the line-height property on the root element (typically <html>), converted to an absolute length. When used on the font-size or line-height properties of the root element, it refers to the properties' initial value. Viewport-percentage lengths Viewport-percentage lengths define the <length> value relative to the size of the viewport, i.e., the visible portion of the document. Viewport lengths are inval...
...alue relative to the size of the viewport, i.e., the visible portion of the document. Viewport lengths are invalid in @page declaration blocks. vh Equal to 1% of the height of the viewport's initial containing block. vw Equal to 1% of the width of the viewport's initial containing block. vi Equal to 1% of the size of the initial containing block, in the direction of the root element's inline axis. vb Equal to 1% of the size of the initial containing block, in the direction of the root element's block axis. vmin Equal to the smaller of vw and vh. vmax Equal to the larger of vw and vh. Absolute length units Absolute length units represent a physical measurement when the physical properties of the output medium are known, such as for print layout. This is done by anchoring on...
margin-bottom - CSS: Cascading Style Sheets
n the bottom of an element. A positive value places it farther from its neighbors, while a negative value places it closer. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. This property has no effect on non-replaced inline elements, such as <span> or <code>. Syntax /* <length> values */ margin-bottom: 10px; /* An absolute length */ margin-bottom: 1em; /* relative to the text size */ margin-bottom: 5%; /* relative to the nearest block container's width */ /* Keyword values */ margin-bottom: auto; /* Global values */ margin-bottom: inherit; margin-bottom: initial; margin-bottom: unset; The margin-bottom p...
...n be positive, zero, or negative. Values <length> The size of the margin as a fixed value. <percentage> The size of the margin as a percentage, relative to the width of the containing block. auto The browser selects a suitable value to use. See margin. ...
... size of the margin as a fixed value. <percentage> The size of the margin as a percentage, relative to the width of the containing block. auto The browser selects a suitable value to use. See margin. Formal definition Initial value0Applies toall elements, except elements with table display types other than table-caption, table and inline-table. ...
... CSS Level 1The definition of 'margin-bottom' in that specification. Recommendation Initial definition ...
margin-top - CSS: Cascading Style Sheets
rea on the top of an element. A positive value places it farther from its neighbors, while a negative value places it closer. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. This property has no effect on non-replaced inline elements, such as <span> or <code>. Syntax /* <length> values */ margin-top: 10px; /* An absolute length */ margin-top: 1em; /* relative to the text size */ margin-top: 5%; /* relative to the nearest block container's width */ /* Keyword values */ margin-top: auto; /* Global values */ margin-top: inherit; margin-top: initial; margin-top: unset; The margin-top property is specified as ...
...n be positive, zero, or negative. Values <length> The size of the margin as a fixed value. <percentage> The size of the margin as a percentage, relative to the width of the containing block. auto The browser selects a suitable value to use. See margin. ...
... size of the margin as a fixed value. <percentage> The size of the margin as a percentage, relative to the width of the containing block. auto The browser selects a suitable value to use. See margin. Formal definition Initial value0Applies toall elements, except elements with table display types other than table-caption, table and inline-table. ...
... CSS Level 1The definition of 'margin-top' in that specification. Recommendation Initial definition ...
repeating-conic-gradient() - CSS: Cascading Style Sheets
ve example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Syntax /* Starburst: A a blue on blue starburst: the gradient is a starburst of lighter and darker blue, centered in the upper left quandrant, offset by 3degrees so there is no up/down straight line */ background: repeating-conic-gradient( from 3deg at 25% 25%, hsl(200, 100%, 50%) 0deg 15deg, hsl(200, 100%, 60%) 10deg 30deg); ); Values <angle> Preceded by the from keyterm, and taking an angle as its value, defines the gradient rotation in clockwise direction. <position> Using the same length, order and keyterm values as the background-position property, the position define...
... color stops. Like in non-repeating gradients, the first and last color stops are assumed to be 0 and either 100% or 360deg if not explicitly declared. When defaulting to these values, the repeating arc is 360 degrees, and therefore doesn't repeat. Like the non-repeating conic gradient, the color-stops are placed around a gradient arc -- the circumference of a circle, rather than on the gradient line emerging from the center of the gradient. The colors transition as as if spun around the center of a circle, starting at the top if no from <angle> is declared, and going clockwise for the the size of the angle that is the different between the largest and smallest color angle, then repeating. A repeating conic gradient is specified by indicating a rotation angle, the center of the gradient, and...
...e color stop to the color at the subsequent color stop, with the midpoint between the colors being the half way point between the color transition. You can move this color transition midpoint to any point between two color stops by adding a color hint, indicating where the middle of the color transition should be. If two or more color stops are at the same location, the transition will be a hard line between the first and last colors declared at that location. While you can mix and match different angle units, don't. It makes CSS hard to read. Accessibility concerns Browsers do not provide any special information on background images to assistive technology. This is important primarily for screen readers, as a screen reader will not announce its presence and therefore convey nothing to its...
... checkerboards, and other effects with conic gradients, CSS images provide no native way to assign alternative text, and therefore the image represented by the conic gradient will not be accessible to screen reader users. If the image contains information critical to understanding the page's overall purpose, it is better to describe it semantically in the document. MDN Understanding WCAG, Guideline 1.1 explanations Understanding Success Criterion 1.1.1 | W3C Understanding WCAG 2.0 Examples Black and white starburst div { width: 200px; height: 200px; } <div></div> div { background-image: repeating-conic-gradient(#fff 0 9deg, #000 9deg 18deg); } Off-centered gradient This gradient repeats 18 times, but since we only see the right half, we only see 9 repeats. div...
repeating-radial-gradient() - CSS: Cascading Style Sheets
The function's result is an object of the <gradient> data type, which is a special kind of <image>. ...
... have already dropped those older variants. <color-stop> A color-stop's <color> value, followed by an optional stop position (either a <percentage> or a <length> along the gradient's axis). A percentage of 0%, or a length of 0, represents the center of the gradient; the value 100% represents the intersection of the ending shape with the virtual gradient ray. Percentage values in between are linearly positioned on the virtual gradient ray. Formal syntax repeating-radial-gradient( [[ circle || <length> ] [at <position>]? , | [ ellipse || [<length> | <percentage> ]{2}] [at <position>]? , | [[ circle | ellipse ] || <extent-keyword> ] [at <position>]? , | at <position> , <color-stop-list> ...
... and <color-stop-length> = [ <percentage> | <length> ]{1,2} and <color-hint> = [ <percentage> | <length> ] Examples Black and white gradient <div class="radial-gradient"></div> .radial-gradient { width: 120px; height: 120px; } .radial-gradient { background: re...
... at <position> , <color-stop-list> ) \---------------------------------------------------------------/\-----------------/ Contour, size and position of the ending shape List of color stops where <extent-keyword> = closest-corner | closest-side | farthest-corner | farthest-side and <color-stop-list> = [ <linear-color-stop> [, <color-hint>? ]? ]#, <linear-color-stop> and <linear-color-stop> = <color> [ <color-stop-length> ]? and <color-stop-length> = [ <percentage> | <length> ]{1,2} and <color-hint> = [ <percentage> | <length> ] Examples Black and white gradient <div class="radial-gradient"></div> .radial-gradient { width: 120px; height: 120px; } .radial-gradient { background: repeating-radial-gradient(black, black 5px, wh...
<string> - CSS: Cascading Style Sheets
Web › CSS › string
represents a double quote, \27 a single quote ('), and \A9 the copyright symbol ((C)). Importantly, certain characters which would otherwise be invalid can be escaped with a backslash. These include double quotes when used inside a double-quoted string, single quotes when used inside a single-quoted string, and the backslash itself. For example, \\ will create a single backslash. To output new lines, you must escape them with a line feed character such as \A or \00000A. In your code, however, strings can span multiple lines, in which case each new line must be escaped with a \ as the last character of the line. However, to get new lines, you must also set the white-space property to appropriate value. Note: HTML entities (such as &nbsp; or &#8212;) cannot be used in a CSS <string>. Exa...
... Candidate Recommendation ...
... Candidate Recommendation No significant change from CSS Level 2 (...
... Candidate Recommendation No significant change from CSS Level 2 (Revision 1). CSS Level 2 (Revision...
text-align-last - CSS: Cascading Style Sheets
The text-align-last CSS property sets how the last line of a block or a line, right before a forced line break, is aligned. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...ne https://github.com/mdn/interactive-examples and send us a pull request. ...
...ign-last: unset; Values auto The affected line is aligned per the value of text-align, unless text-align is justify, in which case the effect is the same as setting text-align-last to start. start The same as left if direction is left-to-right and right if direction is right-to-left. end The same as right if direction is left-to-right and left if direction is right-to-left. left The inline contents are aligned to the left edge of the line box. right The inline contents are aligned to the right edge of the line box. center The inline contents are centered within the line box. justify The text is justified. Text should line up their left and right edges to the left and right content edges of the paragraph. Formal definition Initial valueautoApplies toblock containersInherite...
...Suspendisse in libero risus, in interdum massa. Vestibulum ac leo vitae metus faucibus gravida ac in neque. ...
text-align - CSS: Cascading Style Sheets
ight, center, justify, justify-all, or match-parent. Using a <string> value only, in which case the other value defaults to right. Using both a keyword value and a <string> value. Values start The same as left if direction is left-to-right and right if direction is right-to-left. end The same as right if direction is left-to-right and left if direction is right-to-left. left The inline contents are aligned to the left edge of the line box. right The inline contents are aligned to the right edge of the line box. center The inline contents are centered within the line box. justify The inline contents are justified. Text should be spaced to line up its left and right edges to the left and right edges of the line box, except for the last line. justify-all Same as justify,...
... match-parent Similar to inherit, but the values start and end are calculated according to the parent's direction and are replaced by the appropriate left or right value. <string> When applied to a table cell, specifies the alignment character around which the cell's contents will align. ...
...to the parent's direction and are replaced by the appropriate left or right value. <string> When applied to a table cell, specifies the alignment character around which the cell's contents will align. Accessibility concerns The inconsistent spacing between words created by justified text can be problematic for people with cognitive concerns such as Dyslexia. ...
...s="example"> Integer elementum massa at nulla placerat varius. Suspendisse in libero risus, in interdum massa. Vestibulum ac leo vitae metus faucibus gravida ac in neque. Nullam est eros, suscipit sed dictum quis, accumsan a ligula. </p> CSS .example { text-align: justify; border: solid; } Result Notes The standard-compatible way to center a block itself without centering its inline content is setting the left and right margin to auto, e.g.: .something { margin: auto; } .something { margin: 0 auto; } .something { margin-left: auto; margin-right: auto; } Specifications Specification Status Comment CSS Logical Properties and Values Level 1The definition of 'text-align' in that specification. Editor's Draft No changes C...
text-overflow - CSS: Cascading Style Sheets
clone https://github.com/mdn/interactive-examples and send us a pull request. The text-overflow property doesn't force an overflow to occur. To make text overflow its container you have to set other CSS properties: overflow and white-space. For example: overflow: hidden; white-space: nowrap; The text-overflow property only affects content that is overflowing a block container element in its inline progression direction (not text overflowing at the bottom of a box, for example). Syntax The text-overflow property may be specified using one or two values. If one value is given, it specifies overflow behavior for the end of the line (the right end for left-to-right text, the left end for right-to-left text). If two values are given, the first specifies overflow behavior for the left end of t...
...ogression direction (not text overflowing at the bottom of a box, for example). Syntax The text-overflow property may be specified using one or two values. If one value is given, it specifies overflow behavior for the end of the line (the right end for left-to-right text, the left end for right-to-left text). If two values are given, the first specifies overflow behavior for the left end of the line, and the second specifies it for the right end of the line. Each value is specified as one of: one of the keyword values: clip, ellipsis, fade the function fade(), which is passed a <length> or a <percentage> to control the fade distance a <string>. Values clip The default for this property. This keyword value will truncate the text at the limit of the content area, therefore the trun...
...content area, decreasing the amount of text displayed. If there is not enough space to display the ellipsis, it is clipped. <string> The <string> to be used to represent clipped text. The string is displayed inside the content area, shortening the size of the displayed text. If there is not enough space to display the string itself, it is clipped. fade This keyword clips the overflowing inline content and applies a fade-out effect near the edge of the line box with complete transparency at the edge. fade( <length> | <percentage> ) This function clips the overflowing inline content and applies a fade-out effect near the edge of the line box with complete transparency at the edge. The argument determines the distance over which the fade effect is applied. The <percentage> is resolve...
...-out effect near the edge of the line box with complete transparency at the edge. fade( <length> | <percentage> ) This function clips the overflowing inline content and applies a fade-out effect near the edge of the line box with complete transparency at the edge. The argument determines the distance over which the fade effect is applied. The <percentage> is resolved against the width of the line box. Values lower than 0 are clipped to 0. Values greater than the width of the line box are clipped to the width of the line box. Formal definition Initial valueclipApplies toblock container elementsInheritednoComputed valueas specifiedAnimation typediscrete Formal syntax [ clip | ellipsis | <string> ]{1,2} Examples CSS p { width: 200px; border: 1px solid; padding: 2px 5px; /* ...
<transform-function> - CSS: Cascading Style Sheets
ny element. Positive coordinates are down and to the right of the origin, while negative ones are up and to the left. Thus, a point that's 2 units to the right and 5 units down would be (2, 5), while a point 3 units to the left and 12 units up would be (-3, -12). Transformation functions Transformation functions alter the appearance of an element by manipulating the values of its coordinates. A linear transformation function is described using a 2x2 matrix, like this: ac bd The function is applied to an element by using matrix multiplication. Thus, each coordinate changes based on the values in the matrix: ac bd xy = ax+cy bx+dy It is even possible to apply several transformations in a row: a1 c1 b1 d1 a2 c2 b2 d2 = a1 a2 + c1 b2 a1 c2 + c1...
...rix: ac bd xy = ax+cy bx+dy It is even possible to apply several transformations in a row: a1 c1 b1 d1 a2 c2 b2 d2 = a1 a2 + c1 b2 a1 c2 + c1 d2 b1 a2 + d1 b2 b1 c2 + d1 d2 With this notation, it is possible to describe, and therefore compose, most common transformations: rotations, scaling, or skewing. (In fact, all transformations that are linear functions can be described.) Composite transformations are effectively applied in order from right to left. However, one major transformation is not linear, and therefore must be special-cased when using this notation: translation. The translation vector (tx, ty) must be expressed separately, as two additional parameters. Note: Though trickier than Cartesian coordinates, homogeneous coordina...
... Examples Transform function comparison The following example provides a 3D cube created from DOM elements and transforms, and a select menu allowing you to choose different transform functions to transform the cube with, so you can compare the effects of the different types. ...
...n>translateY(100px)</option> <option>translateZ(100px)</option> <option>translate3d(50px, 50px, 50px)</option> <option>perspective(200px)</option> <option>matrix(1, 2, -1, 1, 80, 80)</option> <option>matrix3d(1,0,0,0,0,1,3,0,0,0,1,0,50,100,0,1.1)</option> </select> </div> </main> CSS main { width: 400px; height: 200px; padding: 50px; background-image: linear-gradient(135deg, white, cyan, white); } #example-element { width: 100px; height: 100px; transform-style: preserve-3d; transition: transform 1.5s; transform: rotate3d(1, 1, 1, 30deg); } .face { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; position: absolute; backface-visibility: inherit; font-size: 60px; color: #fff; } .fr...
unicode-bidi - CSS: Cascading Style Sheets
/* Keyword values */ unicode-bidi: normal; unicode-bidi: embed; unicode-bidi: isolate; unicode-bidi: bidi-override; unicode-bidi: isolate-override; unicode-bidi: plaintext; /* Global values */ unicode-bidi: inherit; unicode-bidi: initial; unicode-bidi: unset; Syntax Values normal The element does not offer an additional level of embedding with respect to the bidirectional algorithm. ...
...-bidi: bidi-override; unicode-bidi: isolate-override; unicode-bidi: plaintext; /* Global values */ unicode-bidi: inherit; unicode-bidi: initial; unicode-bidi: unset; Syntax Values normal The element does not offer an additional level of embedding with respect to the bidirectional algorithm. For inline elements, implicit reordering works across element boundaries. embed If the element is inline, this value opens an additional level of embedding with respect to the bidirectional algorithm. The direction of this embedding level is given by the direction property. bidi-override For inline elements this creates an override. For block container elements this creates an override for inline-level descendants not within another block container element. This means that inside the element, reor...
...s parent bidirectional state or the value of the direction property. The directionality is calculated using the P2 and P3 rules of the Unicode Bidirectional Algorithm. This value allows the display of data that is already formatted using a tool following the Unicode Bidirectional Algorithm. ...
...ectional Algorithm. Formal definition Initial valuenormalApplies toall elements, though some values have no effect on non-inline elementsInheritednoComputed valueas specifiedAnimation typediscrete Formal syntax normal | embed | isolate | bidi-override | isolate-override | plaintext Examples CSS .bible-quote { direction: rtl; unicode-bidi: embed; } HTML <div class="bible-quote"> A line of text </div> <div> Another line of text </div> Result Specifications Specification Status Comment CSS Writing Modes Module Level 3The definition of 'unicode-bidi' in that specification. Proposed Recommendation Added plaintext, isolate, and isolate-override keywords. CSS Level 2 (Revision 1)The definition of 'unicode-bidi' in that specification.
Challenge solutions - Developer guides
nu above the right-hand pane, choose CSS Rules. You see two items listed, one that references an internal resource and one that references your stylesheet file. The internal resource defines the font-weight property as bolder; your stylesheet defines the color property as red. Cascading and inheritance Inherited styles Challenge Change your stylesheet so that only the red letters are underlined. Solution Move the declaration for underlining from the rule for <p> to the one for <strong>. The resulting file looks like this: p {color: blue; } strong {color: orange; text-decoration: underline;} Later sections of this tutorial describe style rules and declarations in greater detail. Selectors Second paragraph blue Challenge Without changing your HTML file, add a single rule to...
...ues are reasonable approximations of the named colors: strong { color: #f00; /* red */ background-color: #ddf; /* pale blue */ font: 200% serif; } .carrot { color: #fa0; /* orange */ } .spinach { color: #080; /* dark green */ } p { color: #00f; /* blue */ } Content Add an image Challenge Add a one rule to your stylesheet so that it displays the image at the start of each line. Solution Add this rule to your stylesheet: p:before{ content: url("yellow-pin.png"); } Lists Lower Roman numerals Challenge Add a rule to your stylesheet, to number the oceans using Roman numerals from i to v. Solution Define a rule for list items to use the lower-roman list style: li { list-style: lower-roman; } Capital letters Challenge Change your stylesheet to id...
... only the data cells. Solution The following rule puts borders around only <td> elements that are inside the <tbody> element of the table with id=demo-table: #demo-table tbody td { border:1px solid #7a7; } Media Separate print style file Challenge Move the print-specific style rules to a separate CSS file and import them into your style4.css stylesheet. Solution Cut and paste the lines between /* print only */ and /* end print only */ into a file named style4_print.css. In style4.css, add the following line at the beginning of the file: @import url("style4_print.css") print; Heading hover color Challenge Make the headings turn blue when the mouse pointer is over them. Solution The following rule achieves the desired result: h1:hover { color: blue; } JavaScr...
...yle4_print.css") print; Heading hover color Challenge Make the headings turn blue when the mouse pointer is over them. Solution The following rule achieves the desired result: h1:hover { color: blue; } JavaScript Move box to the right Challenge Change the script so that the square jumps to the right by 20 em when its color changes, and jumps back afterwards. Solution Add lines to modify the margin-left property. Be sure to specify it as marginLeft in JavaScript. The following script achieves the desired result: // JavaScript demonstration function doDemo (button) { var square = document.getElementById("square"); square.style.backgroundColor = "#fa4"; square.style.marginLeft = "20em"; button.setAttribute("disabled", "true"); setTimeout(clearDemo, 2000, butto...
Rich-Text Editing in Mozilla - Developer guides
ndividual elements of a document editable. Executing Commands When an HTML document has been switched to designMode, the document object exposes the document.execCommand method which allows one to run commands to manipulate the contents of the editable region. Most commands affect the document's selection (bold, italics, etc), while others insert new elements (adding a link) or affect an entire line (indenting). When using contentEditable, calling execCommand will affect the currently active editable element. Internet Explorer Differences One major difference between Mozilla and Internet Explorer that affects designMode is the generated code in the editable document: while Internet Explorer uses HTML tags (em, i, etc), Mozilla 1.3 will generate by default spans with inline style rules. The...
... document: while Internet Explorer uses HTML tags (em, i, etc), Mozilla 1.3 will generate by default spans with inline style rules. The styleWithCSS command can be used to toggle between CSS and HTML markup creation. Figure 1 : Generated HTML differences Mozilla: <span style="font-weight: bold;">I love geckos.</span> <span style="font-weight: bold; font-style: italic; text-decoration: underline;">Dinosaurs are big.</span> Internet Explorer: <STRONG>I love geckos.</STRONG> <STRONG><EM><U>Dinosaurs are big.</U></EM></STRONG> Another difference between Mozilla and IE is how to access the document object of an iframe, which is usually used in conjunction with designMode. Mozilla uses the W3C standard way, namely IFrameElement.contentDocument, while IE requires IFrameElement.document. ...
...e current document's designMode. For it to work in Internet Explorer, the contentEditable attribute of the body tag needs to be set to "true". Figure 2 : First example HTML: <body contentEditable="true" onload="load()"> JavaScript: function load(){ window.document.designMode = "On"; } Example 2 The second example is a simple rich text editing page, where text can be bolded/italicized/underlined, new links can be added and the color of text changed. The example page consists of an iframe, which will be the rich editing area, as well as elements for basic editing commands such as bold/italics/text color. Figure 3 : Setting up rich-text editing HTML: <body onload="load()"> JavaScript: function load(){ getIFrameDocument("editorWindow").designMode = "On"; } function getIFrameDocument(...
...atDoc('bold');" src="data:image/gif;base64,R0lGODlhFgAWAID/AMDAwAAAACH5BAEAAAAALAAAAAAWABYAQAInhI+pa+H9mJy0LhdgtrxzDG5WGFVk6aXqyk6Y9kXvKKNuLbb6zgMFADs=" /> <img class="intLink" title="Italic" onclick="formatDoc('italic');" src="data:image/gif;base64,R0lGODlhFgAWAKEDAAAAAF9vj5WIbf///yH5BAEAAAMALAAAAAAWABYAAAIjnI+py+0Po5x0gXvruEKHrF2BB1YiCWgbMFIYpsbyTNd2UwAAOw==" /> <img class="intLink" title="Underline" onclick="formatDoc('underline');" src="data:image/gif;base64,R0lGODlhFgAWAKECAAAAAF9vj////////yH5BAEAAAIALAAAAAAWABYAAAIrlI+py+0Po5zUgAsEzvEeL4Ea15EiJJ5PSqJmuwKBEKgxVuXWtun+DwxCCgA7" /> <img class="intLink" title="Left align" onclick="formatDoc('justifyleft');" src="data:image/gif;base64,R0lGODlhFgAWAID/AMDAwAAAACH5BAEAAAAALAAAAAAWABYAQAIghI+py+0Po5y02ouz3jL4D4JMGELkGYxo+qzl4nKyXAAAOw==" /> <img...
<a>: The Anchor element - HTML: Hypertext Markup Language
Web › HTML › Element › a
ggests it as the filename. / and \ characters are converted to underscores (_). Filesystems may forbid other characters in filenames, so browsers will adjust the suggested name if necessary. Notes: download only works for same-origin URLs, or the blob: and data: schemes. If Content-Disposition has a different filename than download, the header takes priority. (If Content-Disposition: inline, Firefox prefers the header while Chrome prefers download.) href The URL that the hyperlink points to. Links are not restricted to HTTP-based URLs -- they can use any URL scheme supported by browsers: Sections of a page with fragment URLs Pieces of media files with media fragments Telephone numbers with tel: URLs Email addresses with mailto: URLs While web browsers may not ...
...te a link with a download attribute and the canvas data as a data: URL: Example painting app with save link HTML <p>Paint by holding down the mouse button and moving it. ...
...Usually, CSS hides a skip link offscreen until focused. <body> <a href="#content">Skip to main content</a> <header> ...
...ntent repeated throughout multiple pages, such as header navigation. Skip links are especially useful for people who navigate with the aid of assistive technology such as switch control, voice command, or mouth sticks/head wands, where the act of moving through repetitive links can be laborious. WebAIM: "Skip Navigation" Links How-to: Use Skip Navigation links MDN / Understanding WCAG, Guideline 2.4 explanations Understanding Success Criterion 2.4.1 Size and proximity Size Interactive elements, like links, should provide an area large enough that it is easy to activate them. This helps a variety of people, including those with motor control issues and those using imprecise inputs such as a touchscreen. A minimum size of 44x44 CSS pixels is recommended. Text-only links in prose cont...
<img>: The Image Embed element - HTML: Hypertext Markup Language
Web › HTML › Element › img
nnot use this attribute if the <img> element is inside an <a> or <button> element. Deprecated attributes align Aligns the image with its surrounding context. Use the float and/or vertical-align CSS properties instead of this attribute. Allowed values: top Equivalent to vertical-align: top or vertical-align: text-top middle Equivalent to vertical-align: -moz-middle-with-baseline bottom The default, equivalent to vertical-align: unset or vertical-align: initial left Equivalent to float: left right Equivalent to float: right border The width of a border around the image. Use the border CSS property instead. hspace The number of pixels of white space on the left and right of the image. Use the margin CSS property instead. longdesc A link to a mor...
...e WHATWG's HTML Living Standard. It has an uncertain future; authors should use a WAI-ARIA alternative such as aria-describedby or aria-details. name A name for the element. Use the id attribute instead. vspace The number of pixels of white space above and below the image. Use the margin CSS property instead. Styling with CSS <img> is a replaced element; it has a display value of inline by default, but its default dimensions are defined by the embedded image's intrinsic values, like it were inline-block. You can set properties like border/border-radius, padding/margin, width, height, etc. on an image. <img> has no baseline, so when images are used in an inline formatting context with vertical-align: baseline, the bottom of the image will be placed on the text baseline. You can...
...alt attribute is not present on an image, some screen readers may announce the image's file name instead. This can be a confusing experience if the file name isn't representative of the image's contents. An alt Decision Tree o Images o WAI Web Accessibility Tutorials Alt-texts: The Ultimate Guide -- Axess Lab How to Design Great Alt Text: An Introduction | Deque MDN Understanding WCAG, Guideline 1.1 explanations Understanding Success Criterion 1.1.1 | W3C Understanding WCAG 2.0 The title attribute The title attribute is not an acceptable substitute for the alt attribute. Additionally, avoid duplicating the alt attribute's value in a title attribute declared on the same image. Doing so may cause some screen readers to announce the description twice, creating a confusing experience. T...
...e value of the title attribute is usually presented to the user as a tooltip, which appears shortly after the cursor stops moving over the image. While this can provide additional information to the user, you should not assume that the user will ever see it: the user may only have keyboard or touchscreen. If you have information that's particularly important or valuable for the user, present it inline using one of the methods mentioned above instead of using title. Using the HTML title attribute - updated | The Paciello Group Technical summary Content categories Flow content, phrasing content, embedded content, palpable content. If the element has a usemap attribute, it also is a part of the interactive content category. Permitted content None, it is an empty elem...
<input type="image"> - HTML: Hypertext Markup Language
Web › HTML › Element › input › image
lements. formtarget A string which specifies a name or keyword that indicates where to display the response received after submitting the form. The string must be the name of a browsing context (that is, a tab, window, or <iframe>. A value specified here overrides any target given by the target attribute on the <form> that owns this input. In addition to the actual names of tabs, windows, or inline frames, there are a few special keywords that can be used: _self Loads the response into the same browsing context as the one that contains the form. This will replace the current document with the received data. This is the default value used if none is specified. _blank Loads the response into a new, unnamed, browsing context. This is typically a new tab in the same window as the current ...
...5 A Boolean attribute specifying that the form is not to be validated when it is submitted. If this attribute is specified, it overrides the novalidate attribute of the element's form owner. formtarget HTML5 A name or keyword indicating where to display the response that is received after submitting the form. This is a name of, or keyword for, a browsing context (for example, tab, window, or inline frame). If this attribute is specified, it overrides the target attribute of the element's form owner. The following keywords have special meanings: _self: Load the response into the same browsing context as the current one. This value is the default if the attribute is not specified. _blank: Load the response into a new unnamed browsing context. _parent: Load the response into the parent...
... HTML <form> <p>Login to your account</p> <div> <label for="userId">User ID</label> <input typ...
..."userId" name="userId"> </div> <div> <label for="pwd">Password</label> <input type="password" id="pwd" name="pwd"> </div> <div> <input id="image" type="image" src="/static/external/62/62ac2ecddbec0e0b540098c28451e57203e5cab46dfed7ab0115d5a659fcfb7b.png" alt="Login" width="200" height="100"> </div> </form> CSS div { margin-bottom: 10px; } label { display: inline-block; width: 70px; text-align: right; padding-right: 10px; } #image { object-position: right top; object-fit: contain; background-color: #ddd; } Here, object-position is configured to draw the image at the top-right corner of the element, while object-fit is set to contain, which indicates that the image should be drawn at the largest size that will fit within the element's box wi...
<p>: The Paragraph element - HTML: Hypertext Markup Language
Web › HTML › Element › p
Paragraphs are block-level elements, and notably will automatically close if another block-level element is parsed before the closing </p> tag. See "Tag omission" below. The source for this interactive example is stored in a GitHub repository. ...
...ample HTML <p>This is the first paragraph of text. This is the first paragraph of text. This is the first paragraph of text. This is the first paragraph of text.</p> <p>This is the second paragraph. This is the second paragraph. This is the second paragraph. This is the second paragraph.</p> Result Styling paragraphs By default, browsers separate paragraphs with a single blank line. Alternate separation methods, such as first-line indentation, can be achieved with CSS: HTML <p>Separating paragraphs with blank lines is easiest for readers to scan, but they can also be separated by indenting their first lines. This is often used to take up less space, such as to save paper in print.</p> <p>Writing that is intended to be edited, such as school papers and rough drafts, uses ...
...In finished works, combining both is considered redundant and amateurish.</p> <p>In very old writing, paragraphs were separated with a special character: ?, the <i>pilcrow</i>. ...
...eurish.</p> <p>In very old writing, paragraphs were separated with a special character: ?, the <i>pilcrow</i>. ...
<script>: The Script element - HTML: Hypertext Markup Language
Web › HTML › Element › script
ts. defer This Boolean attribute is set to indicate to a browser that the script is meant to be executed after the document has been parsed, but before firing DOMContentLoaded. Scripts with the defer attribute will prevent the DOMContentLoaded event from firing until the script has loaded and finished evaluating. This attribute must not be used if the src attribute is absent (i.e. for inline scripts), in this case it would have no effect. The defer attribute has no effect on module scripts -- they defer by default. Scripts with the defer attribute will execute in the order in which they appear in the document. This attribute allows the elimination of parser-blocking JavaScript where the browser would have to load and evaluate scripts before continuing to parse. async has a si...
...ute has no effect on module scripts -- they defer by default. Scripts with the defer attribute will execute in the order in which they appear in the document. This attribute allows the elimination of parser-blocking JavaScript where the browser would have to load and evaluate scripts before continuing to parse. async has a similar effect in this case. integrity This attribute contains inline metadata that a user agent can use to verify that a fetched resource has been delivered free of unexpected manipulation. See Subresource Integrity. nomodule This Boolean attribute is set to indicate that the script should not be executed in browsers that support ES2015 modules -- in effect, this can be used to serve fallback scripts to older browsers that do not support modular JavaScript code.
...t use UTF-8, and the script element inherits its character encoding from the document. language Like the type attribute, this attribute identifies the scripting language in use. Unlike the type attribute, however, this attribute's possible values were never standardized. The type attribute should be used instead. Notes Scripts without async , defer or type="module" attributes, as well as inline scripts, are fetched and executed immediately, before the browser continues to parse the page. The script should be served with the text/javascript MIME type, but browsers are lenient and only block them if the script is served with an image type (image/*); a video type (video/*); an audio (audio/*) type; or text/csv. If the script is blocked, an error is sent to the element, if not a load event...
...f the script is served with an image type (image/*); a video type (video/*); an audio (audio/*) type; or text/csv. If the script is blocked, an error is sent to the element, if not a load event is sent. 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. <script> alert("Hello World!"); </script> Module fallback Browsers that support the module value for the type attribute ignore any script with a nomodule attribute. That enables you to use module scripts while also providing nomodule-marked fallback scripts for non-supporting browsers. <script type="module" src="main.js"></script> <script nomodule src="f...
<select>: The HTML Select element - HTML: Hypertext Markup Language
Web › HTML › Element › select
associate <select> elements to <form>s anywhere in the document, not just inside a <form>. It can also override an ancestor <form> element. multiple This Boolean attribute indicates that multiple options can be selected in the list. If it is not specified, then only one option can be selected at a time. When multiple is specified, most browsers will show a scrolling list box instead of a single line dropdown. name This attribute is used to specify the name of the control. required A Boolean attribute indicating that an option with a non-empty string value must be selected. size If the control is presented as a scrolling list box (e.g. when multiple is specified), this attribute represents the number of rows in the list that should be visible at one time. Browsers are not required to ...
...r keys to increase or decrease the range of items selected. Keyboard users can select multiple non-contiguous items by: Focusing on the <select> element (e.g. using Tab). Holding down the Ctrl key then using the Up and Down cursor keys to change the "focused" select option, i.e. the one that will be selected if you choose to do so. The "focused" select option is highlighted with a dotted outline, in the same way as a keyboard-focused link. Pressing Space to select/deselect "focused" select options. Styling with CSS The <select> element is notoriously difficult to style productively with CSS. You can affect certain aspects like any element -- for example, manipulating the box model, the displayed font, etc., and you can use the appearance property to remove the default system appearan...
...g with CSS The <select> element is notoriously difficult to style productively with CSS. You can affect certain aspects like any element -- for example, manipulating the box model, the displayed font, etc., and you can use the appearance property to remove the default system appearance. However, these properties don't produce a consistent result across browsers, and it is hard to do things like line different types of form element up with one another in a column. The <select> element's internal structure is complex, and hard to control. If you want to get full control, you should consider using a library with good facilities for styling form widgets, or try rolling your own dropdown menu using non-semantic elements, JavaScript, and WAI-ARIA to provide semantics. For more useful information ...
..."hamster" disabled>Hamster</option> </optgroup> <optgroup label="Flying pets"> <option value="parrot">Parrot</option> <option value="macaw">Macaw</option> <option value="albatross">Albatross</option> </optgroup> </select> </label> You'll see that: Multiple options are selectable because we've included the multiple attribute. The size attribute causes only 4 lines to display at a time; you can scroll to view all the options. We've included <optgroup> elements to divide the options up into different groups. This is a purely visual grouping, its visualization generally consists of the group name being bolded, and the options being indented. The "Hamster" option includes a disabled attribute and therefore can't be selected at all. Technical summary ...
Data URLs - HTTP
They were formerly known as "data URIs" until that name was retired by the WHATWG. Note: Data URLs are treated as unique opaque origins by modern browsers, rather than inheriting the origin of the settings object responsible for the navigation. Syntax Data URLs are composed of four parts: a prefix (data:), a MIME type indicating the type of data, an optional base64 token if non-textual, and the data itself: data:[<mediatype>][;base64],<data> The mediatype is a MIME type string, such as 'image/jpeg' for a JPEG image file. ...
...ed on the enclosing document's type). Otherwise, you can specify base64 to embed base64-encoded binary data. You can find more info on MIME types here and here. A few examples: data:,Hello%2C%20World! Simple text/plain data. Note the use of percent-encoding (URL-encoding) for the quote and space characters. Also, for CSV data (MIME type "text/csv"), percent-encoding is needed to preserve the line endings that delimit rows of the spreadsheet. data:text/plain;base64,SGVsbG8sIFdvcmxkIQ== base64-encoded version of the above data:text/html,%3Ch1%3EHello%2C%20World!%3C%2Fh1%3E An HTML document with <h1>Hello, World!</h1> data:text/html,<script>alert('hi');</script> An HTML document that executes a JavaScript alert. Note that the closing script tag is required. Encoding data into base64 ...
...resentation. By consisting only in ASCII characters, base64 strings are generally url-safe, and that's why they can be used to encode data in Data URLs. Encoding in Javascript The Web APIs have native methods to encode or decode to base64: Base64 encoding and decoding. Encoding on a Unix system Base64 encoding of a file or string on Linux and Mac OS X systems can be achieved using the command-line base64 (or, as an alternative, the uuencode utility with -m argument). echo -n hello|base64 # outputs to console: aGVsbG8= echo -n hello>a.txt base64 a.txt # outputs to console: aGVsbG8= base64 a.txt>b.txt # outputs to file b.txt: aGVsbG8= Encoding on Microsoft Windows Encoding on Windows can be done through powershell or some dedicated tool. It can even be done via bash base64 utility (see...
...om">bottom</a>?arg=val Syntax The format for data URLs is very simple, but it's easy to forget to put a comma before the "data" segment, or to incorrectly encode the data into base64 format. Formatting in HTML A data URL provides a file within a file, which can potentially be very wide relative to the width of the enclosing document. As a URL, the data should be formatable with whitespace (linefeed, tab, or spaces), but there are practical issues that arise when using base64 encoding. Length limitations Although Firefox supports data URLs of essentially unlimited length, browsers are not required to support any particular maximum length of data. For example, the Opera 11 browser limited URLs to 65535 characters long which limits data URLs to 65529 characters (65529 characters being th...
Evolution of HTTP - HTTP
building blocks were completed by the end of 1990, and the first servers were already running outside of CERN by early 1991. On August 6th 1991, Tim Berners-Lee's post on the public alt.hypertext newsgroup is now considered as the official start of the World Wide Web as a public project. ...
...he end of 1990, and the first servers were already running outside of CERN by early 1991. On August 6th 1991, Tim Berners-Lee's post on the public alt.hypertext newsgroup is now considered as the official start of the World Wide Web as a public project. The HTTP protocol used in those early phases was very simple, later dubbed HTTP/0.9, and sometimes as the one-line protocol. HTTP/0.9 - The one-line protocol The initial version of HTTP had no version number; it has been later called 0.9 to differentiate it from the later versions. HTTP/0.9 is extremely simple: requests consist of a single line and start with the only possible method GET followed by the path to the resource (not the URL as both the protocol, server, and port are unnecessary once connected to the server). GET /mypage.html T...
...nts. There were no status or error codes: in case of a problem, a specific HTML file was send back with the description of the problem contained in it, for human consumption. ...
...atus or error codes: in case of a problem, a specific HTML file was send back with the description of the problem contained in it, for human consumption. ...
Content Security Policy (CSP) - HTTP
Web › HTTP › CSP
ere it seems to be coming from. CSP makes it possible for server administrators to reduce or eliminate the vectors by which XSS can occur by specifying the domains that the browser should consider to be valid sources of executable scripts. A CSP compatible browser will then only execute scripts loaded in source files received from those allowlisted domains, ignoring all other script (including inline scripts and event-handling HTML attributes). As an ultimate form of protection, sites that want to never allow scripts to be executed can opt to globally disallow script execution. Mitigating packet sniffing attacks In addition to restricting the domains from which content can be loaded, the server can specify which protocols are allowed to be used; for example (and ideally, from a security st...
...s of policy directives, each of which describes the policy for a certain resource type or policy area. Your policy should include a default-src policy directive, which is a fallback for other resource types when they don't have policies of their own (for a complete list, see the description of the default-src directive). A policy needs to include a default-src or script-src directive to prevent inline scripts from running, as well as blocking the use of eval(). A policy needs to include a default-src or style-src directive to restrict inline styles from being applied from a <style> element or a style attribute. There are specific directives for a wide variety of types of items, so that each type can have its own policy, including fonts, frames, images, audio and video media, scripts, and worke...
...t-src userscripts.example.com Here, by default, content is only permitted from the document's origin, with the following exceptions: Images may load from anywhere (note the "*" wildcard). Media is only allowed from media1.com and media2.com (and not from subdomains of those sites). Executable script is only allowed from userscripts.example.com. Example 4 A web site administrator for an online banking site wants to ensure that all its content is loaded using TLS, in order to prevent attackers from eavesdropping on requests. Content-Security-Policy: default-src https://onlinebanking.jumbobank.com The server permits access only to documents being loaded specifically over HTTPS through the single origin onlinebanking.jumbobank.com. Example 5 A web site administrator of a web mail site...
...nt-Security-Policy header is used. document-uri The URI of the document in which the violation occurred. effective-directive The directive whose enforcement caused the violation. original-policy The original policy as specified by the Content-Security-Policy HTTP header. referrer The referrer of the document in which the violation occurred. script-sample The first 40 characters of the inline script, event handler, or style that caused the violation. status-code The HTTP status code of the resource on which the global object was instantiated. violated-directive The name of the policy section that was violated. Sample violation report Let's consider a page located at http://example.com/signup.html. It uses the following policy, disallowing everything but stylesheets from cdn.exa...
CSP: child-src - HTTP
scheme and port number. You must include the single quotes. Some browsers specifically exclude blob and filesystem from source directives. Sites needing to allow these content types can specify them using the Data attribute. 'unsafe-eval' Allows the use of eval() and similar methods for creating code from strings. You must include the single quotes. 'unsafe-hashes' Allows to enable specific inline event handlers. If you only need to allow inline event handlers and not inline <script> elements or javascript: URLs, this is a safer method compared to using the unsafe-inline expression. 'unsafe-inline' Allows the use of inline resources, such as inline <script> elements, javascript: URLs, inline event handlers, and inline <style> elements. You must include the single quotes. 'none' Refers ...
... a safer method compared to using the unsafe-inline expression. 'unsafe-inline' Allows the use of inline resources, such as inline <script> elements, javascript: URLs, inline event handlers, and inline <style> elements. You must include the single quotes. 'none' Refers to the empty set; that is, no URLs match. The single quotes are required. 'nonce-<base64-value>' A whitelist for specific inline scripts using a cryptographic nonce (number used once). The server must generate a unique nonce value each time it transmits a policy. It is critical to provide an unguessable nonce, as bypassing a resource's policy is otherwise trivial. See unsafe inline script for an example. ...
... '<hash-algorithm>-<base64-value>' A sha256, sha384 or sha512 hash of scripts or styles. The use of this source consists of two portions separated by a dash: the encryption algorithm used to create the hash and the base64-encoded hash of the script or style. ...
...A sha256, sha384 or sha512 hash of scripts or styles. The use of this source consists of two portions separated by a dash: the encryption algorithm used to create the hash and the base64-encoded hash of the script or style. When generating the hash, don't include the <script> or <style> tags and note that capitalization and whitespace matter, including leading or trailing whitespace. See unsafe inline script for an example. In CSP 2.0 this applied only to inline scripts. CSP 3.0 allows it in the case of script-src for external scripts. Examples Violation cases Given this CSP header: Content-Security-Policy: child-src https://example.com/ This <iframe> and worker are blocked and won't load: <iframe src="https://not-example.com"></iframe> <script> var blockedWorker = new Worker("data:a...
CSP: connect-src - HTTP
scheme and port number. You must include the single quotes. Some browsers specifically exclude blob and filesystem from source directives. Sites needing to allow these content types can specify them using the Data attribute. 'unsafe-eval' Allows the use of eval() and similar methods for creating code from strings. You must include the single quotes. 'unsafe-hashes' Allows enabling specific inline event handlers. If you only need to allow inline event handlers and not inline <script> elements or javascript: URLs, this is a safer method than using the unsafe-inline expression. 'unsafe-inline' Allows the use of inline resources, such as inline <script> elements, javascript: URLs, inline event handlers, and inline <style> elements. The single quotes are required. 'none' Refers to the empt...
..., this is a safer method than using the unsafe-inline expression. 'unsafe-inline' Allows the use of inline resources, such as inline <script> elements, javascript: URLs, inline event handlers, and inline <style> elements. The single quotes are required. 'none' Refers to the empty set; that is, no URLs match. The single quotes are required. 'nonce-<base64-value>' An allow-list for specific inline scripts using a cryptographic nonce (number used once). The server must generate a unique nonce value each time it transmits a policy. It is critical to provide an unguessable nonce, as bypassing a resource's policy is otherwise trivial. See unsafe inline script for an example. ...
... '<hash-algorithm>-<base64-value>' A sha256, sha384 or sha512 hash of scripts or styles. The use of this source consists of two portions separated by a dash: the encryption algorithm used to create the hash and the base64-encoded hash of the script or style. ...
...A sha256, sha384 or sha512 hash of scripts or styles. The use of this source consists of two portions separated by a dash: the encryption algorithm used to create the hash and the base64-encoded hash of the script or style. When generating the hash, don't include the <script> or <style> tags and note that capitalization and whitespace matter, including leading or trailing whitespace. See unsafe inline script for an example. In CSP 2.0, this applied only to inline scripts. CSP 3.0 allows it in the case of script-src for external scripts. Examples Violation cases Given this CSP header: Content-Security-Policy: connect-src https://example.com/ The following connections are blocked and won't load: <a ping="https://not-example.com"> <script> var xhr = new XMLHttpRequest(); xhr.open('GET...
CSP: font-src - HTTP
scheme and port number. You must include the single quotes. Some browsers specifically exclude blob and filesystem from source directives. Sites needing to allow these content types can specify them using the Data attribute. 'unsafe-eval' Allows the use of eval() and similar methods for creating code from strings. You must include the single quotes. 'unsafe-hashes' Allows to enable specific inline event handlers. If you only need to allow inline event handlers and not inline <script> elements or javascript: URLs, this is a safer method compared to using the unsafe-inline expression. 'unsafe-inline' Allows the use of inline resources, such as inline <script> elements, javascript: URLs, inline event handlers, and inline <style> elements. You must include the single quotes. 'none' Refers ...
... a safer method compared to using the unsafe-inline expression. 'unsafe-inline' Allows the use of inline resources, such as inline <script> elements, javascript: URLs, inline event handlers, and inline <style> elements. You must include the single quotes. 'none' Refers to the empty set; that is, no URLs match. The single quotes are required. 'nonce-<base64-value>' A whitelist for specific inline scripts using a cryptographic nonce (number used once). The server must generate a unique nonce value each time it transmits a policy. It is critical to provide an unguessable nonce, as bypassing a resource's policy is otherwise trivial. See unsafe inline script for an example. ...
... '<hash-algorithm>-<base64-value>' A sha256, sha384 or sha512 hash of scripts or styles. The use of this source consists of two portions separated by a dash: the encryption algorithm used to create the hash and the base64-encoded hash of the script or style. ...
...A sha256, sha384 or sha512 hash of scripts or styles. The use of this source consists of two portions separated by a dash: the encryption algorithm used to create the hash and the base64-encoded hash of the script or style. When generating the hash, don't include the <script> or <style> tags and note that capitalization and whitespace matter, including leading or trailing whitespace. See unsafe inline script for an example. In CSP 2.0 this applied only to inline scripts. CSP 3.0 allows it in the case of script-src for external scripts. Examples Violation cases Given this CSP header: Content-Security-Policy: font-src https://example.com/ The following font resource loading is blocked and won't load: <style> @font-face { font-family: "MyFont"; src: url("https://not-example.com/f...
CSP: frame-src - HTTP
scheme and port number. You must include the single quotes. Some browsers specifically exclude blob and filesystem from source directives. Sites needing to allow these content types can specify them using the Data attribute. 'unsafe-eval' Allows the use of eval() and similar methods for creating code from strings. You must include the single quotes. 'unsafe-hashes' Allows to enable specific inline event handlers. If you only need to allow inline event handlers and not inline <script> elements or javascript: URLs, this is a safer method compared to using the unsafe-inline expression. 'unsafe-inline' Allows the use of inline resources, such as inline <script> elements, javascript: URLs, inline event handlers, and inline <style> elements. You must include the single quotes. 'none' Refers ...
... a safer method compared to using the unsafe-inline expression. 'unsafe-inline' Allows the use of inline resources, such as inline <script> elements, javascript: URLs, inline event handlers, and inline <style> elements. You must include the single quotes. 'none' Refers to the empty set; that is, no URLs match. The single quotes are required. 'nonce-<base64-value>' A whitelist for specific inline scripts using a cryptographic nonce (number used once). The server must generate a unique nonce value each time it transmits a policy. It is critical to provide an unguessable nonce, as bypassing a resource's policy is otherwise trivial. See unsafe inline script for an example. ...
... '<hash-algorithm>-<base64-value>' A sha256, sha384 or sha512 hash of scripts or styles. The use of this source consists of two portions separated by a dash: the encryption algorithm used to create the hash and the base64-encoded hash of the script or style. ...
...A sha256, sha384 or sha512 hash of scripts or styles. The use of this source consists of two portions separated by a dash: the encryption algorithm used to create the hash and the base64-encoded hash of the script or style. When generating the hash, don't include the <script> or <style> tags and note that capitalization and whitespace matter, including leading or trailing whitespace. See unsafe inline script for an example. In CSP 2.0 this applied only to inline scripts. CSP 3.0 allows it in the case of script-src for external scripts. Examples Violation cases Given this CSP header: Content-Security-Policy: frame-src https://example.com/ The following <iframe> is blocked and won't load: <iframe src="https://not-example.com/"></iframe> Specifications Specification Status ...
CSP: manifest-src - HTTP
scheme and port number. You must include the single quotes. Some browsers specifically exclude blob and filesystem from source directives. Sites needing to allow these content types can specify them using the Data attribute. 'unsafe-eval' Allows the use of eval() and similar methods for creating code from strings. You must include the single quotes. 'unsafe-hashes' Allows to enable specific inline event handlers. If you only need to allow inline event handlers and not inline <script> elements or javascript: URLs, this is a safer method compared to using the unsafe-inline expression. 'unsafe-inline' Allows the use of inline resources, such as inline <script> elements, javascript: URLs, inline event handlers, and inline <style> elements. You must include the single quotes. 'none' Refers ...
... a safer method compared to using the unsafe-inline expression. 'unsafe-inline' Allows the use of inline resources, such as inline <script> elements, javascript: URLs, inline event handlers, and inline <style> elements. You must include the single quotes. 'none' Refers to the empty set; that is, no URLs match. The single quotes are required. 'nonce-<base64-value>' A whitelist for specific inline scripts using a cryptographic nonce (number used once). The server must generate a unique nonce value each time it transmits a policy. It is critical to provide an unguessable nonce, as bypassing a resource's policy is otherwise trivial. See unsafe inline script for an example. ...
... '<hash-algorithm>-<base64-value>' A sha256, sha384 or sha512 hash of scripts or styles. The use of this source consists of two portions separated by a dash: the encryption algorithm used to create the hash and the base64-encoded hash of the script or style. ...
...A sha256, sha384 or sha512 hash of scripts or styles. The use of this source consists of two portions separated by a dash: the encryption algorithm used to create the hash and the base64-encoded hash of the script or style. When generating the hash, don't include the <script> or <style> tags and note that capitalization and whitespace matter, including leading or trailing whitespace. See unsafe inline script for an example. In CSP 2.0 this applied only to inline scripts. CSP 3.0 allows it in the case of script-src for external scripts. Examples Violation cases Given this CSP header: Content-Security-Policy: manifest-src https://example.com/ The following <link> is blocked and won't load: <link rel="manifest" href="https://not-example.com/manifest"> Specifications Specificatio...
CSP: media-src - HTTP
scheme and port number. You must include the single quotes. Some browsers specifically exclude blob and filesystem from source directives. Sites needing to allow these content types can specify them using the Data attribute. 'unsafe-eval' Allows the use of eval() and similar methods for creating code from strings. You must include the single quotes. 'unsafe-hashes' Allows to enable specific inline event handlers. If you only need to allow inline event handlers and not inline <script> elements or javascript: URLs, this is a safer method compared to using the unsafe-inline expression. 'unsafe-inline' Allows the use of inline resources, such as inline <script> elements, javascript: URLs, inline event handlers, and inline <style> elements. You must include the single quotes. 'none' Refers ...
... a safer method compared to using the unsafe-inline expression. 'unsafe-inline' Allows the use of inline resources, such as inline <script> elements, javascript: URLs, inline event handlers, and inline <style> elements. You must include the single quotes. 'none' Refers to the empty set; that is, no URLs match. The single quotes are required. 'nonce-<base64-value>' A whitelist for specific inline scripts using a cryptographic nonce (number used once). The server must generate a unique nonce value each time it transmits a policy. It is critical to provide an unguessable nonce, as bypassing a resource's policy is otherwise trivial. See unsafe inline script for an example. ...
... '<hash-algorithm>-<base64-value>' A sha256, sha384 or sha512 hash of scripts or styles. The use of this source consists of two portions separated by a dash: the encryption algorithm used to create the hash and the base64-encoded hash of the script or style. ...
...A sha256, sha384 or sha512 hash of scripts or styles. The use of this source consists of two portions separated by a dash: the encryption algorithm used to create the hash and the base64-encoded hash of the script or style. When generating the hash, don't include the <script> or <style> tags and note that capitalization and whitespace matter, including leading or trailing whitespace. See unsafe inline script for an example. In CSP 2.0 this applied only to inline scripts. CSP 3.0 allows it in the case of script-src for external scripts. Examples Violation cases Given this CSP header: Content-Security-Policy: media-src https://example.com/ The following <audio>, <video> and <track> elements are blocked and won't load: <audio src="https://not-example.com/audio"></audio> <video src="https:...
CSP: object-src - HTTP
scheme and port number. You must include the single quotes. Some browsers specifically exclude blob and filesystem from source directives. Sites needing to allow these content types can specify them using the Data attribute. 'unsafe-eval' Allows the use of eval() and similar methods for creating code from strings. You must include the single quotes. 'unsafe-hashes' Allows to enable specific inline event handlers. If you only need to allow inline event handlers and not inline <script> elements or javascript: URLs, this is a safer method compared to using the unsafe-inline expression. 'unsafe-inline' Allows the use of inline resources, such as inline <script> elements, javascript: URLs, inline event handlers, and inline <style> elements. You must include the single quotes. 'none' Refers ...
... a safer method compared to using the unsafe-inline expression. 'unsafe-inline' Allows the use of inline resources, such as inline <script> elements, javascript: URLs, inline event handlers, and inline <style> elements. You must include the single quotes. 'none' Refers to the empty set; that is, no URLs match. The single quotes are required. 'nonce-<base64-value>' A whitelist for specific inline scripts using a cryptographic nonce (number used once). The server must generate a unique nonce value each time it transmits a policy. It is critical to provide an unguessable nonce, as bypassing a resource's policy is otherwise trivial. See unsafe inline script for an example. ...
... '<hash-algorithm>-<base64-value>' A sha256, sha384 or sha512 hash of scripts or styles. The use of this source consists of two portions separated by a dash: the encryption algorithm used to create the hash and the base64-encoded hash of the script or style. ...
...A sha256, sha384 or sha512 hash of scripts or styles. The use of this source consists of two portions separated by a dash: the encryption algorithm used to create the hash and the base64-encoded hash of the script or style. When generating the hash, don't include the <script> or <style> tags and note that capitalization and whitespace matter, including leading or trailing whitespace. See unsafe inline script for an example. In CSP 2.0 this applied only to inline scripts. CSP 3.0 allows it in the case of script-src for external scripts. Examples Violation cases Given this CSP header: Content-Security-Policy: object-src https://example.com/ The following <object>, <embed>, and <applet> elements are blocked and won't load: <embed src="https://not-example.com/flash"></embed> <object data="h...
CSP: prefetch-src - HTTP
scheme and port number. You must include the single quotes. Some browsers specifically exclude blob and filesystem from source directives. Sites needing to allow these content types can specify them using the Data attribute. 'unsafe-eval' Allows the use of eval() and similar methods for creating code from strings. You must include the single quotes. 'unsafe-hashes' Allows enabling specific inline event handlers. If you only need to allow inline event handlers and not inline <script> elements or javascript: URLs, this is a safer method than using the unsafe-inline expression. 'unsafe-inline' Allows the use of inline resources, such as inline <script> elements, javascript: URLs, inline event handlers, and inline <style> elements. The single quotes are required. 'none' Refers to the empt...
..., this is a safer method than using the unsafe-inline expression. 'unsafe-inline' Allows the use of inline resources, such as inline <script> elements, javascript: URLs, inline event handlers, and inline <style> elements. The single quotes are required. 'none' Refers to the empty set; that is, no URLs match. The single quotes are required. 'nonce-<base64-value>' An allow-list for specific inline scripts using a cryptographic nonce (number used once). The server must generate a unique nonce value each time it transmits a policy. It is critical to provide an unguessable nonce, as bypassing a resource's policy is otherwise trivial. See unsafe inline script for an example. ...
... '<hash-algorithm>-<base64-value>' A sha256, sha384 or sha512 hash of scripts or styles. The use of this source consists of two portions separated by a dash: the encryption algorithm used to create the hash and the base64-encoded hash of the script or style. ...
...A sha256, sha384 or sha512 hash of scripts or styles. The use of this source consists of two portions separated by a dash: the encryption algorithm used to create the hash and the base64-encoded hash of the script or style. When generating the hash, don't include the <script> or <style> tags and note that capitalization and whitespace matter, including leading or trailing whitespace. See unsafe inline script for an example. In CSP 2.0, this applied only to inline scripts. CSP 3.0 allows it in the case of script-src for external scripts. Example Prefetch resources do not match header Given a page with the following Content Security Policy: Content-Security-Policy: prefetch-src https://example.com/ Fetches for the following code will return network errors, as the URLs provided do not matc...
CSP: style-src-elem - HTTP
scheme and port number. You must include the single quotes. Some browsers specifically exclude blob and filesystem from source directives. Sites needing to allow these content types can specify them using the Data attribute. 'unsafe-eval' Allows the use of eval() and similar methods for creating code from strings. You must include the single quotes. 'unsafe-hashes' Allows enabling specific inline event handlers. If you only need to allow inline event handlers and not inline <script> elements or javascript: URLs, this is a safer method than using the unsafe-inline expression. 'unsafe-inline' Allows the use of inline resources, such as inline <script> elements, javascript: URLs, inline event handlers, and inline <style> elements. The single quotes are required. 'none' Refers to the empt...
..., this is a safer method than using the unsafe-inline expression. 'unsafe-inline' Allows the use of inline resources, such as inline <script> elements, javascript: URLs, inline event handlers, and inline <style> elements. The single quotes are required. 'none' Refers to the empty set; that is, no URLs match. The single quotes are required. 'nonce-<base64-value>' An allow-list for specific inline scripts using a cryptographic nonce (number used once). The server must generate a unique nonce value each time it transmits a policy. It is critical to provide an unguessable nonce, as bypassing a resource's policy is otherwise trivial. See unsafe inline script for an example. ...
... '<hash-algorithm>-<base64-value>' A sha256, sha384 or sha512 hash of scripts or styles. The use of this source consists of two portions separated by a dash: the encryption algorithm used to create the hash and the base64-encoded hash of the script or style. ...
...A sha256, sha384 or sha512 hash of scripts or styles. The use of this source consists of two portions separated by a dash: the encryption algorithm used to create the hash and the base64-encoded hash of the script or style. When generating the hash, don't include the <script> or <style> tags and note that capitalization and whitespace matter, including leading or trailing whitespace. See unsafe inline script for an example. In CSP 2.0, this applied only to inline scripts. CSP 3.0 allows it in the case of script-src for external scripts. 'report-sample' Requires a sample of the violating code to be included in the violation report. Examples TODO: add examples Specifications Specification Status Comment Content Security Policy Level 3The definition of 'style-s...
CSP: worker-src - HTTP
scheme and port number. You must include the single quotes. Some browsers specifically exclude blob and filesystem from source directives. Sites needing to allow these content types can specify them using the Data attribute. 'unsafe-eval' Allows the use of eval() and similar methods for creating code from strings. You must include the single quotes. 'unsafe-hashes' Allows to enable specific inline event handlers. If you only need to allow inline event handlers and not inline <script> elements or javascript: URLs, this is a safer method compared to using the unsafe-inline expression. 'unsafe-inline' Allows the use of inline resources, such as inline <script> elements, javascript: URLs, inline event handlers, and inline <style> elements. You must include the single quotes. 'none' Refers ...
... a safer method compared to using the unsafe-inline expression. 'unsafe-inline' Allows the use of inline resources, such as inline <script> elements, javascript: URLs, inline event handlers, and inline <style> elements. You must include the single quotes. 'none' Refers to the empty set; that is, no URLs match. The single quotes are required. 'nonce-<base64-value>' A whitelist for specific inline scripts using a cryptographic nonce (number used once). The server must generate a unique nonce value each time it transmits a policy. It is critical to provide an unguessable nonce, as bypassing a resource's policy is otherwise trivial. See unsafe inline script for an example. ...
... '<hash-algorithm>-<base64-value>' A sha256, sha384 or sha512 hash of scripts or styles. The use of this source consists of two portions separated by a dash: the encryption algorithm used to create the hash and the base64-encoded hash of the script or style. ...
...A sha256, sha384 or sha512 hash of scripts or styles. The use of this source consists of two portions separated by a dash: the encryption algorithm used to create the hash and the base64-encoded hash of the script or style. When generating the hash, don't include the <script> or <style> tags and note that capitalization and whitespace matter, including leading or trailing whitespace. See unsafe inline script for an example. In CSP 2.0 this applied only to inline scripts. CSP 3.0 allows it in the case of script-src for external scripts. Examples Violation cases Given this CSP header: Content-Security-Policy: worker-src https://example.com/ Worker, SharedWorker, ServiceWorker are blocked and won't load: <script> var blockedWorker = new Worker("data:application/javascript,..."); blocke...
Content-Security-Policy - HTTP
allow for <iframe>). Therefore it is recommended to restrict this fetch-directive (e.g., explicitly set object-src 'none' if possible). prefetch-src Specifies valid sources to be prefetched or prerendered. script-src Specifies valid sources for JavaScript. script-src-elem Specifies valid sources for JavaScript <script> elements. script-src-attr Specifies valid sources for JavaScript inline event handlers. style-src Specifies valid sources for stylesheets. style-src-elem Specifies valid sources for stylesheets <style> elements and <link> elements with rel="stylesheet". style-src-attr Specifies valid sources for inline styles applied to individual DOM elements. worker-src Specifies valid sources for Worker, SharedWorker, or ServiceWorker scripts. Document directives ...
...the protected resource, which means that there will be no connection allowed and, as the strictest policy, connect-src 'none' is enforced. ...
...nect-src http://example.com/; script-src http://example.com/ Examples Example: Disable unsafe inline/eval, only allow loading of resources (images, fonts, scripts, etc.) over https: // header Content-Security-Policy: default-src https: // meta tag <meta http-equiv="Content-Security-Policy" content="default-src https:"> Example: Pre-existing site that uses too much inline code to fix but wants to ensure resources are loaded only over HTTPS and to disable plugins: Content-Security-Policy: default-src https: 'unsafe-eval' 'unsafe-inline'; object-src 'none' Example: Do not implement the above policy yet; instead just report violations that would have occurred: Content-Security-Policy-Report-Only: default-src https:; report-uri /csp-violation-report-endpoint/ See ...
... Specifications Specification Status Comment Content Security Policy Level 3 Working Draft Adds manifest-src, navigate-to, report-to, strict-dynamic, worker-src. Undeprecates frame-src. ...
Index - HTTP
Web › HTTP › Headers › Index
Leading white space before the value is ignored. ...
...ge's actions including preventing popups, preventing the execution of plugins and scripts, and enforcing a same-origin policy. 47 CSP: script-src CSP, Directive, HTTP, Reference, Security The HTTP Content-Security-Policy (CSP) script-src directive specifies valid sources for JavaScript. This includes not only URLs loaded directly into <script> elements, but also things like inline script event handlers (onclick) and XSLT stylesheets which can trigger script execution. 48 CSP: style-src CSP, Directive, HTTP, Reference, Security The HTTP Content-Security-Policy (CSP) style-src directive specifies valid sources for stylesheets. 49 CSP: upgrade-insecure-requests CSP, Directive, HTTP, Reference, Security The HTTP Content-Security-Policy...
... ...
... ...
A re-introduction to JavaScript (JS tutorial) - JavaScript
and do-while loops. The first is good for basic looping; the second for loops where you wish to ensure that the body of the loop is executed at least once: while (true) { // an infinite loop! } var input; do { input = get_input(); } while (inputIsNotValid(input)); JavaScript's for loop is the same as that in C and Java: it lets you provide the control information for your loop on a single line. for (var i = 0; i < 5; i++) { // Will execute 5 times } JavaScript also contains two other prominent for loops: for...of for (let value of array) { // do something with value } and for...in: for (let property in object) { // do something with object property } The && and || operators use short-circuit logic, which means whether they will execute their second operand is dependent o...
...ake 0 or more named parameters. The function body can contain as many statements as you like and can declare its own variables which are local to that function. The return statement can be used to return a value at any time, terminating the function. If no return statement is used (or an empty return with no value), JavaScript returns undefined. The named parameters turn out to be more like guidelines than anything else. You can call a function without passing the parameters it expects, in which case they will be set to undefined. add(); // NaN // You can't perform addition on undefined You can also pass in more arguments than the function is expecting: add(2, 3, 4); // 5 // added the first two; 4 was ignored That may seem a little silly, but functions have access to an additional varia...
... instead. As a result, anything assigned to Person.prototype becomes available to all instances of that constructor via the this object. This is an incredibly powerful tool. ...
...'); s.firstNameCaps(); // TypeError on line 1: s.firstNameCaps is not a function Person.prototype.firstNameCaps = function() { return this.first.toUpperCase(); }; s.firstNameCaps(); // "SIMON" Interestingly, you can also add things to the prototype of built-in JavaScript objects. Let's add a method to String that returns that string in reverse: var s = 'Simon'; s.reversed(); // TypeError on line 1: s.reversed is not a function String.prototype.reversed = function() { var r = ''; for (var i = this.length - 1; i >= 0; i--) { r += this[i]; } return r; }; s.reversed(); // nomiS Our new method even works on string literals! 'This can now be reversed'.reversed(); // desrever eb won nac sihT As mentioned before, the prototype forms part of a chain. The root of that chain is O...
Character classes - JavaScript
Character classes distinguish kinds of characters such as, for example, distinguishing between letters and digits. Types The following table is also duplicated on this cheatsheet. Do not forget to edit it as well, thanks! Characters Meaning . Has one of the following meanings: Matches any single character except line terminators: \n, \r, \u2028 or \u2029. For example, /.y/ matches "my" and "ay", but not "yes", in "yes make my day". Inside a character set, the dot loses its special meaning and matches a literal dot. Note that the m multiline flag doesn't change the dot behavior. So to match a pattern across multiple lines, the character set [^] can be used -- it will match any character including newlines. ES2018 added th...
... \d Matches any digit (Arabic numeral). Equivalent to [0-9]. For example, /\d/ or /[0-9]/ matches "2" in "B2 is the suite number". \D Matches any character that is not a digit (Arabic numeral). ...
...core. Equivalent to [A-Za-z0-9_]. For example, /\w/ matches "a" in "apple", "5" in "$5.28", and "3" in "3D". \W Matches any character that is not a word character from the basic Latin alphabet. Equivalent to [^A-Za-z0-9_]. For example, /\W/ or /[^A-Za-z0-9_]/ matches "%" in "50%". \s Matches a single white space character, including space, tab, form feed, line feed, and other Unicode spaces. Equivalent to [ \f\n\r\t\v\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]. For example, /\s\w*/ matches " bar" in "foo bar". \S Matches a single character other than white space. Equivalent to [^ \f\n\r\t\v\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]. For example, /\S\w*/ matches "foo" in "foo bar". ...
...2f\u205f\u3000\ufeff]. For example, /\s\w*/ matches " bar" in "foo bar". \S Matches a single character other than white space. Equivalent to [^ \f\n\r\t\v\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]. For example, /\S\w*/ matches "foo" in "foo bar". \t Matches a horizontal tab. \r Matches a carriage return. \n Matches a linefeed. \v Matches a vertical tab. \f Matches a form-feed. [\b] Matches a backspace. If you're looking for the word-boundary character (\b), see Boundaries. \0 Matches a NUL character. Do not follow this with another digit. \cX Matches a control character using caret notation, where "X" is a letter from A-Z (corresponding to codepoints...
SyntaxError: JSON.parse: bad parsing - JavaScript
d character SyntaxError: JSON.parse: unexpected non-whitespace character after JSON data SyntaxError: JSON.parse Error: Invalid character at position {0} (Edge) Error type SyntaxError What went wrong? JSON.parse() parses a string as JSON. This string has to be valid JSON and will throw this error if incorrect syntax was encountered. Examples JSON.parse() does not allow trailing commas Both lines will throw a SyntaxError: JSON.parse('[1, 2, 3, 4,]'); JSON.parse('{"foo": 1,}'); // SyntaxError JSON.parse: unexpected character // at line 1 column 14 of the JSON data Omit the trailing commas to parse the JSON correctly: JSON.parse('[1, 2, 3, 4]'); JSON.parse('{"foo": 1}'); Property names must be double-quoted strings You cannot use single-quotes around properties, like 'foo'. JSON.par...
...); // SyntaxError JSON.parse: unexpected character // at line 1 column 14 of the JSON data Omit the trailing commas to parse the JSON correctly: JSON.parse('[1, 2, 3, 4]'); JSON.parse('{"foo": 1}'); Property names must be double-quoted strings You cannot use single-quotes around properties, like 'foo'. JSON.parse("{'foo': 1}"); // SyntaxError: JSON.parse: expected property name or '}' // at line 1 column 2 of the JSON data Instead write "foo": JSON.parse('{"foo": 1}'); Leading zeros and decimal points You cannot use leading zeros, like 01, and decimal points must be followed by at least one digit. ...
...: 1}"); // SyntaxError: JSON.parse: expected property name or '}' // at line 1 column 2 of the JSON data Instead write "foo": JSON.parse('{"foo": 1}'); Leading zeros and decimal points You cannot use leading zeros, like 01, and decimal points must be followed by at least one digit. ...
... JSON.parse('{"foo": 1}'); Leading zeros and decimal points You cannot use leading zeros, like 01, and decimal points must be followed by at least one digit. ...
SyntaxError: unterminated string literal - JavaScript
or double (") quotes. JavaScript makes no distinction between single-quoted strings and double-quoted strings. Escape sequences work in strings created with either single or double quotes. To fix this error, check if: you have opening and closing quotes (single or double) for your string literal, you have escaped your string literal correctly, your string literal isn't split across multiple lines. Examples Multiple lines You can't split a string across multiple lines like this in JavaScript: var longString = 'This is a very long string which needs to wrap across multiple lines because otherwise my code is unreadable.'; // SyntaxError: unterminated string literal Instead, use the + operator, a backslash, or template literals. The + operator varian...
...his is a very long string which needs to wrap across multiple lines because otherwise my code is unreadable.'; // SyntaxError: unterminated string literal Instead, use the + operator, a backslash, or template literals. The + operator variant looks like this: var longString = 'This is a very long string which needs ' + 'to wrap across multiple lines because ' + 'otherwise my code is unreadable.'; Or you can use the backslash character ("\") at the end of each line to indicate that the string will continue on the next line. Make sure there is no space or any other character after the backslash (except for a line break), or as an indent; otherwise it will not work. That form looks like this: var longString = 'This is a ver...
... unreadable.'; Or you can use the backslash character ("\") at the end of each line to indicate that the string will continue on the next line. Make sure there is no space or any other character after the backslash (except for a line break), or as an indent; otherwise it will not work. ...
...dent; otherwise it will not work. ...
Error() constructor - JavaScript
Examples Function call or new construction When Error is used like a function -- without new, it will return an Error object. ...
... Examples Function call or new construction When Error is used like a function -- without new, it will return an Error object. ...
... Examples Function call or new construction When Error is used like a function -- without new, it will return an Error object. ...
... Examples Function call or new construction When Error is used like a function -- without new, it will return an Error object. Therefore, a mere call to Error will produce the same output that constructing an Error object via the new keyword would. // this... ...
String.prototype.fontcolor() - JavaScript
ormat rrggbb. For example, the hexadecimal RGB values for salmon are red=FA, green=80, and blue=72, so the RGB triplet for salmon is "FA8072". Examples Using fontcolor() The following example uses the fontcolor() method to change the color of a string by producing a string with the HTML <font> tag. ...
...are red=FA, green=80, and blue=72, so the RGB triplet for salmon is "FA8072". Examples Using fontcolor() The following example uses the fontcolor() method to change the color of a string by producing a string with the HTML <font> tag. ...
...ples Using fontcolor() The following example uses the fontcolor() method to change the color of a string by producing a string with the HTML <font> tag. ...
...nge the color of a string by producing a string with the HTML <font> tag. var worldString = 'Hello, world'; console.log(worldString.fontcolor('red') + ' is red in this line'); // '<font color="red">Hello, world</font> is red in this line' console.log(worldString.fontcolor('FF00') + ' is red in hexadecimal in this line'); // '<font color="FF00">Hello, world</font> is red in hexadecimal in this line' With the element.style object you can get the element's style attribute and manipulate it more generically, for example: document.getElementById('yourElemId').style.color = 'red'; Specifications Specification ECMAScript (ECMA-262)The definition of 'String.prototype.fontcolor' in that specification. ...
String - JavaScript
\u{XXXXXX} (where X...XXXXXX is 1-6 hex digits; range of 0x0-0x10FFFF) UTF-32 code unit / Unicode code point ...
...u{X} ... \u{XXXXXX} (where X...XXXXXX is 1-6 hex digits; range of 0x0-0x10FFFF) UTF-32 code unit / Unicode code point between U+0000 and U+10FFFF \xXX (where XX is 2 hex digits; range of 0x00-0xFF) ISO-8859-1 character / Unicode code point between U+0000 and U+00FF Long literal strings Sometimes, your code will include strings which are very long. Rather than having lines that go on endlessly, or wrap at the whim of your editor, you may wish to specifically break the string into multiple lines in the source code without affecting the actual string contents. There are two ways you can do this. Method 1 You can use the + operator to append multiple strings together, like this: let longString = "This is a very long string which needs " + "to wrap...
...essly, or wrap at the whim of your editor, you may wish to specifically break the string into multiple lines in the source code without affecting the actual string contents. There are two ways you can do this. Method 1 You can use the + operator to append multiple strings together, like this: let longString = "This is a very long string which needs " + "to wrap across multiple lines because " + "otherwise my code is unreadable." Method 2 You can use the backslash character (\) at the end of each line to indicate that the string will continue on the next line. Make sure there is no space or any other character after the backslash (except for a line break), or as an indent; otherwise it will not work. That form looks like this: let longString = "This is ...
... Constructor String() Creates a new String object. It performs type conversion when called as a function, rather than as a constructor, which is usually more useful. ...
TypeError() constructor - JavaScript
The TypeError() constructor creates a new error when an operation could not be performed, typically (but not exclusively) when a value is not of the expected type. Syntax new TypeError([message[, fileName[, lineNumber]]]) Parameters message Optional Optional. Human-readable description of the error fileName Optional Optional. The name of the file containing the code that caused the exception lineNumber Optional Optional. ...
...w error when an operation could not be performed, typically (but not exclusively) when a value is not of the expected type. Syntax new TypeError([message[, fileName[, lineNumber]]]) Parameters message Optional Optional. Human-readable description of the error fileName Optional Optional. The name of the file containing the code that caused the exception lineNumber Optional Optional. ...
...ception lineNumber Optional Optional. ...
... ...
this - JavaScript
ond(){} static third(){} } new Example(); // ['constructor', 'first', 'second'] Note: Static methods are not properties of this. They are properties of the class itself. Derived classes Unlike base class constructors, derived constructors have no initial this binding. Calling super() creates a this binding within the constructor and essentially has the effect of evaluating the following line of code, where Base is the inherited class: this = new Base(); Warning: Referring to this before calling super() will throw an error. Derived classes must not return before calling super(), unless they return an Object or have no constructor at all. class Base {} class Good extends Base {} class AlsoGood extends Base { constructor() { return {a: 5}; } } class Bad extends Base { co...
...ect, its this is set to the object the method is called on. In the following example, when o.f() is invoked, inside the function this is bound to the o object. var o = { prop: 37, f: function() { return this.prop; } }; console.log(o.f()); // 37 Note that this behavior is not at all affected by how or where the function was defined. In the previous example, we defined the function inline as the f member during the definition of o. However, we could have just as easily defined the function first and later attached it to o.f. Doing so results in the same behavior: var o = {prop: 37}; function independent() { return this.prop; } o.f = independent; console.log(o.f()); // 37 This demonstrates that it matters only that the function was invoked from the f member of o. Similarly...
...Note however that only the outer code has its this set this way: <button onclick="alert((function() { return this; })());"> Show inner this </butto...
...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...
Performance budgets - Web Performance
blocking development or deploys. The error level is an upper bound limit, where changes will have a negative and noticeable impact. In order to begin, you need to first measure the devices and connection speeds where your users are coming from (e.g. A ~$200 Android device over a 3G connection), using multiple tools. These time-based metrics will translate into file-size budgets. A default baseline to reduce bounce rate is to achieve Time to Interactive under 5 seconds in 3G/4G, and under 2 seconds for subsequent loads. However, based on the specific goals and content of your site, you might choose to focus on other metrics. For a text-heavy site such as a blog or a news site, the First Contentful Paint metric could reflect more closely the user behavior. (i.e. How fast can users start rea...
...t only the bounce or conversion rate but how likely is that user to return. How do I implement a performance budget? During development, there are a few tools to run checks against new or modified assets: A module bundler (e.g. webpack), has performance features that will notify you when assets exceed specified limits. Bundlesize, allows you to define and run file size checks in your CI pipeline. ...
...t how likely is that user to return. How do I implement a performance budget? During development, there are a few tools to run checks against new or modified assets: A module bundler (e.g. webpack), has performance features that will notify you when assets exceed specified limits. Bundlesize, allows you to define and run file size checks in your CI pipeline. ...
...sets exceed specified limits. Bundlesize, allows you to define and run file size checks in your CI pipeline. File size checks are the first line of defense against regressions but translating size back into time metrics can be difficult since development environments could be missing 3rd party scripts, and optimizations commonly provided by a CDN. The first step is to define a development baseline for each branch to compare to and the precision of the difference between development and production can be used as a goal towards better match the live environment. The Lighthouse Bot integrates with Travis CI and can be used to gather Lighthouse and Webpage Test metrics from a development URL. The bot will pass or fail based on the provided minimum scores. How do I enforce a performance budge...
Add to Home screen - Progressive web apps (PWAs)
browsers. Firefox has had mobile support since v58 and is working on desktop support. See caniuse.com for exact details. How do you use it? We've written a very simple example web site (see our demo live, and also see the source code) that doesn't do much, but was developed with the necessary code to allow it to be added to a Home screen, as well as a service worker to enable it to be used offline. The example displays a series of fox pictures. If you have Firefox for Android available, use it to navigate to our demo at https://mdn.github.io/pwa-examples/a2hs/. You'll see fox pictures, but more important, you'll see a "home" icon with a plus (+) icon inside it -- this is the "Add to Home screen" icon displayed for any site that has the necessary features in place. Tapping this will sho...
...singly being moved in a more secure direction, and many modern web technologies (A2HS included) will work only on secure contexts. To have a manifest file with the correct fields filled in, linked from the HTML head. To have an appropriate icon available for displaying on the Home screen. Chrome additionally requires the app to have a service worker registered (e.g., so it can function when offline). Manifest The web manifest is written in standard JSON format and should be placed somewhere inside your app directory (in the root is probably best) with the name somefilename.webmanifest (we've chosen manifest.webmanifest). It contains multiple fields that define certain information about the web app and how it should behave. Note: The .webmanifest extension is specified in the Media type...
..., Chrome already supports the WebP format). Note that the type member in each icon's object specifies the icon's mimetype, so the browser can quickly read what type the icon is, and then ignore it and move to a different icon if it doesn't support it. In terms of how to design the icon, you should follow the same best practices you'd follow for any Android icon (see the Android icon design guidelines). Link the HTML to the manifest To finish setting up your manifest, you need to reference it from the HTML of your application's home page: <link rel="manifest" href="manifest.webmanifest"> Browsers that support A2HS will know where to look for your manifest once this is in place. What does A2HS not give you? Bear in mind that when you add an app to your Home screen, it just makes the app ...
...f your application's home page: <link rel="manifest" href="manifest.webmanifest"> Browsers that support A2HS will know where to look for your manifest once this is in place. What does A2HS not give you? Bear in mind that when you add an app to your Home screen, it just makes the app easily accessible -- it doesn't download the app's assets and data to your device and make the app available offline, or anything like that. To make your app work offline, you have to use the Service Worker API to handle storing the assets offline, and if required, Web storage or IndexedDB to store its data. In our example app, we've just used a service worker to store all necessary files. The service worker is registered against the site with the final code block in the index.js file. We then cache all the si...
Media - Progressive web apps (PWAs)
are as follows. Place your mouse over the items in this list to see the actual pointer shapes in your browser: Selector Selects pointer Indicating a link wait Indicating that the program cannot accept input progress Indicating that the program is working, but can still accept input default The default (usually an arrow) An outline property creates an outline that is often used to indicate keyboard focus. Its values are similar to the border property, except that you cannot specify individual sides. Some other features of user interfaces are implemented using attributes, in the normal way. For example, an element that is disabled or read-only has the disabled attribute or the readonly attribute. Selectors can specify these...
...It might also have a hover effect when the poin...
...It might also have a hover effect when the pointer is over it. ...
...It might also have a hover effect when the pointer is over it. More details For more information about user interfaces in CSS, see User interface in the CSS Specification. ...
Structural overview of progressive web apps - Progressive web apps (PWAs)
t page load is quick because of the SSR, and the navigation between pages is smooth because the client can re-render the page with only the parts that have changed. PWAs can be built using any approach you like, but some will work better than the others. ...
...That way, the next time someone visits the app from the device, the UI loads from the cache immediately and any new content is requested from the server (if it isn't available in the cache already). ...
...of the app's contents. That way, the next time someone visits the app from the device, the UI loads from the cache immediately and any new content is requested from the server (if it isn't available in the cache already). This structure is fast, and also feels fast as the user sees "something" instantly, instead of a loading spinner or a blank page. It also allows the website to be accessible offline if the network connection is not available. We can control what is requested from the server and what is retrieved from the cache with a service worker, which will be explained in detail in the next article -- for now let's focus on the structure itself. Benefits of the app shell pattern This architecture allows a web site to benefit the most from all the PWA features -- it caches the app she...
...h it behaves like a native app, it is still a website -- you can click on the links within the page and send a URL to someone if you want to share it. Progressive: Start with the "good, old basic website" and progressively add new features while remembering to detect if they are available in the browser and gracefully handle any errors that crop up if support is not available. For example, an offline mode with the help of service workers is just an extra trait that makes the website experience better, but it's still perfectly usable without it. Responsive: Responsive web design also applies to progressive web apps, as both are mainly for mobile devices. There are so many varied devices with browsers -- it's important to prepare your website so it works on different screen sizes, viewports or...
Applying SVG effects to HTML content - SVG: Scalable Vector Graphics
u first need to create the CSS style that references the SVG to apply. <style>p { mask: url(#my-mask); }</style> In the above example, all paragraphs are masked by an SVG <mask> with the ID my-mask. ...
...ample, all paragraphs are masked by an SVG <mask> with the ID my-mask. ...
...Everything else specifies details about the gradient mask itself. ...
...minim veniam. </p> <button onclick="toggleRadius()">Toggle radius</button> <svg height="0"> <clipPath id="clipping-path-1" clipPathUnits="objectBoundingBox"> <circle cx="0.25" cy="0.25" r="0.25" id="circle"/> <rect x="0.5" y="0.2" width="0.5" height="0.8"/> </clipPath> </svg> .target { clip-path: url(#clipping-path-1); } p { width: 300px; border: 1px solid #000; display: inline-block; } This establishes a clipping area made of a circle and rectangle, assigns it the ID #clipping-path-1, then references it in the CSS. The clip path can be assigned to any element with the target class. You can make changes to the SVG in real time and see them immediately affect the rendering of the HTML. For example, you can resize the circle in the clip path established above: function...
color-rendering - SVG: Scalable Vector Graphics
The color-rendering attribute provides a hint to the SVG user agent about how to optimize its color interpolation and compositing operations. color-rendering takes precedence over color-interpolation-filters. For example, assume color-rendering: optimizeSpeed and color-interpolation-filters: linearRGB. In this case, the SVG user agent should perform color operations in a way that optimizes performance, which might mean sacrificing the color interpolation precision as specified by through the linearRGB value for color-interpolation-filters. Note: As a presentation attribute, color-rendering can be used as a CSS property. As a presentation attribute, it can be applied to any element but it only has an effect on the following 29 elements: <a>, <animate>, <animateColor>, <circle>, <clipPath>...
...cision as specified by through the linearRGB value for color-interpolation-filters. Note: As a presentation attribute, color-rendering can be used as a CSS property. ...
...s specified by through the linearRGB value for color-interpolation-filters. Note: As a presentation attribute, color-rendering can be used as a CSS property. ...
... presentation attribute, color-rendering can be used as a CSS property. ...
href - SVG: Scalable Vector Graphics
Web › SVG › Attribute › href
he href attribute defines a link to a resource as a reference URL. The exact meaning of that link depends on the context of each element using it. Note: Specifications before SVG 2 defined an xlink:href attribute, which is now rendered obsolete by the href attribute. Fifteen elements are using this attribute: <a>, <animate>, <animateMotion>, <animateTransform>, <discard>, <feImage>, <image>, <linearGradient>, <mpath>, <pattern>, <radialGradient>, <script>, <set>, <textPath>, and <use> html, body, svg { height: 100%; } <svg viewBox="0 0 160 40" xmlns="http://www.w3.org/2000/svg"> <a href="https://developer.mozilla.org/"><text x="10" y="25">MDN Web Docs</text></a> </svg> In SVG a For <a>, href defines the location of the referenced object, expressed as a URL reference. ...
...e Animatable Yes image For <image>, href defines a URL referring to the image to render. Value <url> Default value None Animatable Yes Example html, body, svg { height: 100%; } <svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg"> <image href="/files/2917/fxlogo.png" x="0" y="0" height="100" width="100"/> </svg> linearGradient For <linearGradient>, href defines URL referring to a template gradient element; to be valid, the reference must be to a different <linearGradient> or <radialGradient> element. Value <url> Default value None Animatable Yes mpath For <mpath>, href defines a URL referring to the <path> element or basic shape which defines the motion path. ...
...ren due to its own href attribute, then the current element can inherit those attributes or children. On the <pattern> element, the href attribute is animatable. Value <url> Default value None Animatable Yes radialGradient For <radialGradient>, href defines URL referring to a template gradient element; to be valid, the reference must be to a different <linearGradient> or <radialGradient> element. Value <url> Default value None Animatable Yes script For <script>, href defines a URL referring to an external resource containing the script code. Value <url> Default value None Animatable No textPath For <textPath>, href defines a URL referring to the <path> element ...
...lter Effects Module Level 1The definition of 'href for <feImage>' in that specification. Candidate Recommendation Defines href for the <feImage> element. Scalable Vector Graphics (SVG) 2The definition of 'href for <image>' in that specification. Candidate Recommendation Defines href for the <image> element. Scalable Vector Graphics (SVG) 2The definition of 'href for <linearGradient>' in that specification. Candidate Recommendation Defines href for the <linearGradient> element. SVG Animations Level 2The definition of 'href for <mpath>' in that specification. Editor's Draft Defines href for the <mpath> element. Scalable Vector Graphics (SVG) 2The definition of 'href for <pattern>' in that specification. Candidate Recommendation De...
intercept - SVG: Scalable Vector Graphics
The intercept attribute defines the intercept of the linear function of color component transfers when the type attribute is set to linear. ...
... The intercept attribute defines the intercept of the linear function of color component transfers when the type attribute is set to linear. ...
...eFuncB>, <feFuncG>, and <feFuncR> html, body, svg { height: 100%; } <svg viewBox="0 0 420 200" xmlns="http://www.w3.org/2000/svg"> <defs> <linearGradient id="gradient" gradientUnits="userSpaceOnUse" x1="0" y1="0" x2="200" y2="0"> <stop offset="0" stop-color="#ff0000" /> <stop offset="0.5" stop-color="#00ff00" /> <stop offset="1" stop-color="#0000ff" /> </linearGradient> </defs> <filter id="componentTransfer1" x="0" y="0" width="100%" height="100%"> <feComponentTransfer> <feFuncR type="linear" intercept="0"/> <feFuncG type="linear" intercept="0"/> <feFuncB type="linear" intercept="0"/> </feComponentTransfer> </filter> <filter id="componentTransfer2" x="0" y="0" width="100%" height="100%"> <feComponentTransfer> ...
...fs> <filter id="componentTransfer1" x="0" y="0" width="100%" height="100%"> <feComponentTransfer> <feFuncR type="linear" intercept="0"/> <feFuncG type="linear" intercept="0"/> <feFuncB type="linear" intercept="0"/> </feComponentTransfer> </filter> <filter id="componentTransfer2" x="0" y="0" width="100%" height="100%"> <feComponentTransfer> <feFuncR type="linear" intercept="0.3"/> <feFuncG type="linear" intercept="0.1"/> <feFuncB type="linear" intercept="0.8"/> </feComponentTransfer> </filter> <rect x="0" y="0" width="200" height="200" fill="url(#gradient)" style="filter: url(#componentTransfer1);" /> <rect x="0" y="0" width="200" height="200" fill="url(#gradient)" style="filter: url(#componentTransfer2); transform: t...
marker-end - SVG: Scalable Vector Graphics
The marker-end attribute defines the arrowhead or polymarker that will be drawn at the final vertex of the given shape. For all shape elements, except <polyline> and <path>, the last vertex is the same as the first vertex. In this case, if the value of marker-start and marker-end are both not none, then two markers will be rendered on that final vertex. For <path> elements, for each closed subpath, the last vertex is the same as the first vertex. marker-end is only rendered on the final vertex of the path data. Note: As a presentation attribute, marker-end can be used as a CSS property. ...
...that final vertex. For <path> elements, for each closed subpath, the last vertex is the same as the first vertex. marker-end is only rendered on the final vertex of the path data. Note: As a presentation attribute, marker-end can be used as a CSS property. ...
...lements, for each closed subpath, the last vertex is the same as the first vertex. marker-end is only rendered on the final vertex of the path data. Note: As a presentation attribute, marker-end can be used as a CSS property. ...
... <polyline>, and <rect> html, body, svg { height: 100%; } <svg viewBox="0 0 120 120" xmlns="http://www.w3.org/2000/svg"> <defs> <marker id="triangle" viewBox="0 0 10 10" refX="1" refY="5" markerUnits="strokeWidth" markerWidth="10" markerHeight="10" orient="auto"> <path d="M 0 0 L 10 5 L 0 10 z" fill="#f00"/> </marker> </defs> <polyline fill="none" stroke="black" points="20,100 40,60 70,80 100,20" marker-end="url(#triangle)"/> </svg> Usage notes Value none | <marker-ref> Default value none Animatable Yes none Indicates that no marker symbol shall be drawn at the final vertex. <marker-ref> This value is a reference to a <marker> element, which will be drawn at the final ...
marker-start - SVG: Scalable Vector Graphics
The marker-start attribute defines the arrowhead or polymarker that will be drawn at the first vertex of the given shape. For all shape elements, except <polyline> and <path>, the last vertex is the same as the first vertex. In this case, if the value of marker-start and marker-end are both not none, then two markers will be rendered on that final vertex. For <path> elements, for each closed subpath, the last vertex is the same as the first vertex. marker-start is only rendered on the first vertex of the path data. Note: As a presentation attribute, marker-start can be used as a CSS property. ...
... final vertex. For <path> elements, for each closed subpath, the last vertex is the same as the first vertex. marker-start is only rendered on the first vertex of the path data. Note: As a presentation attribute, marker-start can be used as a CSS property. ...
...nts, for each closed subpath, the last vertex is the same as the first vertex. marker-start is only rendered on the first vertex of the path data. Note: As a presentation attribute, marker-start can be used as a CSS property. ...
... <polyline>, and <rect> html, body, svg { height: 100%; } <svg viewBox="0 0 120 120" xmlns="http://www.w3.org/2000/svg"> <defs> <marker id="triangle" viewBox="0 0 10 10" refX="1" refY="5" markerUnits="strokeWidth" markerWidth="10" markerHeight="10" orient="auto"> <path d="M 0 0 L 10 5 L 0 10 z" fill="#f00"/> </marker> </defs> <polyline fill="none" stroke="black" points="20,100 40,60 70,80 100,20" marker-start="url(#triangle)"/> </svg> Usage notes Value none | <marker-ref> Default value none Animatable Yes none Indicates that no marker symbol shall be drawn at the first vertex. <marker-ref> This value is a reference to a <marker> element, which will be drawn at the firs...
paint-order - SVG: Scalable Vector Graphics
The paint-order attribute specifies the order that the fill, stroke, and markers of a given shape or text element are painted. Note: As a presentation attribute, paint-order can be used as a CSS property. As a presentation attribute, it can be applied to any element but it has effect only on the following ten elements: <circle>, <ellipse>, <line>, <path>, <polygon>, <polyline>, <rect>, <text>, <textPath>, and <tspan> Usage notes Value normal | [ fill || stroke || markers ] Default value normal Animatable Yes normal This value indicates that the fill will be painted first, then the stroke, and finally the markers. [ fill || stroke || markers ] The order of these three keywords indicates the order in which the painting happens, from left to ri...
...| stroke || markers ] The order of these three keywords indicates the order in which the painting happens, from left to right. If any of the three painting components is omitted, they will be painted in their default order after the specified components. For example, using stroke is equivalent to stroke fill markers. ...
.... If any of the three painting components is omitted, they will be painted in their default order after the specified components. For example, using stroke is equivalent to stroke fill markers. ...
...nts. For example, using stroke is equivalent to stroke fill markers. ...
stroke - SVG: Scalable Vector Graphics
Web › SVG › Attribute › stroke
The stroke attribute is a presentation attribute defining the color (or any SVG paint servers like gradients or patterns) used to paint the outline of the shape; Note: As a presentation attribute stroke can be used as a CSS property. ...
... The stroke attribute is a presentation attribute defining the color (or any SVG paint servers like gradients or patterns) used to paint the outline of the shape; Note: As a presentation attribute stroke can be used as a CSS property. ...
... is a presentation attribute defining the color (or any SVG paint servers like gradients or patterns) used to paint the outline of the shape; Note: As a presentation attribute stroke can be used as a CSS property. ...
...lowing twelve elements: <altGlyph>, <circle>, <ellipse>, <line>, <path>, <polygon>, <polyline>, <rect>, <text>, <textPath>, <tref>, and <tspan> html,body,svg { height:100% } <svg viewBox="0 0 20 10" xmlns="http://www.w3.org/2000/svg"> <!-- Simple color stroke --> <circle cx="5" cy="5" r="4" fill="none" stroke="green" /> <!-- Stroke a circle with a gradient --> <defs> <linearGradient id="myGradient"> <stop offset="0%" stop-color="green" /> <stop offset="100%" stop-color="white" /> </linearGradient> </defs> <circle cx="15" cy="5" r="4" fill="none" stroke="url(#myGradient)" /> </svg> Usage notes Value <paint> Default value none Animatable Yes Specifications Specification St...
text-anchor - SVG: Scalable Vector Graphics
The text-anchor attribute is applied to each individual text chunk within a given <text> element. ...
... The text-anchor attribute is applied to each individual text chunk within a given <text> element. ...
... The text-anchor attribute is applied to each individual text chunk within a given <text> element. ...
...text is rendered at the initial text position. For an element with a vertical primary text direction (often typical for Asian text), the top side of the text is rendered at the initial text position. middle The rendered characters are aligned such that the middle of the text string is at the current text position. (For text on a path, conceptually the text string is first laid out in a straight line. The midpoint between the start of the text string and the end of the text string is determined. Then, the text string is mapped onto the path with this midpoint placed at the current text position.) end The rendered characters are shifted such that the end of the resulting rendered text (final current text position before applying the text-anchor property) is at the initial current text positi...
xlink:href - SVG: Scalable Vector Graphics
ence IRI. The exact meaning of that link depends on the context of each element using it. Note: SVG 2 removed the need for the xlink namespace, so instead of xlink:href you should use href. 22 elements are using this attribute: <a>, <altGlyph>, <animate>, <animateColor>, <animateMotion>, <animateTransform>, <color-profile>, <cursor>, <feImage>, <filter>, <font-face-uri>, <glyphRef>, <image>, <linearGradient>, <mpath>, <pattern>, <radialGradient>, <script>, <set>, <textPath>, <tref>, and <use>} html, body, svg { height: 100%; } <svg viewBox="0 0 160 40" xmlns="http://www.w3.org/2000/svg"> <a xlink:href="https://developer.mozilla.org/"><text x="10" y="25">MDN Web Docs</text></a> </svg> a For <a>, xlink:href defines the location of the referenced object. Value <iri>...
... For <glyphRef>, xlink:href defines to a <glyph> element in an SVG document fragment. The referenced <glyph> is rendered as an alternate glyph. Value <iri> Default value None Animatable No image For <image>, xlink:href defines the location of the referenced image. Value <iri> Default value None Animatable Yes linearGradient For <linearGradient>, xlink:href defines the reference to a different <linearGradient> or <radialGradient> element within the current SVG document fragment. Any <linearGradient> attributes which are defined on the referenced element which are not defined on this element are inherited by this element. If this element has no defined gradient stops, and the referenced element does (possib...
...nced element. Inheritance can be indirect to an arbitrary level; thus, if the referenced element inherits attributes or children due to its own xlink:href attribute, then the current element can inherit those attributes or children. Value <iri> Default value None Animatable Yes radialGradient For <radialGradient>, xlink:href defines the to a different <linearGradient> or <radialGradient> element within the current SVG document fragment. Any <radialGradient> attributes which are defined on the referenced element which are not defined on this element are inherited by this element. If this element has no defined gradient stops, and the referenced element does (possibly due to its own xlink:href attribute), then this element inherits the gradient stop f...
...dition)The definition of 'href for <glyphRef>' in that specification. Recommendation Defines href for the <glyphRef> element. Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'href for <image>' in that specification. Recommendation Defines href for the <image> element. Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'href for <linearGradient>' in that specification. Recommendation Defines href for the <linearGradient> element. Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'href for <mpath>' in that specification. Recommendation Defines href for the <mpath> element. Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'href for <pattern>' in that specificat...
<feComponentTransfer> - SVG: Scalable Vector Graphics
following elements, in any order:<feFuncA>, <feFuncR>, <feFuncB>, <feFuncG> Attributes Global attributes Core attributes Presentation attributes Filter primitive attributes class style Specific attributes in DOM Interface This element implements the SVGFEComponentTransferElement interface. ...
...="rainbow" gradientUnits="userSpaceOnUse" x1="0" y1="0" x2="100%" y2="0"> <stop offset="0" stop-color="#ff0000"></stop> <stop offset="0.2" stop-color="#ffff00"></stop> <stop offset="0.4" stop-color="#00ff00"></stop> <stop offset="0.6" stop-color="#00ffff"></stop> <stop offset="0.8" stop-color="#0000ff"></stop> <stop offset="1" stop-color="#800080"></stop> </linearGradient> <filter id="identity" x="0" y="0" width="100%" height="100%"> <feComponentTransfer> <feFuncR type="identity"></feFuncR> <feFuncG type="identity"></feFuncG> <feFuncB type="identity"></feFuncB> <feFuncA type="identity"></feFuncA> </feComponentTransfer> </filter> <filter id="table" x="0" y="0" width="100%" height="100%"> <feCom...
...uncB> </feComponentTransfer> </filter> <filter id="discrete" x="0" y="0" width="100%" height="100%"> <feComponentTransfer> <feFuncR type="discrete" tableValues="0 0 1 1"></feFuncR> <feFuncG type="discrete" tableValues="1 1 0 0"></feFuncG> <feFuncB type="discrete" tableValues="0 1 1 0"></feFuncB> </feComponentTransfer> </filter> <filter id="linear" x="0" y="0" width="100%" height="100%"> <feComponentTransfer> <feFuncR type="linear" slope="0.5" intercept="0"></feFuncR> <feFuncG type="linear" slope="0.5" intercept="0.25"></feFuncG> <feFuncB type="linear" slope="0.5" intercept="0.5"></feFuncB> </feComponentTransfer> </filter> <filter id="gamma" x="0" y="0" width="100%" height="100%"> <feComp...
...="70">Identity</text> <rect x="0" y="80" width="100%" height="20" style="filter:url(#identity)"></rect> <text x="0" y="120">Table lookup</text> <rect x="0" y="130" width="100%" height="20" style="filter:url(#table)"></rect> <text x="0" y="170">Discrete table lookup</text> <rect x="0" y="180" width="100%" height="20" style="filter:url(#discrete)"></rect> <text x="0" y="220">Linear function</text> <rect x="0" y="230" width="100%" height="20" style="filter:url(#linear)"></rect> <text x="0" y="270">Gamma function</text> <rect x="0" y="280" width="100%" height="20" style="filter:url(#gamma)"></rect> </g> </svg> CSS rect { fill: url(#rainbow); } Result Specifications Specification Status Comment Filter Effects Module Level 1T...
<radialGradient> - SVG: Scalable Vector Graphics
to HTML elements where SVG gradient can only apply to SVG elements. html,body,svg { height:100% } <svg viewBox="0 0 10 10" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> <defs> <radialGradient id="myGradient"> <stop offset="10%" stop-color="gold" /> <stop offset="95%" stop-color="red" /> </radialGradient> </defs> <!-- using my linear gradient --> <circle cx="5" cy="5" r="4" fill="url('#myGradient')" /> </svg> Attributes cx This attribute defines the x coordinate of the end circle of the radial gradient. Value type: <length> ; Default value: 50%; Animatable: yes cy This attribute defines the y coordinate of the end circle of the radial gradient. Value type: <length> ; Default value: 50%; Animatable: yes fr Th...
...defines the coordinate system for attributes x1, x2, y1, y2 Value type: userSpaceOnUse|objectBoundingBox ; Default value: objectBoundingBox; Animatable: yes gradientTransform This attribute provides additional transformation to the gradient coordinate system. Value type: <transform-list> ; Default value: identity transform; Animatable: yes href This attribute defines a reference to another <linearGradient> element that will be used as a template. Value type: <URL> ; Default value: none; Animatable: yes r This attribute defines the radius of the end circle of the radial gradient. The gradient will be drawn such that the 100% <stop> is mapped to the perimeter of the end circle. Value type: <length> ; Default value: 50%; Animatable: yes spreadMethod This attribute indicates how the gr...
...l be drawn such that the 100% <stop> is mapped to the perimeter of the end circle. Value type: <length> ; Default value: 50%; Animatable: yes spreadMethod This attribute indicates how the gradient behaves if it starts or ends inside the bounds of the shape containing the gradient. Value type: pad|reflect|repeat ; Default value: pad; Animatable: yes xlink:href An <IRI> reference to another <linearGradient> element that will be used as a template. Value type: <IRI> ; Default value: none; Animatable: yes Global attributes Core Attributes Most notably: id Styling Attributes class, style Event Attributes Global event attributes, Document element event attributes Presentation Attributes Most notably: clip-path, clip-rule, color, color-interpolation, color-rendering, cursor, displ...
...ibutes Most notably: id Styling Attributes class, style Event Attributes Global event attributes, Document element event attributes Presentation Attributes Most notably: clip-path, clip-rule, color, color-interpolation, color-rendering, cursor, display, 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, transform, vector-effect, visibility XLink Attributes xlink:href, xlink:title Usage notes CategoriesGradient elementPermitted contentAny number of the following elements, in any order:Descriptive elements<animate>, <animateTransform>, <set>, <stop> Specifications Specification Status Comment S...
SVG element reference - SVG: Scalable Vector Graphics
Web › SVG › Element
feConvolveMatrix> <feDiffuseLighting> <feDisplacementMap> <feDistantLight> <feDropShadow> <feFlood> <feFuncA> <feFuncB> <feFuncG> <feFuncR> <feGaussianBlur> <feImage> <feMerge> <feMergeNode> <feMorphology> <feOffset> <fePointLight> <feSpecularLighting> <feSpotLight> <feTile> <feTurbulence> <filter> <foreignObject> G <g> H <hatch> <hatchpath> I <image> L <line> <linearGradient> M <marker> <mask> <mesh> <meshgradient> <meshpatch> <meshrow> <metadata> <mpath> P <path> <pattern> <polygon> <polyline> R <radialGradient> <rect> S <script> <set> <solidcolor> <stop> <style> <svg> <switch> <symbol> T <text> <textPath> <title> <tspan> U <unknown> <use> V <view> SVG elements by category Animation eleme...
...tern> <polygon> <polyline> R <radialGradient> <rect> S <script> <set> <solidcolor> <stop> <style> <svg> <switch> <symbol> T <text> <textPath> <title> <tspan> U <unknown> <use> V <view> SVG elements by category Animation elements <animate>, <animateColor>, <animateMotion>, <animateTransform>, <discard>, <mpath>, <set> Basic shapes <circle>, <ellipse>, <line>, <polygon>, <polyline>, <rect> Container elements <a>, <defs>, <g>, <marker>, <mask>, <missing-glyph>, <pattern>, <svg>, <switch>, <symbol>, <unknown> Descriptive elements <desc>, <metadata>, <title> Filter primitive elements <feBlend>, <feColorMatrix>, <feComponentTransfer>, <feComposite>, <feConvolveMatrix>, <feDiffuseLighting>, <feDisplacementMap>, <feDropShadow>, <feFlood>,<feFuncA>, <...
...lveMatrix>, <feDiffuseLighting>, <feDisplacementMap>, <feDropShadow>, <feFlood>,<feFuncA>, <feFuncB>, <feFuncG>, <feFuncR>,<feGaussianBlur>, <feImage>, <feMerge>, <feMergeNode>, <feMorphology>, <feOffset>, <feSpecularLighting>, <feTile>, <feTurbulence> Font elements <font>, <font-face>, <font-face-format>, <font-face-name>, <font-face-src>, <font-face-uri>, <hkern>, <vkern> Gradient elements <linearGradient>, <meshgradient>, <radialGradient>, <stop> Graphics elements <circle>, <ellipse>, <image>, <line>, <mesh>, <path>, <polygon>, <polyline>, <rect>, <text>, <use> Graphics referencing elements <mesh>, <use> Light source elements <feDistantLight>, <fePointLight>, <feSpotLight> Never-rendered elements <clipPath>, <defs>, <hatch>, <linearGradient>, <marker>, <mask>, <meshgradient>, <m...
..., <mesh>, <path>, <polygon>, <polyline>, <rect>, <text>, <use> Graphics referencing elements <mesh>, <use> Light source elements <feDistantLight>, <fePointLight>, <feSpotLight> Never-rendered elements <clipPath>, <defs>, <hatch>, <linearGradient>, <marker>, <mask>, <meshgradient>, <metadata>, <pattern>, <radialGradient>, <script>, <style>, <symbol>, <title> Paint server elements <hatch>, <linearGradient>, <meshgradient>, <pattern>, <radialGradient>, <solidcolor> Renderable elements <a>, <circle>, <ellipse>, <foreignObject>, <g>, <image>, <line>, <mesh>, <path>, <polygon>, <polyline>, <rect>, <svg>, <switch>, <symbol>, <text>, <textPath>, <tspan>, <unknown>, <use> Shape elements <circle>, <ellipse>, <line>, <mesh>, <path>, <polygon>, <polyline>, <rect> Structural elements <defs>, ...
Patterns - SVG: Scalable Vector Graphics
Web › SVG › Tutorial › Patterns
<< PreviousNext >> Patterns Patterns are arguably one of the more confusing fill types to use in SVG. They're also very powerful, so they're worth talking about and getting at least a fundamental grasp on. Like gradients, the <pattern> element should be put in the <defs> section of your SVG file. ...
...'re also very powerful, so they're worth talking about and getting at least a fundamental grasp on. Like gradients, the <pattern> element should be put in the <defs> section of your SVG file. ...
...l, so they're worth talking about and getting at least a fundamental grasp on. Like gradients, the <pattern> element should be put in the <defs> section of your SVG file. ...
... your SVG file. ...
xml:base - XML: Extensible Markup Language
Web › XML › xml:base
one exists, otherwise the base URI of the element's parent element within the document entity or external entity, if one exists, otherwise the base URI of the document entity or external entity containing the element. Support was removed from blink (Chrome and Opera) in 2015: Chromium bug 341854 blink-dev mailing list post And from Firefox 66 in bug 903372. Use cases If you have an inline SVG you use as icons that needs to work in a document with a HTML BaseElement , you can reset the URI on your icon sprite by setting the xml:base. <html> <head> <base href="https://mydomain.com"> <style> .link { stroke: #999; stroke-opacity: .6; } marker#arrow { fill: black; } </style> </head> <body> <svg width="100%" height="100%" xml:base=""> <defs> <marker id="arrow" v...
...E.g. <svg xml:base="https://foobar.s3-eu-west-1.amazonaws.com/uploads/15066845653629" width="909" height="1286" viewBox="0 0 909 1286"xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> <defs> <style type="text/css"><![CDAT...
...E.g. ...
... Work-arounds xml:base support in old browsers https://gist.github.com/leonderijke/c5cf7c5b2e424c0061d2 Specifications Specification Status Comment XML Base (Second Edition) Recommendation ...
request - Archive of obsolete content
For more advanced usage, check out the net/xhr module, based on the browser's XMLHttpRequest object. Globals Constructors Request(options) This constructor creates a request object that can be used to make network requests. The constructor takes a single parameter options which is used to set several properties on the resulting Request. Parameters options : object Optional options: Name Type url string,url This is the url to which the request will be made. Can either be a String or an instance of the SDK's URL. ...
...keep in mind that the same validation rules that apply to options in the constructor will apply during assignment. Thus, each can throw if given an invalid value. 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: " + tweet.text); } }); // Be a good consumer and check for rate limiting before doing more. Request({ url: "https://api.twitter.com/1.1/application/rate_limit_status.json", onComplete: function (response) { ...
...method of a Request object. All members of a Response object are read-only. Properties url The URL of the response content. text The content of the response as plain text. json The content of the response as a JavaScript object. The value will be null if the document cannot be processed by JSON.parse. status The HTTP response status code (e.g. 200). statusText The HTTP response status line (e.g. OK). headers The HTTP response headers represented as key/value pairs. To print all the headers you can do something like this: for (var headerName in response.headers) { console.log(headerName + " : " + response.headers[headerName]); } anonymous Boolean indicating if the request was anonymous. ...
File I/O - Archive of obsolete content
See Reading textual data details on how to read text from other character sets. // open an input stream from file var istream = Components.classes["@mozilla.org/network/file-input-stream;1"]. createInstance(Components.interfaces.nsIFileInputStream); istream.init(file, 0x01, 0444, 0); istream.QueryI...
...See Reading textual data details on how to read text from other character sets. // open an input stream from file var istream = Components.classes["@mozilla.org/network/file-input-stream;1"]. createInstance(Components.interfaces.nsIFileInputStream); istream.init(file, 0x01, 0444, 0); istream.QueryInterface...
...low does not handle text with non-ASCII characters. See Reading textual data details on how to read text from other character sets. // open an input stream from file var istream = Components.classes["@mozilla.org/network/file-input-stream;1"]. createInstance(Components.interfaces.nsIFileInputStream); istream.init(file, 0x01, 0444, 0); istream.QueryInterface(Components.interfaces.nsILineInputStream); // read lines into array var line = {}, lines = [], hasmore; do { hasmore = istream.readLine(line); lines.push(line.value); } while(hasmore); istream.close(); // do something with read data alert(lines); Reading a Binary File For instance, to get the data in a PNG file: var ios = Components.classes["@mozilla.org/network/io-service;1"]. getService(Components.inter...
StringView - Archive of obsolete content
nUint6 < 62 ? nUint6 - 4 : nUint6 === 62 ? 43 : nUint6 === 63 ? ...
...nUint6 === 62 ? 43 : nUint6 === 63 ? ...
...lar expression objects... */ function CLikeRegExp (sRegExp, sFlags) { /** * [...] * * CONSTRUCTOR CODE HERE! **/ } /* A "replace" method for StringView... */ StringView.prototype.replace = function (oCLikeRegExp, sWith) { /** * [...] * * METHOD CODE HERE! **/ }; If you want to create a stringView inside a bigger empty buffer, like in the following C line /* myBuffer: 12 character followed by 1012 NULLs... */ char myBuffer[1024] = "Hello world!"; you should do something like this: var myBuffer = new StringView(1024); /* myBuffer: 12 character followed by 1012 NULLs... */ var myContent = new StringView("Hello world!"); myBuffer.rawData.set(myContent.rawData, myContent.rawData.length); StringView is a constructor and a collection of method...
View Source for XUL Applications - Archive of obsolete content
the document to view the source of. browser (optional) The browser containing the document that we would like to view the source of. This is optional if outerWindowID is not passed. outerWindowID (optional) The outerWindowID of the content window containing the document that we want to view the source of. Pass this if you want to attempt to load the document source out of the network cache. lineNumber (optional) The line number to focus on once the source has loaded. Deprecated API This API is likely to go away in the future, and should no longer be used. The viewSource method will also accept the following arguments in place of the Object: aURL A string URL for the document to view the source of. aPageDescriptor (optional) A "descriptor" that allows the source to be retrie...
... ...
... ...
How to convert an overlay extension to restartless - Archive of obsolete content
tents, not any loaded script/data). Step 2a: Load your JSM from chrome:// Now with that preface out of the way, this part is easy: drop support for Firefox 3.x if you haven't already, move your JSM files to wherever you've got your chrome mapping to for your XUL overlay and/or windows, import your files from that new chrome mapped path instead of the old resource one, and remove your "resource" line from your chrome.manifest file. It's probably a good idea to do this even if you aren't going fully restartless / extractionless due to the previously mentioned exposure to content of resource mappings. Also, drop support for Firefox 4 through 9 while you're at it. Prior to Firefox 10, the chrome.manifest file you rely on wasn't loaded automatically for restartless add-ons. Hacks were required, ...
...I'd g...
...I'd generally still recommend using the type specific functions for each pref individually, but to load the defaults just use the generic functions above and it's quite simple. The other generic functions are provided above in case you need them. ...
Appendix: What you should know about open-source software licenses - Archive of obsolete content
ou want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software that everyone can redistribute and change under these terms. To do so, attach the following notices to the program. ...
... the best way to achieve this is to make it free software that everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. <one line to give the program's name and a brief idea of what it does.> Copyright (C) <year> <name of author> This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that...
...tml Creative Commons http://www.creativecommons.cc/ GNU GPLv3 Second Discussion Draft http://gplv3.fsf.org/gpl-draft-2006-07-27.html GNU GPLv3 Third Discussion Draft http://gplv3.fsf.org/gpl-draft-2007-03-28.html GNU GPLv3 "Last Call" Discussion Draft http://gplv3.fsf.org/gpl-draft-2007-05-31.html Official support for OSS Japan's Ministry of Economy, Trade, and Industry has issued "Guidelines when Considering Deploying Open-Source Software." This report, which was prepared by the Software Information Center study group as part of the Information-Technology Promotion Agency's (IPA) "Platform-technology development and businesses relating to electronic commerce" project. This report is available online (in Japanese) at http://www.meti.go.jp/kohosys/press/0004397/ The IPA has also est...
Chapter 4: Using XPCOM—Implementing advanced processes - Archive of obsolete content
unctions. Internet Explorer handles this using ActiveX; in Firefox, we use the Cross-Platform Component Object Model, or XPCOM. Due to deprecation of enablePrivilege this functionality can not be used in web pages. EnablePrivilege is disabled in Firefox 15 and will be removed in Firefox 17. About XPCOM XPCOM is a framework for developing platform-independent components. Components developed in line with that framework are referred to as XPCOM components, and sometimes the components are simply referred to as XPCOMs. Firefox itself includes a great number of XPCOM components, and they can be used in extensions as well. Sometimes an extension will be packaged with a special XPCOM component developed specifically for it. Note: If you're developing components in C++ or other compiled language...
...n order to set UniversalXPConnect privileges, you need to run the code in Listing 2. Listing 2: Setting privileges netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect'); Note: This is unneeded when the code is part of an extension, and will result in rejection if submitted to addons.mozilla.org. Permit by dialog Try adding the contents of Listing 2 to test.xul, before the line var ioService = ..., and re-open it in Firefox. You should now see the confirmation dialog shown in Figure 1. Pressing the "Permit" button grants UniversalXPConnect permission in this execution context, making it possible to run XPConnect temporarily. An XPConnect-wrapped nsIIOService message should appear. If you check "apply these privileges in the future", all local files will be able to run ...
... Note that Firefox itself and its extensions have privileges set by default after installation and registration. Extensions don't need special code like that in Listing 2 in order to get privileges. FIXME: We should advise against using such method FIXME: Figure 1: Dialog requesting privileges Listing 3: Grant privileges without manual confirmation f...
Appendix D: Loading Scripts - Archive of obsolete content
HttpRequest. This is the method used by Jetpack's securable module system to load nearly all executable code. Advantages Namespacing: Since scripts executed via evalInSandbox run in a defined namespace, global namespace contamination and the resultant extension compatibility issues are not usually a problem. Flexibility: The evalInSandbox method accepts several parameters, including the URL, line number, and JavaScript version of the file from which the code being evaluated was extracted. This information is invaluable for debugging, and the flexibility with which it can be specified makes this method useful for extracting JavaScript from a number of file formats other than raw JavaScript scripts. Additionally, as Sandbox objects can be created with an arbitrary prototype object, the eval...
...uation in development tools is uneven. Chromebug supports Firebug based Sandboxes. Examples The following code will execute a simple script in a Sandbox with the privilege level of the current content page. The globals of the current content window will be available in the scripts global scope. In stack traces, the script will appear to have been loaded from the file "zz-9://plural/zed/alpha", line 42. // Use the current content window as the execution context. // To make properties defined by scripts executing on the page // available to your sandbox script, use content.wrappedJSObject // instead. let context = content; // Create the Sandbox let sandbox = Components.utils.Sandbox(context, { // Make properties of the context object available via the // script's global scope sa...
...The script will execute in the same security context as the current script and will have access to the same globals, but any new globals it creates will be accessible only to the script itself. Objects passed out of the sandbox will no...
Custom XUL Elements with XBL - Archive of obsolete content
container for binding elements. Notice how the default namespace for the document is XBL, and the XUL namespace is defined as "xul". You'll need to keep this in mind when defining the content of the binding, because weird things can happen if you don't add "xul:" to your content nodes. <binding id="person"> In general, you should only have one binding per file. Bindings tend to require many lines of code, and having more than one ends up making gigantic, unbrowsable files. On the other hand, if your bindings are small and have a strong relationship with each other, it makes sense to keep them together. As for the CSS file, it's usually good to have a single file declaring all bindings in your extension. Content Under the content tag you define the XUL content that will be displayed for...
...Here are a couple of important things to notice: The "xul:" namespace must be used for all XUL tags you have in your content. The xbl:inherits attribute lets your inner XUL use the attributes that are set on the node. So, if you have this: <xshelloperson name="Pete" greeting="Good morning" image="" />, then those attribute values are "inherited" to the content nodes that have t...
...rties defined in our binding, which are just meant for easier access to the two text attributes in the element. We use the shorthand version of the property tag: <property name="name" onget="return this.getAttribute('name');" onset="this.setAttribute('name', val);" /> There's a less compact version of the property tag that should be used if the getter or setter code involves more than one line of code: <property name="name"> <getter><![CDATA[ return this.getAttribute('name'); ]]></getter> <setter><![CDATA[ this.setAttribute('name', val); ]]></setter> </property> Properties can be accessed just the same as fields, and they're the ones we prefer for public members. When you add a node to a XUL document using an XBL binding, all normal DOM operations can be perfor...
JavaScript Object Management - Archive of obsolete content
reference for this which we always name that. This is all necessary due to a JavaScript feature (quirk would be a better word for it) called Method Binding. The consequence of doing this wrong is to have a this reference that doesn't do what you expected it to do. There are a few workarounds for this, and we use the ones we have found to be the most elegant and clear to read. The general guideline we follow is this: whenever you have to set a callback function parameter, wrap it in an anonymous function. That is, something like function() { /* your code, usually a single function call. */ }. If you have to use a reference to this inside the function, declare a variable called that that equals this, and use that in the anonymous function. JavaScript has a host of features that make it ex...
...e from the outside will be <ModuleNamespace>, which is a namespace in our case. Because of namespacing, we don't need to worry much about what to export, usually we just need the namespace object. All of the objects inside of it are exported as well, since they are members of the <ModuleNamespace> object. Module files can be imported to a chrome script or to other code modules with the following line: Components.utils.import("resource://xulschoolhello/messageCount.js"); When using Components.utils.import, code modules must be loaded using a file: or resource: URL pointing to a file on the disk. In particular, chrome: URLs (even those that point to a file outside a jar archive) are not valid. To get a better idea, let's look at the code of the modified Hello World example. We have defi...
...ed them now. It's better to just make a habit out of it. This is a point that is worth highlighting: modules work outside of the window scope. Unlike scripts in the chrome, modules don't have access to objects such as window, document, or other global functions, such as openUILink. These are all UI components and UI operations anyway, so they are better done in the chrome. As a general guideline, we keep all of our business logic in JSM, available through service objects, and chrome scripts are limited to handle presentation logic. We handle most of our code through static objects, singleton objects that don't require instantiation. But it is sometimes necessary to define classes and be able to create multiple instances. Common cases include interacting with a local database or a remo...
Mozilla Documentation Roadmap - Archive of obsolete content
Knowing where to look is critical and non trivial. This tutorial was aimed at compiling all the right resources for extension development and putting them in the right context, but there's much more to learn, and knowing how to find it is part of what we felt was necessary to teach. ...
...s part of what we felt was necessary to teach. Let's look into the resources that have helped us the most. The Mozilla Developer Center This is the official and most extensive guide to everything related to Mozilla. MDC is where this tutorial is hosted, and where most of its links point to. It encompasses Firefox, other Mozilla products, Javascript, CSS, XUL, web and extension development guidelines, accessibility, usability, best practices... The list goes on. It's incredibly comprehensive, and its underlying Wiki technology makes it easy to expand and evolve with the help of the community. Having said that, there are a few problems with it. First of all, the in-site search is not reliable, so we recommend using a search engine like Google, with queries such as "MDC Javascript Code Module...
...in index in this page gives you options to look into the different product branches in development at Mozilla. Make sure you pick the one that matches your target versions. All of these provide advanced search capabilities, including regular expression search and file path search. You'll be able to navigate the full source tree, inspect the change history for all files, and link to specific code lines. It takes a little getting used to, specially learning how to choose the best search queries, but it's an invaluable resource of information. Mozilla Blogs Several Mozilla community members maintain blogs that are updated frequently, often including information on API changes, bug fixes, useful tools and future release plans. Many of the tips and tricks included in this tutorial were discovere...
Creating a status bar extension - Archive of obsolete content
addon type. For extensions, this is 2. Human-readable information In this sample, we have four pieces of human-readable information; that is, information that is displayed to the user within the Firefox interface. These are: Property name Description em:name The extension's name. This name is displayed in the Extensions window. em:description A short, one-line description of the extension. This text is also displayed in the Extensions window. em:creator The author's name. homepageURL The URL of a web site the user can visit to get information about the extension, or to look for updates. This is not a required field, but including it is a nice thing to do. Target application information It's also necessary to include inform...
...he chrome is the set of user interface elements outside the content area of the application's window, such as toolbars, status bars, menu bars, and the like. The chrome manifest file, chrome.manifest, for the sample follows. content status-bar-sample-1 chrome/content/ # Firefox overlay chrome://browser/content/browser.xul chrome://status-bar-sample-1/content/status-bar-sample-1.xul The first line registers the location on disk of the contents of the extension whose ID is "status-bar-sample-1". This path is relative to the extension's root folder in this case, but can be absolute if you want it to be. The second line registers an overlay. An overlay lets you add new content to an existing document. In this case, we want to augment the UI of the Firefox browser, so we specify the URI of the...
...s.only.xul"> <!-- Firefox --> <statusbar id="status-bar"> <statusbarpanel id="status-bar-sample-1" label="Hello World" tooltiptext="Sample status bar item" /> </statusbar> </overlay> The first order of business in the status-bar-sample-1.xul file is to establish that this is in fact a XUL file, and to set up a unique ID for the overlay. This is accomplished by the following line of XML: <overlay id="status-bar-sample-1-overlay" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> Once that's accomplished, we can describe our user interface. In this case, we're simply inserting a new panel into the status bar at the bottom of Firefox browser windows. We do this by embedding inside the statusbar named "status-bar" -- which is the Firefox browser window...
Source code directories overview - Archive of obsolete content
g supported. extensions contains C interfaces, C code, XUL and Javascript code for various add-ins that are related to browsing. These include: cookies, IRC, wallet, DOM Inspector, P3P, schema validation, spellchecker, transformiix, typeaheadfind, JavaScript debugger, XForms, etc. gfx contains C interfaces and code for platform independent drawing and imaging. It can be used to draw rectangles, lines, images, etc. Essentially, it is a a set of interfaces for a platform-independent device (drawing) context. It does not handle widgets or specific drawing routines; it just provides the primitive operations for drawing. intl contains C interfaces and code for supporting localization. It contains code for various character sets, locale formats (e.g. the format of the date and time for different ...
...d other files for embedding Mozilla in other programs on various different platforms in various different ways (e.g. as plug-in, as ActiveX component, as XPCOM classes). widget contains C interfaces and code for platform independent controls (widgets), such as scroll bars, radio buttons and list boxes. xpcom contains the low-level C interfaces, C code, C code, a bit of assembly code and command line tools for implementing the basic machinery of XPCOM components (which stands for "Cross Platform Component Object Model"). XPCOM is the mechanism that allows Mozilla to export interfaces and have them automatically available to JavaScript scripts, to Microsoft COM and to regular Mozilla C code. Some low-level XPCOM classes and interfaces are also defined here (e.g. the event loop for all platform...
...marks, preferences, migration, sidebar.. configcontains build scripts for Firefox. extensions contains code for making certain extensions work. installer contains the Firefox installer code. locales contains the files that are translated for Firefox. themes contains Firefox themes. Toolkit Toolkit is used by the standalone products. components contains the alerts, autocomplete, command line interface, console, cookies, download manager, filepicker, history, password manager, typeaheadfind, view source, etc. content contains XUL specific to the toolkit. library contains libXUL work. localescontains files that are translated. mozappscontains shared application stuff. obsoletecontains obsolete stuff. profilecontains the profile manager themescontains themes as they relate to too...
Making it into a static overlay - Archive of obsolete content
After that is a XUL overlay element. This element is the top-level element in a XUL overlay file and serves to identify the...
...After that is a XUL overlay element. This element is the top-level element in a XUL overlay file and serves to identify the file as an overlay. ...
... << PreviousNext >> ...
Dehydra Object Reference - Archive of obsolete content
Introduction Dehydra represents C++ types and variables as JavaScript objects. The objects are designed to distill that type system to the minimum such that it can be easy to match on. Often, the best way to become familiar with the Dehydra objects is to print out the objects: Dehydra example code an online tool for pretty-printing dehydra data Understanding Properties Dehydra only sets properties that are applicable. For example, class types and typedefs are declared and will have a .loc property. Intrinsic types such as "int" are not declared and will not have a .loc. Dehydra only sets boolean flags when they are true. For example, a pointer type will have .isPointer == true, but a class type will not have an .isPointer property. Common Properties Property Type Description ...
...late Objects Property Type Description .name string the name of the template, for example "nsCOMPtr". ...
...r example "nsCOMPtr". .arguments array an array where arguments are either strings representing C++ constants or type objects. ...
Creating a Help Content Pack - Archive of obsolete content
nts, index, and glossary (also written in RDF). You can create a content packs which inherit from existing Mozilla Help content packs. The Contents of a Content Pack Content Packs consist of a general pack description file, table of contents, index, search, glossary, and help documents. The help documents are written in XHTML, and the rest are written in RDF. The content pack descriptor file outlines the framework of the contents of the pack by pointing to the files describing the table of contents, index, and glossary RDF files. The table of contents and index files are simple tree-based outlines written in RDF. The glossary file is written in RDF and consists of a simple list of terms with corresponding URLs to the term definition. Creating a Content Pack The Content Pack Descriptor File...
...="unix-toc.rdf"/> </rdf:li> There's one final element to add inside rdf:Seq to complete the content pack descriptor file: an element to describe the Help Viewer's search function. Search automatically goes through all of the elements in the table of contents, index, and glossary, but you might wish to have Search go through more sources of data. One possible source might be an online, dynamically-generated list of added content stored on your web site. To have the Help Viewer search through these additional data sources, define another rdf:li element like so: <rdf:li> <rdf:Description nc:panelid="search" nc:datasources="" nc:emptysearchtext="[No matching items found.
... separate entries will require a slightly longer time to load. The Glossary File The glossary file has the simplest format of all the data sources you'll need because there's only one level of content. (The index, table of contents, and search data sources are more likely to be nested, complicating their formats.) Create a new RDF file (for now let's name it glossary.rdf), and add the following lines to it: <?xml version="1.0"?> <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:nc="http://home.netscape.com/NC-rdf#"> <rdf:Description rdf:about="urn:root"> <nc:subheadings> <rdf:Seq> </rdf:Seq> <nc:subheadings> </rdf:Description> </rdf:RDF> This forms the outer framework of a glossary description file. To add data to it, add one of t...
Nanojit - Archive of obsolete content
es on the way from raw source code to machine code. An application using Nanojit creates a nanojit::LirBuffer object to hold LIR instructions. It creates a nanojit::LirBufWriter object to write instructions to the buffer. Then it wraps the LirBufWriter in zero or more other LirWriter objects, all of which implement the same interface as LirBufWriter. This chain of LirWriter objects forms a pipeline for the instructions to pass through. Each LirWriter can perform an optimization or other task on the program as it passes through the system and into the LirBuffer. Once the instructions are in the LirBuffer, the application calls nanojit::compile() to produce machine code, which is stored in a nanojit::Fragment. Internally to Nanojit, another set of filters operates on the LIR as it passes fr...
...loc verbose_only(, fragmento->labels)); if (assm->error() != None) { fprintf(stderr, "error compiling fragment\n"); return 1; } printf("Compilation successful.\n"); // Call the compiled function. typedef JS_FASTCALL int32_t (*AddTwoFn)(int32_t); AddTwoFn fn = reinterpret_cast<AddTwoFn>(f->code()); printf("2 + 5 = %d\n", fn(5)); return 0; } Code Explanation Interesting part are the lines 46-50: // Write a few LIR instructions to the buffer: add the first parameter // to the constant 2. out.ins0(LIR_start); LIns *two = out.insImm(2); LIns *firstParam = out.insParam(0, 0); LIns *result = out.ins2(LIR_add, firstParam, two); out.ins1(LIR_ret, result); Basically, what the code provided above is doing is feeding raw LIR into the LIR Buffer, using the LIRWriter's writer object. ...
...am = out.insParam(0, 0); LIns *result = out.ins2(LIR_add, firstParam, two); out.ins1(LIR_ret, result); Basically, what the code provided above is doing is feeding raw LIR into the LIR Buffer, using the LIRWriter's writer object. From an operational point of view, it is creating a function, which takes an integer input, and adds it to two, and outputs the result. The function is created here on lines 57-69: // Compile the fragment. compile(assm, f, *alloc verbose_only(, fragmento->labels)); if (assm->error() != None) { fprintf(stderr, "error compiling fragment\n"); return 1; } printf("Compilation successful.\n"); // Call the compiled function. typedef JS_FASTCALL int32_t (*AddTwoFn)(int32_t); AddTwoFn fn = reinterpret_cast<addtwofn>(f->code()); printf("2 + 5 = %d...
Proxy UI - Archive of obsolete content
Products Firefox Menu: Preferences > Advanced Tab > Networking tab > Connection button. Thunderbird Menu: Preferences > Advanced Tab > Networking tab > Connection button. Seamonkey Menu: Preferences > Advanced group > Proxies panel Menu: right-click on Offline-online button (on browser windows). Camino Configured in OS (Networking Preferences) (Recently Added - some support for reading OS and account settings.)UI Elements Preferences Panel Overview The UI is based on selecting a proxy mode, then filling out any additional needed information in "related" UI. The "OK" button saves the preferences. The preference changes Selecting the proxy "mode" All product's Proxy preference panels share a basic design: a radio button that selects the proxy mode, then "related proxy mode" UI ...
...ocols), then use SOCKS. The socks version is selected by radio buttons: ( ) SOCKS v4 ( ) SOCKS v5 "No proxy for:" Discussed in detail elsewhere... but should be noted that if you cut and paste from IE, the semi-colons are automatically converted to commas when you save changes (FF, TB, SM). Automatic proxy configuration URL Supports a URL (which is checked via URIfixup) and a reload button. Offline|Online "plug" Location Status bar on the right side. Right-click A menu is displayed that has the following items: Online (Proxy: None) Online (Proxy: Auto Discover) Online (Proxy: Auto URL) Online (Proxy: Manual) --- Proxy Configuration... <h7 name="Details">Details</h7> The menu should display the current proxy mode with a dot. The modes that can have an empty configuration (Auto URL and Manual...
...(Auto URL and Manual) will be disabled if the prefs are blank. ...
Tamarin build documentation - Archive of obsolete content
g.mozilla.org/tamarin-central tamarin-central Tips for working with Mercurial can be found here. Building Tamarin Building Tamarin will create all the libraries for the AVMPlus and garbage collector (MMgc), and create a standalone executable (shell) for executing files in the ABC file format. Running the shell without any arguments will list the available options. Note that additional command-line arguments are only available in the debug configuration. The Tamarin codebase contains a cross-platform build system for Mozilla developers. The cross-platform build system is used for daily automated build testing so it is the most reliable system. The Tamarin codebase has the ability to build additional code which supports debugging hooks. In the XCode project, this is the Debug_Debugger and ...
....8r.tar (openssl-1.0.0c.tar.gz won't work) openssl files from http://www.openssl.org (use the Source link on the left). Unzip the file and put the /openssl main folder under your sdk/ndk top folder. Make sure its name is just "openssl". Then build as follows: - Replace the Makefile in the main folder with the one attached to this page. - Change the variable ANDROID_DEVICE in the makefile (near line 65) to point to your sdk/ndk top folder. - Find the two instances of "android-ndk" and make sure they match your ndk's name (they should already). - In a terminal window change to your /openssl folder and run make build_libs to create the necessary 'libcrypto.a' and 'libssl.a' static libraries. Alternatively, run make, in which case the process will complete with errors when it tries to create...
...oolchain (installed with Xcode 3.x). 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. As some Tamarin source files have more than the Eclipse standard threshold of 5000, they do not appear as indexed. The threshold can be adjusted in Eclipse preferences >> C/C++ >> Editor >> Scalability. *IMPORTANT* Project-specific settings for the CDT Indexer do not appear to work (it looks like a bug in Eclipse), so you have to set these manually/globally. What we want is to have the indexe...
Tamarin Build System Documentation - Archive of obsolete content
g performance). The smoke test list is constantly updated to contain the most recent failures, most frequent failures, and the newest testcases. The idea is to catch test failures in a few minutes rather than running the complete test run (1h 45m). The smoke test including downloading the shell takes about 3-4 minutes. The Test phase runs all functional testcases including acceptance tests, cmdline tests, and selftests. The acceptance tests are the majority and are run on all shells (release, release-debugger, debug, debug-debugger). The test phase takes approximately 1 hour 45 minutes. The Performance and Deep phases do not run synchronously. The phases run when slaves are available and the other phases do not wait for completion to start the next build. How are builds triggered? ch...
... The buildbot scripts are located in the tamarin repository, get a current copy in your test repository cd into the build/buildbot/slaves directory: cd build/buildbot/slaves copy the your platform scripts directory into the scripts directory and cd into the new scripts directory: cp -r mac-intel-10_5/scripts . ...
...nt copy in your test repository cd into the build/buildbot/slaves directory: cd build/buildbot/slaves copy the your platform scripts directory into the scripts directory and cd into the new scripts directory: cp -r mac-intel-10_5/scripts . ...
accesskey - Archive of obsolete content
, checkbox, caption, description, label, listitem, menu, menuitem, menulist, tab, radio, toolbarbutton, textbox accesskey Type: character This should be set to a character that is used as a shortcut key. This should be one of the characters that appears in the label attribute for the element. ...
... *(These are the keys corresponding to event.ctrlKey and event.metaKey respectively when listening to key events) Although the value is case insensitive, a letter with the case matching the accesskey attribute will be used if both cases exist in the label. ...
... *(These are the keys corresponding to event.ctrlKey and event.metaKey respectively when listening to key events) Although the value is case insensitive, a letter with the case matching the accesskey attribute will be used if both cases exist in the label. Otherwise, if the label has two or more characters which are same as its accesskey, the first of those characters in the label will be underlined. If a label doesn't have the specified character, the character will be appended to the label with parentheses. For example, when an accesskey of an 'Open' label is 'A', the generated label will be 'Open (A)'. However, if the last character of the label is an ellipsis or a colon, the accesskey text is inserted before them. This allows a label of 'Open...' with an accesskey of 'A', to have a ge...
Menus - Archive of obsolete content
ild of the menu. The menu can also be opened by using the keyboard. The user can press a key to highlight the menu labels and navigate with the cursor keys. The key is different for each platform; on Windows F10 can be used. Another way is to add shortcut keys called access keys for each menu element to make it easier to access the menu commands. On some platforms, adding an access key will underline a letter in the menu label indicating the key to press. For this reason, the access key should always correspond to a character that appears in the menu label. To set an access key for a menu, use the accesskey attribute, as in the example below. <menu label="File" accesskey="F"/> This menu can then be opened by pressing the access key (typically in combination with the Alt key). Naturally, ...
...urally, the access keys should be unique on a menubar. So if you wanted to have a menu with the label Find, you would need to set a different access key. <menubar> <menu label="File" accesskey="F"/> <menu label="Find" accesskey="d"/> </menubar> Here, the 'File' menu has the 'F' access key, and the 'Find' menu has the 'd' access key. Although the access keys are not case sensitive, the underlined letter will always be the one with matching case if available. For instance, an access key of 'W' will match the first letter in a menu label of 'Window', but the access key of 'w' will match the last letter. It is good practise to always use the same case when setting access keys. The menuitem element The menuitem element is used for each item that appears on a menu popup. As with the menu el...
...technique is to place the menubar in an overlay and apply it to all of the windows. This allows the menu bar to be shared between each window without having to duplicate code. This technique may be used for individual menus or for an entire menu bar. For example, to have a Tools menu that is shared between all windows, just create a menu in the overlay, and include it in each window with a single line: <menu id="menu-tools"/> The overlay should have a menu with the same id 'menu-tools' containing the complete definition of the 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. For example, to have an item initially hidden in a window: function initMenus() { var item = document.getElementById("menu-fil...
XML Templates - Archive of obsolete content
butes are substituted here, the label on the button and the value on the label. The query does not have to be as simple as the one used here. Any XPath expression may be used. For instance, the following query returns only those results for female people. <query expr="person[@gender='female']"/> As long as the expression returns one or more nodes, it can be used in an query expression. Using Inline XML It's also possible to embed the XML data directly within the XUL document if desired. Instead of using a URL for the datasources attribute, you can use an anchor reference to refer to a node within the same document. The effect is the same, but the data isn't stored in a separate file. <people id="famouspeople" xmlns=""> <person name="Napoleon Bonaparte" gender="male"/> <person name="Cle...
...xml"> <template> <query expr="person"/> <action> <listitem uri="?" label="?name"/> </action> </template> </listbox> Here, an anchor reference, starting with a number sign (#) is used for the datasources attribute. It refers to an element with that id (without the number sign) and uses that node as the source XML node instead of a separate file. Otherwise the data included inline and the template are the same. Note the only change is that the addition of the xmlns attribute on the data; this is used to clear the namespace used for the elements in the data, otherwise they become XUL elements. You can also specify a namespace. If so, you will need to ensure that prefixes are defined within the template as well, so that they can be used in the XPath expressions. The namespac...
...therwise they become XUL elements. You can also specify a namespace. If so, you will need to ensure that prefixes are defined within the template as well, so that they can be used in the XPath expressions. The namespace prefixes that may be used in an XPath expression are those that are defined on the query or assign element where the expression is used. Be aware that when XML data is included inline as in this example, the content may be displayed and may affect the layout of other parts of the window. You may wish to hide the inline XML by placing it inside a hidden box. << PreviousNext >> ...
Complete - Archive of obsolete content
about developing extensions. Introduction You can use the Custom Toolbar Button tutorial as a very simple introduction to extensions. However, because it is so simple it does not support some of the usual features of extensions. This page describes how to structure the extension in a more conventional way. This page is not a step-by-step tutorial. Instead it explains the missing features, and outlines how to add them. If you want to see these techniques in action, then you can download and install the complete AllCustom extension: allcustom.xpi (The link is external only because this wiki does not support XPI files.) The extension does not contain any useful functions. It is just an extended code sample. To see the code, use a jar tool or zip tool to unpack the XPI file that you downloaded. ...
...RL: chrome://allcustom/locale/install.properties Again, the application's chrome registry converts this URL to the correct file for the locale you are using. For example, if your locale is fr-FR, it gets the description from: locale/fr-FR/allcustom/install.properties Testing a locale To test the alternative locale, install the extension in the normal way. Restart the application using the command line switch: -uiLocale fr-FR (Of course, if your application is already in French, specify en-US here to switch the extension to English.) Notes: If you use a shortcut or launcher icon to start the application, then you can add the command line switch by editing the icon's properties. The application's user interface only switches language if you have the appropriate language pack installed. But ...
...s. The application's user interface only switches language if you have the appropriate language pack installed. But this extension switches between English and French without needing any language pack. Some versions of Firefox etc. have a bug that prevents this from working. To work around the bug, close the application, delete the file XUL.mfl in its profile, then restart it with the command line switch. Firefox etc. support specifying the language alone, without any region--for example, just: -uiLocale fr SeaMonkey does not support this. Themes A theme changes the appearance of the user interface, affecting fonts, colours, graphics, and sometimes layout. A theme consists of a skin for each component. This extension is just one component, allcustom, so it contains a skin for this compo...
Creating a Skin - Archive of obsolete content
(If you are using Firefox 1.5 or later, see Manifest Files instead of below) Create a directory somewhere where you want to place the skin files. Copy a manifest file (contents.rdf) from the Classic or Modern skin into this new directory. Modify the references in the manifest file to a custom name for your skin. For example, change references of 'classic/1.0' to 'blueswayedshoes/1.0'. Add a line to the file 'chrome/installed-chrome.txt of the following form: skin,install,url,file:///stuff/blueswayedshoes/ where the last part points to the directory you created. Make sure to add a slash at the end. Copy the original findfile.css into the new directory. We'll use this as a basis for the new skin. We can then refer to it using the URL 'chrome://findfile/skin/findfile.css'. Adding Style R...
... <vbox class="findfilesbox" orient="vertical" flex="100%"> <toolbox> Rounding on the Tabs Next, let's modify the tabs. We will make the selected tab bold and change the rounding on the tabs. tab:first-child { -moz-border-radius: 4px 0px 0px 0px; } tab:last-child { -moz-border-radius: 0px 4px 0px 0px; } tab[selected="true"] { color: #000066; font-weight: bold; text-decoration: underline; } Two rules change the normal tab appearance, the first sets the rounding on the first tab and the second sets the rounding on the last tab. Used here is a special Mozilla style rule, -moz-border-radius, that creates rounded border corners. The upper left border of the first tab and the upper right border of the second tab are rounded by four pixels and the other corners have a round corner ...
...tab and the upper right border of the second tab are rounded by four pixels and the other corners have a round corner of zero pixels, which is equivalent to no rounding. Increase the values here for more rounding and decrease them for a more rectangular look. The last rule only applies to tabs that have their selected attribute set to true. It makes the text in the selected tab appear bold, underlined and dark blue. Note in the image that this style has applied only to the first tab, because it's the selected one. Adding Toolbar Icons It is somewhat difficult to distinguish the buttons on the toolbar from the commands on the menu. We could add some icons to the buttons to make them clearer. Mozilla Composer provides some icons for open and save buttons, which we'll just use here to save tim...
XPCOM Interfaces - Archive of obsolete content
inally, an instance is created with the createInstance() function. You should check the return value of createInstance() to ensure that it is not null, which would indicate that the component does not exist. However, at this point, we only have a reference to the file component itself. In order to call the functions of it we need to get one of its interfaces, in this case nsILocalFile. A second line of code needs to be added as follows: var aFile = Components.classes["@mozilla.org/file/local;1"].createInstance(); if (aFile) aFile.QueryInterface(Components.interfaces.nsILocalFile); The function QueryInterface() is a function provided by all components which can be used to get a specific interface of that component. This function takes one parameter, the interface that you want to get. The ...
... function takes one parameter, the interface that you want to get. The interfaces property of the Components object contains a list of all the interfaces that are available. Here, we use the nsILocalFile interface and pass it as a parameter to QueryInterface(). The result is that aFile will be a reference to the part of the component that implements the nsILocalFile interface. The two JavaScript lines above can be used to get any interface of any component. Just replace the component name with the name of the component you want to use and change the interface name. You can also use any variable names of course. For example, to get a sound interface, you can do the following: var sound = Components.classes["@mozilla.org/sound;1"].createInstance(); if (sound) sound.QueryInterface(Components.in...
...nt the same interface. Typically, they might be subclasses of the original but not necessarily. Any component may implement the functionality of nsILocalFile. In addition, a component may implement several interfaces. It is for these reasons that two steps are involved in getting an interface to call functions through. However, there is a shortcut we can use because we'll often use both of these lines together: var aLocalFile = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile); This will do the same thing as the two lines but in one line of code. It eliminates the need to create the instance and then query it for an interface in two separate steps. If you call QueryInterface() on an object and the requested interface is not supported by an ...
XUL Structure - Archive of obsolete content
tory, although extensions are installed in the extensions directory for a particular user. Just copying a XUL file into the chrome directory doesn't give the file any extra permissions, nor can it be accessed via a chrome URL. To gain the extra privileges, you will need to create a manifest file and put that in the chrome directory. This file is easy to create, as it is typically only a couple of lines long. It is used to map a chrome URL to a file or directory path on the disk where the XUL files are located. Details of how to create this file will be discussed in a later section. The only way to create content that can be accessed through a chrome URL is by creating a package as described in the next few sections. This directory is called 'chrome' probably because it seemed like a convenien...
...eate content that can be accessed through a chrome URL is by creating a package as described in the next few sections. This directory is called 'chrome' probably because it seemed like a convenient name to use in keeping with the chrome packages that are included with Mozilla. To further the confusion, there are two other places where the word "chrome" might appear. These are the -chrome command line argument and the chrome modifier to the window.open() function. Neither of these features grant extra privileges; instead they are used to open a new top-level window without the browser UI such as the menu and toolbar. You will commonly use this feature in more complex XUL applications since you wouldn't want the browser UI to exist around your dialog boxes. The files for a package are usually ...
... this, the XUL will be not be reloaded even when the source files are changed. To disable this mechanism, it is necessary to change the preference nglayout.debug.disable_xul_cache. In Firefox, this preference may be added to the user preferences by typing "about:config" in the address field, and setting this value to true. Or, just manually edit your user.js preferences file and add the following line: pref("nglayout.debug.disable_xul_cache", true); There are usually three different parts to a chrome package, although they are all optional. Each part is stored in a different directory. These three sets are the content, the skin, and the locale, which are all described below. A particular package might provide one or more skins and locales, but a user can replace them with their own. In addi...
Using Remote XUL - Archive of obsolete content
Knowledge of XML and its syntax is useful but not required. You also need a text editor and a web browser that can render XUL, like Mozilla, or Firefox. If you build a XUL file along with this tutorial and put it onto a web server, you need to configure your web server to specify the content type of XUL files as application/vnd.mozilla.xul+xml. For Apache, you can do this by adding the following line to your mime.types file: application/vnd.mozilla.xul+xml .xul Alternately, add this line to your httpd.conf file or, if the Apache server is configured to allow it, to the .htaccess file in the directory from which the XUL file is served: AddType application/vnd.mozilla.xul+xml .xul Then restart your web server. With PHP you can send the mime-type with the header() function. <?php header...
...he document you create on your computer via a "file" URL or the "Open File" function of your browser. Step 1: a basic XUL document The first thing we need to do is create a basic XUL document. <?xml version="1.0"?> <window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" /> A XUL document requires only two entities to be valid, an XML processing instruction on the first line that identifies the file as XML, and a window element that defines a XUL application window (or in this case web page). The processing instruction is required because XUL is an XML-based language, and this instruction tells browsers how to parse the document. The window element is the root (outermost) element in a XUL document and encompasses all other elements. It is analogous to the <html> ele...
...g"> <menupopup> <menuitem label="Download" value="https://www.mozilla.org/releases/" /> <menuitem label="Report a Bug" value="https://bugzilla.mozilla.org/enter_bug.cgi?format=guided" /> <menuitem label="Bugzilla" 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;..." /...
Writing Skinnable XUL and CSS - Archive of obsolete content
Mozilla can have any number of installed UI packages, from Navigator to Sidebar to Editor. Each package has its own skin, CSS files and images that determine the appearance of that package. In our particular Mozilla skin, there is a special package calledglobal. This package contains a special skin called theglobal skin. If you wish for your package to blend in with the other packages, then the skin for your package should inherit information from the global skin in order to reduce the amount of duplication across packages and in order to make the UI as a whole easier to skin. ...
...fter all, that's what I meant anyway. Never use an attribute selector rule for the class attribute. This is inefficient and you should just use the class notation (the dot notation) instead. Writing Skinnable XUL A XUL file that describes a window always imports the master skin file for its package. For example, all XUL files that describe windows in the Navigator package should contain a line explicitly importing navigator.css. XUL overlays, however, should not, since they will be used in the context of other skins. A XUL file NEVER imports skin files from outside its package. It is a flagrant and hideous violation (punishable by a public flogging in front of the Netscape fountain) to load a skin file from XUL that is not found in your package. For example, a Navigator XUL file shoul...
... is a separate component that could be installed or uninstalled, then the overlaying should not occur in the XUL file. It should instead take place through the chrome registry. Examples of overlays that should take place using the chrome registry include the security padlock icon and any Messenger UI in the Navigator window. style="..." is prohibited in XUL files without approval Any usages of inline style are extremely dangerous, since they are overriding the included skin, and must be approved before their usage will be allowed. Image chrome URLs should never occur in XUL. Any chrome URL that references an image in the skin is strictly forbidden in the XUL. If you find yourself needing to display an image from the skin, then use <titledbutton> and style it rather than using <html:img>. The...
tree - Archive of obsolete content
Archive › Mozilla › XUL › tree
with a fairly small number of rows. Custom tree view nsITreeView No For this tree you implement the nsITreeView interface yourself. The tree's data is retrieved from this custom view. The custom view should be attached to the tree by setting its view property. More information is available in the XUL tutorial. Also Tree Widget Changes. ...
...so Tree Widget Changes. Relevant accessbility guidelines Provide alternative access (for example, via menus) to column picker and for header behaviors like sorting (these have no default keyboard access). ...
...ation will be remembered for the next time the XUL file is opened. If you do not specify this attribute, state information will be stored in the local store (rdf:local-store). tabindex Type: integer The tab order of the element. The tab order is the order in which the focus is moved when the user presses the "tab" key. Elements with a higher tabindex are later in the tab sequence. treelines Type: boolean When set to true, lines are drawn connecting the lines in the tree; when false, the lines are not drawn. This is false by default. Properties accessibleType Type: integer A value indicating the type of accessibility object for the element. builderView Type: nsIXULTreeBuilder A reference to the tree builder which constructed the tree data. The bu...
window - Archive of obsolete content
htweightthemes, lightweightthemesfooter, screenX, screenY, sizemode, title, width, windowtype Examples <?xml version="1.0"?> <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> <!-- run this example using copy & paste in this live XUL editor: https://github.com/KM-200/xul --> <!-- Extremely recommended to keep this css include!! ...
...="text/css"?> <!-- run this example using copy & paste in this live XUL editor: https://github.com/KM-200/xul --> <!-- Extremely recommended to keep this css include!! ...
...If this code is placed between window tags it messes up all other controls on the window. If it is placed between box tags, window controls are rendered fine, but still there is this error message. The problem can be solved as follows: <html:link rel="icon" href="chrome://myExtension/content/path/to/favicon.png" style="display:none"...
XUL Application Packaging - Archive of obsolete content
See Command Line Options for more details. ...
... XULRunner application packages are standard toolkit bundles (like a Firefox extension), with one additional manifest file (application.ini) which helps describe the application. XUL app packages are typically ZIPped into an archive with the extension .xulapp or .xpi. They can be installed to XULRunner with a command line flag "--install-app" if XULRunner is registered on the system. ...
...A sample application.ini file can be found in the mozilla source tree. The [App] section The App section specifies metadata about the application Name Specifies the application name. REQUIRED Name Example: Name=TestApplication Version Specifies the application version number. ...
Mozprofile - Archive of obsolete content
ntation is no longer maintained. Please see the maintained documentation of mozprofile at http://mozbase.readthedocs.org/en/latest/mozprofile.html. Mozprofile is a python tool for creating and managing profiles for Mozilla's applications (Firefox, Thunderbird, etc.). In addition to creating profiles, mozprofile can install addons and set preferences. Mozprofile can be utilized from the command line or as an API. Command Line Usage mozprofile may be used to create profiles, set preferences in profiles, or install addons into profiles. The profile to be operated on may be specified with the --profile switch. If a profile is not specified, one will be created in a temporary directory which will be echoed to the terminal: (mozmill)> mozprofile /tmp/tmp4q1iEU.mozrunner (mozmill)> ls /tmp/tmp4q1i...
...to create profiles, set preferences in profiles, or install addons into profiles. The profile to be operated on may be specified with the --profile switch. If a profile is not specified, one will be created in a temporary directory which will be echoed to the terminal: (mozmill)> mozprofile /tmp/tmp4q1iEU.mozrunner (mozmill)> ls /tmp/tmp4q1iEU.mozrunner user.js To run mozprofile from the command line enter: mozprofile --help for a list of options. API Usage To use mozprofile as an API you can import mozprofile.profile and/or the AddonManager. mozprofile.profile features a generic Profile class. In addition, subclasses FirefoxProfile and ThundebirdProfile are available with preset preferences for those applications. Installing Addons Addons may be installed individually or from a manifest. Exa...
...Setting Permissions mozprofile also takes care of adding permissions to the profile. See https://github.com/mozilla/mozbase/b...permissions.py Resources Other Mozilla programs offer additional and ...
nsIContentPolicy - Archive of obsolete content
63 Introduced Gecko 1.0 Inherits from: nsIContentPolicyBase Last changed in Gecko 42 (Firefox 42 / Thunderbird 42 / SeaMonkey 2.39) You can observe content that is being loaded into your browser by implementing nsIContentPolicy. ...
... 63 Introduced Gecko 1.0 Inherits from: nsIContentPolicyBase Last changed in Gecko 42 (Firefox 42 / Thunderbird 42 / SeaMonkey 2.39) You can observe content that is being loaded into your browser by implementing nsIContentPolicy. ...
...in nsIURI aContentLocation, in nsIURI aRequestOrigin, in nsISupports aContext, in ACString aMimeTypeGuess, in nsISupports aExtra, in nsIPrincipal aRequestPrincipal ); Parameters aContentType The type of content being tested. This will be one one of the Content types listed above. aContentLocation The URI of the content being checked; must not be null. aRequestOrigin {optional_inline}} The location of the resource that initiated this load request; can be null if inapplicable. aContext {optional_inline}} The nsIDOMNode or nsIDOMWindow that initiated the request, or something that can QueryInterface() to one of those; can be null if inapplicable. Note: aContext is the new tab/window when a user uses the context menu to open a link in a new tab/window or cmd/ctrl + click...
reftest opportunities files - Archive of obsolete content
302 http://dbaron.org/css/test/sec100303 http://dbaron.org/css/test/sec100304 http://dbaron.org/css/test/sec100305 http://dbaron.org/css/test/sec100307 http://dbaron.org/css/test/sec1004 http://dbaron.org/css/test/sec1004b http://dbaron.org/css/test/sec100604 http://dbaron.org/css/test/sec1007 http://dbaron.org/css/test/sec1007b http://dbaron.org/css/test/abspos_inherit http://dbaron.org/css/test/linebox1 http://dbaron.org/css/test/linebox2 http://dbaron.org/css/test/linebox3 http://dbaron.org/css/test/linebox4 http://dbaron.org/css/test/inlinetest http://dbaron.org/css/test/sec1101 http://dbaron.org/css/test/sec110102 http://dbaron.org/css/test/sec110102b http://dbaron.org/css/test/sec1102a http://dbaron.org/css/test/sec1102b http://dbaron.org/css/test/sec1201 http://dbaron.org/css/test/sec12...
...170501a http://dbaron.org/css/test/sec170501b http://dbaron.org/css/test/sec170502 http://dbaron.org/css/test/sec170503 http://dbaron.org/css/test/sec170504 http://dbaron.org/css/test/tborder1 http://dbaron.org/css/test/tborder2 http://dbaron.org/css/test/sec1706c http://dbaron.org/css/test/sec1801 http://dbaron.org/css/test/sec1802 http://dbaron.org/css/test/sec1803 http://dbaron.org/css/test/outline http://dbaron.org/css/test/sq_small http://dbaron.org/css/test/sq_large Tests from mozilla source tree parser/htmlparser/tests/html/xmp005.html parser/htmlparser/tests/html/value001.html parser/htmlparser/tests/html/utf8001.html parser/htmlparser/tests/html/usascii.html parser/htmlparser/tests/html/title01.html parser/htmlparser/tests/html/title.html parser/htmlparser/tests/html/tiny.html parse...
...htmlparser/tests/html/pre002.html parser/htmlparser/tests/html/pre001.html parser/htmlparser/tests/html/param002.html parser/htmlparser/tests/html/param001.html parser/htmlparser/tests/html/option.html parser/htmlparser/tests/html/obj003.html parser/htmlparser/tests/html/obj002.html parser/htmlparser/tests/html/obj001.html parser/htmlparser/tests/html/nulltest.html parser/htmlparser/tests/html/newlines.html parser/htmlparser/tests/html/list003.html parser/htmlparser/tests/html/list002.html parser/htmlparser/tests/html/list001.html parser/htmlparser/tests/html/layer01.html parser/htmlparser/tests/html/layer003.html parser/htmlparser/tests/html/layer002.html parser/htmlparser/tests/html/layer001.html parser/htmlparser/tests/html/java.html parser/htmlparser/tests/html/insdel02.html parser/htmlpar...
Archived Mozilla and build documentation - Archive of obsolete content
hat lets you perform queries on the contents of a CVS archive; you can: get a list of checkins, see what checkins have been made by a given person, or on a given CVS branch, or in a particular time period. It also includes tools for looking at checkin logs (and comments); doing diffs between various versions of a file; and finding out which person is responsible for changing a particular line of code ("cvsblame"). Bookmark Keywords Practically every Web surfer has bookmarks, of course, and power surfers usually have hundreds stuffed into folders within folders. In addition to being handy pointers to useful resources, bookmarks in Mozilla can be used to make the address bar itself a power tool. Searches, lookups, package tracking, and even wo...
...ant of the Gecko Layout system, specifically Block Layout. See the High Level Design document for an overview of the Space Manager, and as an introduction to the classes, structures and algorithms container in this, the Detailed Design Document. Space Manager High Level Design The Space Manager and associated classes and structures are used by Block and Line layout to manage rectangular regions that are occupied and available, for correct handling of floated elements and the elements that flow around them. When elements are floated to the left or right in a layout, they take up space and influence where other elements can be placed. The Space Manager is responsible for keeping track of where space is taken up and where it is available. This ...
...ell as other related technologies. XPInstall XPJS Components Proposal Draft 1.0 XRE XTech 2005 Presentations XTech 2006 Presentations XUL Explorer XUL Explorer is a XULRunner application that provides an easy way to experiment with XUL. It's a simple editor that can preview XUL inline or in a separate popup window. It has a list of code snippets (small fragments of XUL or JavaScript) that can be quickly inserted into the editor. The XUL can be loaded from and saved to files. A XUL validator and the Error Console are both available to help debug problems. The help menu provides access to XUL information on MDC. There is even simple "keyword" help lookup for XU...
2006-09-29 - Archive of obsolete content
Although the W3 validation accepted the generated XHTML as valid, a bug identified within the HTML Working Group ignored the invalid elements. ...
...Although the W3 validation accepted the generated XHTML as valid, a bug identified within the HTML Working Group ignored the invalid elements. ...
... * @param aPadding The sum of the left and right margins of the * frame, including actual values resulting from * percentages. * @param aShrinkWrap Whether the frame is in a context where * non-replaced blocks should shrink-wrap (e.g., * it's floating, absolutely positioned, or * inline-block). */ virtual nsSize ComputeSize(nscoord aAvailWidth, nscoord aMargin, nscoord aBorder, nscoord aPadding, PRBool aShrinkWrap) = 0; Details can be located at refactoring some of nsHTMLReflowState. Discussion on how to determine whether there is pending layout changes or reflows when using a popup. It was concluded that a frame ...
NPN_GetValue - Archive of obsolete content
The value pa...
...The value parameter should point to a N...
...The value parameter should point to a NPBool, which will be set appro...
Building a Theme - Archive of obsolete content
mmunicator sample chrome/communicator/ skin global sample chrome/global/ skin mozapps sample chrome/mozapps/ Don't forget the trailing slash, "/"! Without it, the package won't be registered. The third column needs to match your theme's internalName value from the install manifest above. This maps skin directories to locations within your theme. For example, the line skin browser sample skin/browser/ means "when the user has the sample theme selected, use the directory browser/ to look up skins for the browser package." More concisely, this means that the URL chrome://browser/skin/some/path/file.css will look for a file browser/some/path/file.css in your theme's root directory. Save the file. Test First, we need to tell Firefox about your theme. During t...
...p the contents of your theme's folder (not the theme folder itself), and rename the zip file to have a .xpi extension. In Windows, you can do this easily by selecting all the files and subfolders in your extension folder, right click and choose "Send To -> Compressed (Zipped) Folder". A .zip file will be created for you. ...
...hoose "Send To -> Compressed (Zipped) Folder". A .zip file will be created for you. Just rename it and you're done! On Mac OS or Linux, you can use the command-line zip tool: zip -r my_theme.xpi install.rdf chrome.manifest browser communicator global mozapps Or, if you have 7-Zip installed, you can use that for zipping it up: 7z a -tzip my_theme.xpi chrome chrome.manifest Note: The command-line tool will update an existing zip file, not replace it - so if you have files you've deleted from your theme, be sure to remove the .xpi file before running the zip command again. Now upload the .xpi file to your server, making sure it's served as application/x-xpinstall. You can link to it and allow people to download and install it. For the purposes of just testing our .xpi file we can just dra...
Theme changes in Firefox 2 - Archive of obsolete content
low them. The first icon is for the extensions view. The second is for themes. The third is for locales, the fourth is for plugins, the fifth is for updates, and the sixth is for installs. mozapps/pref This entire directory is no longer used in Firefox 2 and should be removed. Changes in browser bookmarks/addBookmark.css The addBookmarks.css file should have the following lines added to the top: @namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"); @namespace html url("http://www.w3.org/1999/xhtml"); Some microsummary-related CSS also needs to be added, to provide formatting for the microsummary picker. These are used to make the picker look like a regular text box instead of like an editable menu list when there are no microsummaries avai...
...tyle information for the site label. feeds/subscribe.css This is a new file in Firefox 2. It skins the window displayed to subscribe to an RSS feed, which is at browser/feeds/subscribe.xhtml. ...
...splayed to subscribe to an RSS feed, which is at browser/feeds/subscribe.xhtml. ...
Sharp variables in JavaScript - Archive of obsolete content
ved in bug 566700, Firefox 12. Form Sharp variables have the form of a sharp sign (#) immediately followed by one or more digits. The number represented by the digits serves as the variable's unique identifier, but leading 0s are ignored. Scope Sharp variables are only in scope in the statement in which they are defined. Usage To create a sharp variable, simply assign an object to it in a line of code using an equal sign. You cannot assign primitives (including strings) to sharp variables. Make sure you don't put in any spaces before the equal sign though. #1 = {}; // This doesn't do much since the sharp variable is out of scope immediately after a = #2 = {}; // Slightly more useful since we retain a reference to the new object To reference the sharp variable, simply append a...
... the equal sign though. #1 = {}; // This doesn't do much since the sharp variable is out of scope immediately after a = #2 = {}; // Slightly more useful since we retain a reference to the new object To reference the sharp variable, simply append another sharp (#) to the end of the variable name. This acts as a reference to initial variable. You can use this to create objects in a single line of code that would otherwise take multiple lines of code. Examples Multiple references var a = { foo:#1=[], bar:#1# }; a.foo.push("Hello"); a.bar.push("there!"); alert(a.foo[1]); // "there!" You can avoid using sharp variables by breaking the declaration up into multiple lines. var a = { foo:[], bar:undefined }; a.bar = a.foo; a.foo.push("Hello"); a.bar.push("there!"); alert(a.foo...
...r:#1# }; a.foo.push("Hello"); a.bar.push("there!"); alert(a.foo[1]); // "there!" You can avoid using sharp variables by breaking the declaration up into multiple lines. var a = { foo:[], bar:undefined }; a.bar = a.foo; a.foo.push("Hello"); a.bar.push("there!"); alert(a.foo[1]); // "there!" Cyclic references Sharp variables can be used to create a circularly linked list in one line of code. var a = #1 = { val:1, next:{val:2, next:#1#} }; a.val; // 1 a.next.val; // 2 a.next.next.val; // 1 a.next.next == a; // true Again, you can eliminate the need for sharp variables by using two lines instead of one for the declaration. var a = {val:1, next:{val:2, next:undefined} }; a.next.next = a; a.val; // 1 a.next.val; ...
Troubleshooting XForms Forms - Archive of obsolete content
on/xhtml+xml or text/xml. Check the XHTML 1.0 Namespace Declaration Mozilla XForms is built upon the XHTML 1.0 specification, which is located at http://www.w3.org/1999/xhtml . ...
...ication, which is located at http://www.w3.org/1999/xhtml . Ensure that your <html> element contains the supported namespace declaration: xmlns="http://www.w3.org/1999/xhtml" (instead of the newer, unratified version, XHTML 2.0, located at http://www.w3.org/2002/06/xhtml2 ) Inline Instance, No Controls Get Bound Have you remembered to use the correct namespace for the instance nodes? For an inline instance you most probably need to have <xf:instance xmlns=""> .... 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. If form controls are within repeat, check that you are using at...
...nti-XSS Protection Exceptions You can temporarily fix the problem by unchecking the Turn cross-site POST requests into data-less GET requests check box. Alternatively, for a long term fix you can enter an exception pattern in the Anti-XSS Protection Exceptions text area. If you are developing on your local machine using Apache Tomcat for example then add the following regular expression on a new line: ^http://localhost:8080/.* Use the XForms Buddy to view instance data The XForms Buddy extension allows you to dynamically view model instance data while the XForms is running in the FireFox browser. The home page for XFroms Buddy is located at: XForms Buddy Using HTTP Proxy You can use the Charles FireFox extension to view your HTTP session data including HTTP header data. If All Else F...
The Business Benefits of Web Standards - Archive of obsolete content
ed. The process is therefore one of three stages:- the creation of content, applying the markup, and adding the style. Looked at in that light it may seem surprising how clean, elegant and simple the web development process really is. In a multi headed and possibly commercial environment such as a web development agency, this approach also lends itself to a very strict demarcation, between disciplines within a common framework. The content creator - who may be a journalist, a music producer, or may come from any one of a number of disciplines; need not become involved in the actual process of publishing that content at all. And the person applying the markup need not necessarily, know (or care) how it is going to be styled. That has been the real impact of The Zen Garden, in helping to demons...
...l. And the person applying the markup need not necessarily, know (or care) how it is going to be styled. That has been the real impact of The Zen Garden, in helping to demonstrate the stunning results which are possible without altering the markup, and indeed keeping the amount of presentational markup to an acceptable minimum. The Content - Markup - Style; model also lends itself very neatly to linear methods of production. No web development activity need or indeed - should take place until the content has been produced. Conversely once the content is to hand the development/publishing process should be lighteningly fast. Which is as it should be. If we have produced content we want to publish it now. Not in 6 weeks time. Furthermore by strictly marking the production process, time, budget...
...upplies a far better development framework, for content providers, for web developers, and for CSS stylists alike. It is simply not possible for everybody not to gain and share in the huge benefits of Standards. Customers, developers, digital media creators, can be freed from the tyranny of graphics led development, code generators, and incomprehensible markup. But the real value is at the bottom line. The message to accountants, executives and shareholders alike should be irresistible. Benefits of CSS over JavaScript Specifically, graphics and JavaScript are often used for special effects on text fragments. As Style Sheet technology gives designers good typographic control and permits effects such as roll-overs, it greatly reduces the need for JavaScript programming and creation of graphi...
Using the Right Markup to Invoke Plugins - Archive of obsolete content
ugin with the correct use of HTML. It discusses the object element and the embed element, with details about using the most apt HTML to invoke Java in a web page as well. The Object Element: W3C Standards and Cross-Browser Issues The object element is part of the HTML 4.01 specification, and is the recommended mechanism to invoke plugins. Its use is subject to a few caveats that this section outlines. Traditionally, the object element has been used differently by Microsoft Internet Explorer and by Mozilla-based browsers such as Netscape 7. In IE, the object element is used to invoke a plugin that is built on the ActiveX architecture. Here's an example of this kind of usage for IE: <!-- IE ONLY CODE --> <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.m...
...he above markup to invoke the Flash plugin for both IE and Netscape 7. However, there are a few caveats that developers ought to bear in mind when using the object element with Mozilla-based browsers such as Netscape 7 and in IE: Caveats If you use one single object element for both browsers (as in the above example), it is not possible to provide a cross-browserobtainment mechanism for streamlined download. You cannot use a codebase attribute to link to a signed CAB file for the ActiveX component, since this won't work in Mozilla-based browsers such as Netscape 7. Furthermore, IE's use of the codebase attribute as an obtainment mechanism itself is not strictly correct according to the HTML 4.01 specification, which says that the codebase attribute should be used to qualify URNs referenced...
...isable. Note that the obtainment mechanism for the embed element -- that is, the way in which a plugin is obtained if it is missing -- comes via the pluginspage attribute. This attribute points to a page to get the plugin if it is not detected by the browser. The pluginurl attribute is another attribute that can be used, and it can be used to point directly to an XPInstall file for a more streamlined download. For the embed element in particular, these attributes in Netscape 7 and Mozilla are governed by the Plugin Finder Service preference. Under Edit | Preferences | Navigator | Helper Applications is a preference to use Netscape's Plugin Finder Service. If the user has checkedAlways Use the Netscape Plugin Finder Service to get Plugins then whether these attributes are specified or not mak...
Index - Game development
ll take you through the real basics of using Babylon.js, including setting up a development environment, structuring the necessary HTML, and writing the JavaScript code. ...
...depends on your approach -- designers may favor the online editor while programmers will prefer having the full control over the coding environment and will probably use the engine's source files. The good thing is that you have a choice and can pick whatever tools suit you best. 19 Building up a basic demo with PlayCanvas editor 3D, Animation, Beginner, Canvas, Games, Lightning, Online, PlayCanvas, Tutorial, WebGL, camera, editor, rendering Now you can check the PlayCanvas engine article if you haven't seen it yet, go back to the Building up a basic demo with PlayCanvas page, or go back a level higher to the main 3D Games on the Web page. 20 Building up a basic demo with the PlayCanvas engine 3D, Animation, Beginner, Canvas, Games, PlayCanvas, Tutorial, Web...
...ry, vertex, vertices This article explains all of the basic theory that's useful to know when you are getting started working with 3D. 23 GLSL Shaders Beginner, GLSL, OpenGL, Shader, texture shader, three.js, vertex shader Shaders use GLSL (OpenGL Shading Language), a special OpenGL Shading Language with syntax similar to C. GLSL is executed directly by the graphics pipeline. There are two types of shaders: Vertex Shaders and Fragment (Pixel) Shaders. Vertex Shaders transform shape positions into 3D drawing coordinates. Fragment Shaders compute the renderings of a shape's colors and other attributes. 25 Async scripts for asm.js Games, JavaScript, asm.js, async Every medium or large game should compile asm.js code as part of an async script to giv...
Game distribution - Game development
Benefits of HTML5 over native Building games with HTML5 gives you extra advantages, such as: Multiplatform bliss The technology itself is multiplatform, so you can write the code once and target multiple devices. ...
...emote server, grab a catchy domain name, and host it yourself. If you want to make money out of game dev, you should secure your source code one way or another against people who could easily take it and sell it as their own. You can concatenate and minify the code to make it smaller and uglify it so it's a lot harder to reverse engineer your game. Another good measure to take is to provide an online demo if you're planning on packaging it and selling it in a closed store like iTunes or Steam. If you're working on a side project just for fun, then leaving the source open will benefit those who would like to learn from what you've created. You don't even have to worry about looking for a hosting provider as it's possible to host games on GitHub Pages. You'll get free hosting, version control ...
...games are the Web-based stores. It's easy to prepare a game for them as such an action involves little to no modification of the game itself -- usually adding a manifest file containing necessary information in a zipped package containing all the resources is enough. The Chrome Web Store is also an attractive option -- again, having a manifest file ready, zipping your game and filling in the online submission form is about all that's required. Tizen is also putting a high value on supporting apps written in JavaScript. Their store is another available option. Native mobile stores When it comes to the mobile market, there's the Apple App Store for iOS, Google Play for Android and all the rest of the competition. Native stores are already filled with established devs selling great games, ...
Game promotion - Game development
nd blog You should definitely create your own website containing all the information about your games, so people can see what you've worked on. The more information you can include the better -- you should include screenshots, description, trailer, press kit, requirements, available platforms, support details and more. You'll get bonus points for allowing your users to directly play your games online -- at least in demo form. Also, you should do some work on SEO to allow people to find your games more easily. You should also blog about everything related to your gamedev activities. Write about your development process, nasty bugs you encounter, funny stories, lessons learned, and the ups and downs of being a game developer. Continually publishing information about your games will help educat...
...got more of a chance of success. If you want to learn more about the etiquette of contacting the press you should definitely check out How To Contact Press - a great guide from Pixel Prospector, and the Video Game Journaliser site curated by them for the list of sites to contact. Tutorials It's good to share your knowledge with other devs -- after all you probably learned a thing or two from online articles, so you take the time to pay that knowledge forward. Talking or writing about something you achieved or problems you overcame is something people would be interested it. 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. That way everyone benefits -- people learn new skills, your game gets promoted, an...
... send them all over the place -- to press, youtubers, as competition prizes, etc. If the game reaches certain people you'll get a free advert to thousands of players. It can boost interest in your game more than anything else if you get lucky. Fostering the community You can help community grow and promote yourself and your games at the same time. 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. Then when you need any help they will be there for you. Summary Any way of promoting your game is good. You have a whole lot of options to chose from with most of them being free, so it's only about your enthusiasm and available time. Sometimes you have to spend more time promo...
Building up a basic demo with A-Frame - Game development
tAttribute('color', '#FF9500'); cylinder.setAttribute('height', '2'); cylinder.setAttribute('radius', '0.75'); cylinder.setAttribute('position', '3 1 0'); scene.appendChild(cylinder); We're getting a reference to the scene handler first, then we create the cylinder element as an A-Frame entity. After that it's all about setting the proper attributes: color, height, radius and position. The last line adds the newly created cylinder to the scene. That's it -- you've created three different shapes with A-Frame! Here's how it looks right now: It is impressive to be able to create such a scene with just a few lines of HTML and JavaScript. Animation We've already used rotation and position to move the shapes on the scene, and we can also scale them. These attributes can be manipulated to crea...
...By setting the direction to alternate the scale will be animated to 0.5, and then animated back to 1 during 2 seconds. Again, the animation is ...
...By setting the direction to alternate the scale will be animated to 0.5, and then animated back to 1 during 2 seconds. Again, the animation is being repeated indefinitely. ...
Building up a basic demo with PlayCanvas - Game development
Games and demos PlayCanvas has a few well-known demos published that showcase its possibilities. Tanx is a multiplayer tank game where you can drive your tank around, shooting at other players as you go. ...
...go. Visualizations like the Star Lord and BMW i8 also take advantage of the engine and showcase what's possible. Note: Check out the list of featured demos to find more examples. Engine vs editor The engine itself can be used as a standard library by including its JavaScript file directly in your HTML, so you can start coding right away; in addition the PlayCanvas toolset comes with an online editor that you can use to drag and drop components onto the scene -- a great way to create games and other apps requiring scenes if you're more of a designer than a coder. Those approaches are different but work equally well regarding achieving end goals. PlayCanvas engine Built for modern browsers, PlayCanvas is a fully-featured 3D game engine with resource loading, an entity and component sy...
...phics manipulation, collision and physics engine (built with ammo.js), audio, and facilities to handle control inputs from various devices (including gamepads). That's quite an impressive list of features -- let's see some in action, check out the Building up a basic demo with PlayCanvas engine for details. PlayCanvas editor Instead of coding everything from the beginning you can also use the online editor. This can be a more pleasant working environment if you are not someone who likes to code. See the Building up a basic demo with PlayCanvas editor for details. Summary Of course, it depends on your approach -- designers may favor the online editor while programmers will prefer having the full control over the coding environment and will probably use the engine's source files. The good th...
Audio for Web games - Game development
with native-quality audio for iOS. As the Web Audio API allows precise timing and control of audio playback, we can use it to play samples at specific moments, which is a crucial immersive aspect of gaming. You want those explosions to be accompanied by a thundering boom, not followed by one, after all. Background music with the Web Audio API Although we can use the <audio> element to deliver linear background music that doesn't change in reaction to the game environment, the Web Audio API is ideal for implementing a more dynamic musical experience. You may want music to change depending on whether you are trying to build suspense or encourage the player in some way. Music is an important part of the gaming experience and depending on the type of game you are making you may wish to invest ...
... environment, the Web Audio API is ideal for implementing a more dynamic musical experience. You may want music to change depending on whether you are trying to build suspense or encourage the player in some way. Music is an important part of the gaming experience and depending on the type of game you are making you may wish to invest significant effort into getting it right. element to deliver linear background music that doesn't change in reaction to the game environment, the Web Audio API is ideal for implementing a more dynamic musical experience. You may want music to change depending on whether you are trying to build suspense or encourage the player in some way. Music is an important part of the gaming experience and depending on the type of game you are making you may wish to invest ...
... In...
Finishing up - Game development
n drawLives() { ctx.font = "16px Arial"; ctx.fillStyle = "#0095DD"; ctx.fillText("Lives: "+lives, canvas.width-65, 20); } Instead of ending the game immediately, we will decrease the number of lives until they are no longer available. We can also reset the ball and the paddle positions when the player begins with their next life. ...
...ide the draw() function and add it below the drawScore() call. drawLives(); Improving rendering with requestAnimationFrame() Now let's work on something that is not connected to the game mechanics, but to the way it is being rendered. requestAnimationFrame helps the browser render the game better than the fixed framerate we currently have implemented using setInterval(). ...
...the browser render the game better than the fixed framerate we currently have implemented using setInterval(). Replace the following line: var interval = setInterval(draw, 10); with simply: draw(); and remove each instance of: clearInterval(interval); // Needed for Chrome to end game Then, at the very bottom of the draw() function (just before the closing curly brace), add in the following line, which causes the draw() function to call itself over and over again: requestAnimationFrame(draw); The draw() function is now getting executed again and again within a requestAnimationFrame() loop, but instead of the fixed 10 milliseconds frame rate, we are giving control of the framerate back to the browser. It will sync the framerate accordingly and render the shapes only when needed. This pr...
Track the score and win - Game development
) method. Then use fillStyle() to set the color of the font and fillText() to set the actual text that will be placed on the canvas, and where it will be placed. The first parameter is the text itself -- the code above shows the current number of points -- and the last two parameters are the coordinates where the text will be placed on the canvas. ...
...e placed. The first parameter is the text itself -- the code above shows the current number of points -- and the last two parameters are the coordinates where the text will be placed on the canvas. To award a score each time a brick is hit, add a line to the collisionDetection() function to increment the value of the score variable each time a collision is detected. ...
...Add the follo...
Build the brick field - Game development
he information we need: the width and height of a single brick, the number of rows and columns of bricks we will see on screen, the top and left offset (the location on the canvas where we shall start to draw the bricks) and the padding between each row and column of bricks. ...
...he bricks) and the padding between each row and column of bricks. Now, let's start creating the bricks themselves -- add an empty group first to contain the bricks, by adding the following line at the bottom of the initBricks() function: bricks = game.add.group(); We can loop through the rows and columns to create new brick on each iteration -- add the following nested loop below the previous line of code: for(c=0; c<brickInfo.count.col; c++) { for(r=0; r<brickInfo.count.row; r++) { // create new brick and add it to the group } } This way we will create the exact number of bricks we need and have them all contained in a group. Now we need to add some code inside the nested loop stucture to draw each brick. Fill in the contents as shown below: for(c=0; c<brickInfo.count.
...k is enabled for the Arcade physics engine, it's body is set to be immovable (so it won't move when hit by the ball), and we're also setting the anchor to be in the middle and adding the brick to the group. The problem currently is that we're painting all the bricks in one place, at coordinates (0,0). What we need to do is draw each brick at its own x and y position. ...
Buttons - Game development
his lesson at Gamedev-Phaser-Content-Kit/demos/lesson15.html. Instead of starting the game right away we can leave that decision to the player by adding a Start button they can press. Let's investigate how to do that. New variables We will need a variable to store a boolean value representing whether the game is currently being played or not, and another one to represent our button. Add these lines below your other variable definitions: var playing = false; var startButton; Loading the button spritesheet We can load the button spritesheet the same way we loaded the ball's wobble animation. Add the following to the bottom of the preload() function: game.load.spritesheet('button', 'img/button.png', 120, 40); A single button frame is 120 pixels wide and 40 pixels high. You also need t...
...d the following to the bottom of the preload() function: game.load.spritesheet('button', 'img/button.png', 120, 40); A single button frame is 120 pixels wide and 40 pixels high. You also need to grab the button spritesheet from Github, and save it in your /img directory. Adding the button to the game Adding the new button to the game is done by using the add.button method. ...
...e the startGame() function referenced in the code above: function startGame() { startButton.destroy(); ball.body.velocity.set(150, -150); playing = true; } When the button is pressed, we remove the button, sets the ball's initial velocity and set the playing variable to true. Finally for this section, go back into your create() function, find the ball.body.velocity.set(150, -150); line, and remove it. You only want the ball to move when the button is pressed, not before! Keeping the paddle still before the game starts It works as expected, but we can still move the paddle when the game hasn't started yet, which looks a bit silly. To stop this, we can take advantage of the playing variable and make the paddle movable only when the game has started. To do that, adjust the updat...
Load the assets and print them on screen - Game development
should look after completing this lesson at Gamedev-Phaser-Content-Kit/demos/lesson03.html. Our game will feature a ball rolling around the screen, bouncing off a paddle, and destroying bricks to earn points -- familiar, huh? In this article we'll look at how to add sprites into our gameworld. Having a ball Let's start by creating a JavaScript variable to represent our ball. Add the following line between the game initialization code (our var game... block) and the preload() function: var ball; Note: For the sake of this tutorial, we will use global variables. The purpose of the tutorial is to teach Phaser-specific approaches to game development rather than dwelling on subjective best approaches. Loading the ball sprite Loading images and printing them on our canvas is a lot easier ...
...ables. The purpose of the tutorial is to teach Phaser-specific approaches to game development rather than dwelling on subjective best approaches. Loading the ball sprite Loading images and printing them on our canvas is a lot easier using Phaser than using pure JavaScript. To load the asset, we will use the game object created by Phaser, executing its load.image() method. Add the following new line just inside the preload() function, at the bottom: function preload() { // ... game.load.image('ball', 'img/ball.png'); } The first parameter we want to give the asset is the name that will be used across our game code -- for example, in our ball variable name -- so we need to make sure it is the same. The second parameter is the relative path to the graphic asset. In our case, we will...
...es not also have to be the same, but we'd recommend it, as it makes everything easier to follow.) Of course, to load the image, it must be available in our code directory. Grab the ball image from Github, and save it inside an /img directory in the same place as your index.html file. Now, to show it on the screen we will use another Phaser method called add.sprite(); add the following new code line inside the create() function as shown: function create() { ball = game.add.sprite(50, 50, 'ball'); } This will add the ball to the game and render it on the screen. The first two parameters are the x and y coordinates of the canvas where you want it added, and the third one is the name of the asset we defined earlier. That's it -- if you load your index.html file you will see the image alr...
Fallback alignment - MDN Web Docs Glossary: Definitions of Web-related terms
In CSS Box Alignment, a fallback alignment is specified in order to deal with cases where the requested alignment cannot be fullfilled. ...
... In CSS Box Alignment, a fallback alignment is specified in order to deal with cases where the requested alignment cannot be fullfilled. ...
...S Box Alignment, a fallback alignment is specified in order to deal with cases where the requested alignment cannot be fullfilled. ...
Flex Container - MDN Web Docs Glossary: Definitions of Web-related terms
These values create a flex formatting context for the element, which is similar to a block formatting context in that floats will not intrude into the container, and the margins on the container will not collapse with those of the items. ...
...These values create a flex formatting context for the element, which is similar to a block formatting context in that floats will not intrude into the container, and the margins on the container will not collapse with those of the items. ...
...These values create a flex formatting context for the element, which is similar to a block formatting context in that floats will not intrude into the container, and the margins on the container will not collapse with those of the items. ...
WCAG - MDN Web Docs Glossary: Definitions of Web-related terms
WCAG uses three levels of conformance: Priority 1: Web developers must satisfy these requirements, otherwise it will be impossible for one or more groups to access the Web content. ...
... WCAG uses three levels of conformance: Priority 1: Web developers must satisfy these requirements, otherwise it will be impossible for one or more groups to access the Web content. Conformance to this level is described as A. ...
... WCAG uses three levels of conformance: Priority 1: Web developers must satisfy these requirements, otherwise it will be impossible for one or more groups to access the Web content. Conformance to this level is described as A. ...
Assessment: Accessibility troubleshooting - Learn web development
nowledge of accessibility fundamentals. Starting point To get this assessment started, you should go and grab the ZIP containing the files that comprise the example. Decompress the contents into a new directory somewhere on your local computer. Alternatively, you could use a site like JSBin or Glitch to do your assessment. You could paste the HTML, CSS, and JavaScript into one of these online editors. If the online editor you are using doesn't have a separate CSS/JS panel, feel free to put them in appropriate <style> / <script> elements. The finished assessment site should look like so: You will see some differences/issues with the display of the starting state of the assessment -- this is mainly due to the differences in the markup, which in turn cause some styling issues as the ...
... columns together, and the table also has no kind of summary to make it clear what it shows. Can you add some features to your HTML to fix this problem? Other considerations? Can you list two more ideas for improvements that would make the website more accessible? Assessment or further help If you would like your work assessed, or are stuck and want to ask for help: Put your work into an online shareable editor such as CodePen, jsFiddle, or Glitch. Write a post asking for assessment and/or help at the MDN Discourse forum Learning category. Your post should include: A descriptive title such as "Assessment wanted for Accessibility troubleshooting". Details of what you have already tried, and what you would like us to do, e.g. if you are stuck and need help, or want an assessment...
...king for assessment and/or help at the MDN Discourse forum Learning category. Your post should include: A descriptive title such as "Assessment wanted for Accessibility troubleshooting". Details of what you have already tried, and what you would like us to do, e.g. if you are stuck and need help, or want an assessment. A link to the example you want assessed or need help with, in an online shareable editor (as mentioned in step 1 above). This is a good practice to get into -- it's very hard to help someone with a coding problem if you can't see their code. A link to the actual task or assessment page, so we can find the question you want help with. Previous Overview: Accessibility In this module What is accessibility? HTML: A good basis for accessibility CSS a...
Backgrounds and borders - Learn web development
jective: To learn how to style the background and border of boxes. Styling backgrounds in CSS The CSS background property is a shorthand for a number of background longhand properties that we will meet in this lesson. If you discover a complex background property in a stylesheet, it might seem a little hard to understand as so many values can be passed in at once. .box { background: linear-gradient(105deg, rgba(255,255,255,.2) 39%, rgba(51,56,57,1) 96%) center center / 400px 200px no-repeat, url(big-star.png) center no-repeat, rebeccapurple; } We'll return to how the shorthand works later in the tutorial, but first let's have a look at the different things you can do with backgrounds in CSS, by looking at the individual background properties. Background colors The backgrou...
...t types of gradients and things you can do with them on the MDN page for the <gradient> data type. A fun way to play with gradients is to use one of the many CSS Gradient Generators available on the web, such as this one. You can create a gradient then copy and paste out the source code that generates it. Try some different gradients in the example below. In the two boxes respectively, we have a linear gradient that is stretched over the whole box, and a radial gradient with a set size, which therefore repeats. Multiple background images It is also possible to have multiple background images -- you specify multiple background-image values in a single property value, separating each one with a comma. When you do this you may end up with background images overlapping each other. The backgr...
...coration; any important content should be part of the HTML page and not contained in a background. Borders When learning about the Box Model, we discovered how borders affect the size of our box. In this lesson we will look at how to use borders creatively. Typically when we add borders to an element with CSS we use a shorthand property that sets the color, width, and style of the border in one line of CSS. We can set a border for all four sides of a box with border: .box { border: 1px solid black; } Or we can target one edge of the box, for example: .box { border-top: 1px solid black; } The individual properties for these shorthands would be: .box { border-width: 1px; border-style: solid; border-color: black; } And for the longhands: .box { border-top-width: 1px; bo...
Test your skills: The Cascade - Learn web development
If you get stuck, then ask us for help -- see the Assessment or further help section at the bottom of this page. ...
...d to use one of the special values we looked at in the Controlling inheritance section to write a declaration in a new rule that will reset the background color back to white, without using an actual color value. In the example below see if you can match the image above. For assessment or further work purposes, download the starting point for this task to work in your own editor or in an online editor. Assessment or further help You can practice these examples in the Interactive Editors mentioned above. If you would like your work assessed, or are stuck and want to ask for help: Put your work into an online shareable editor such as CodePen, jsFiddle, or Glitch. You can write the code yourself, or use the starting point files linked to in the above sections. Write a post asking f...
... asking for assessment and/or help at the MDN Discourse forum Learning category. Your post should include: A descriptive title such as "Assessment wanted for Cascade skill test 1". Details of what you have already tried, and what you would like us to do, e.g. if you are stuck and need help, or want an assessment. A link to the example you want to be assessed or need help with, in an online shareable editor (as mentioned in step 1 above). This is a good practice to get into -- it's very hard to help someone with a coding problem if you can't see their code. A link to the actual task or assessment page, so we can find the question you want help with. ...
CSS selectors - Learn web development
r example, if I have the same CSS for an h1 and also a class of .special, I could write this as two separate rules. h1 { color: blue; } .special { color: blue; } I could also combine these into a selector list, by adding a comma between them. h1, .special { color: blue; } White space is valid before or after the comma. You may also find the selectors more readable if each is on a new line. h1, .special { color: blue; } In the live example below try combining the two selectors which have identical declarations. The visual display should be the same after combining them. When you group selectors in this way, if any selector is invalid the whole rule will be ignored. In the following example, the invalid class selector rule will be ignored, whereas the h1 would still be sty...
...xample.com"] { } Pseudo-classes and pseudo-elements This group of selectors includes pseudo-classes, which style certain states of an element. The :hover pseudo-class for example selects an element only when it is being hovered over by the mouse pointer: a:hover { } It also includes pseudo-elements, which select a certain part of an element rather than the element itself. For example, ::first-line always selects the first line of text inside an element (a <p> in the below case), acting as if a <span> was wrapped around the first formatted line and then selected. p::first-line { } Combinators The final group of selectors combine other selectors in order to target elements within our documents. The following for example selects paragraphs that are direct children of <article> elements usi...
...Type selector h1 { } Type selectors Universal selector * { } The universal selector Class selector .box { } Class selectors id selector #unique { } ID selectors Attribute selector a[title] { } Attribute selectors Pseudo-class selectors p:first-child { } Pseudo-classes Pseudo-element selectors p::first-line { } Pseudo-elements Descendant combinator article p Descendant combinator Child combinator article > p Child combinator Adjacent sibling combinator h1 + p Adjacent sibling General sibling combinator h1 ~ p General sibling In this module Cascade and inheritance CSS selectors Type, class, and ID selectors Attribute s...
Test your skills: tables - Learn web development
The aim of this task is to help you check your understanding of the skills you studied in the lesson on styling tables. Note: You can try out solutions in the interactive editors below, however it may be helpful to download the code and use an online tool such as CodePen, jsFiddle, or Glitch to work on the tasks. If you get stuck, then ask us for help -- see the Assessment or further help section at the bottom of this page. Task In the lesson we styled up a table in a rather garish manner. In this task we are going to style the same table, but using some good practices for table design as outlined in the external article Web Typography: designing tables to be read not looked at. Our finished table will look like the image below. There are a number of ways that you can achieve this,...
... in the tutorial to do the following things. Align headings and data for columns containing numbers right. Align headings and data for columns containing text left. Add a top and bottom border, plus a border above the footer. Stripe every odd row of the main table. For assessment or further work purposes, download the starting point for this task to work in your own editor or in an online editor. Assessment or further help You can practice these examples in the Interactive Editors mentioned above. If you would like your work assessed, or are stuck and want to ask for help: Put your work into an online shareable editor such as CodePen, jsFiddle, or Glitch. You can write the code yourself, or use the starting point files linked to in the above sections. Write a post asking f...
...te a post asking for assessment and/or help at the MDN Discourse forum Learning category. Your post should include: A descriptive title such as "Assessment wanted for tables skill test". Details of what you have already tried, and what you would like us to do, e.g. if you are stuck and need help, or want an assessment. A link to the example you want assessed or need help with, in an online shareable editor (as mentioned in step 1 above). This is a good practice to get into -- it's very hard to help someone with a coding problem if you can't see their code. A link to the actual task or assessment page, so we can find the question you want help with. ...
CSS building blocks - Learn web development
ot some basic experience with using it, its time to dive a bit deeper. This module looks at the cascade and inheritance, all the selector types we have available, units, sizing, styling backgrounds and borders, debugging, and lots more. The aim here is to provide you with a toolkit for writing competent CSS and help you understand all the essential theory, before moving on to more specific disciplines like text styling and CSS layout. Looking to become a front-end web developer? We have put together a course that includes all the essential information you need to work towards your goal. Get started Prerequisites Before starting this module, you should have: Basic familiarity with using computers, and using the Web passively (i.e. just looking at it, consuming the content.) A basic...
...create and manage files, as detailed in Dealing with files. Basic familiarity with HTML, as discussed in the Introduction to HTML module. An understanding of the basics of CSS, as discussed in the CSS first steps module. Note: If you are working on a computer/tablet/another device where you don't have the ability to create your own files, you could try out (most of) the code examples in an online coding program such as JSBin or Glitch. Guides This module contains the following articles, which cover the most essential parts of the CSS language. Along the way you'll come across plenty of exercises to allow you to test your understanding. Cascade and inheritance The aim of this lesson is to develop your understanding of some of the most fundamental concepts of CSS -- the cascade, spec...
...our understanding of the CSS covered in the guides above. Fundamental CSS comprehension This assessment tests your understanding of basic syntax, selectors, specificity, box model, and more. Creating fancy letterheaded paper If you want to make the right impression, writing a letter on nice letterheaded paper can be a really good start. In this assessment, we'll challenge you to create an online template to achieve such a look. A cool looking box Here you'll get some practice in using background and border styling to create an eye-catching box. ...
Flexbox - Learn web development
solve common problems such as this. To be clear, let's reiterate what is happening here. The element we've given a display value of flex to is acting like a block-level element in terms of how it interacts with the rest of the page, but its children are being laid out as flex items -- the next section will explain in more detail what this means. Note also that you can use a display value of inline-flex if you wish to lay out an element's children as flex items, but have that element behave like an inline element. The flex model When elements are laid out as flex items, they are laid out along two axes: The main axis is the axis running in the direction the flex items are being laid out in (e.g. as rows across the page, or columns down the page.) The start and end of this axis are ca...
...y in which you can fix this is to add the following declaration to your <section> rule: flex-wrap: wrap; Also, add the following declaration to your <article> rule: flex: 200px; Try this now; you'll see that the layout looks much better with this included: We now have multiple rows -- as many flexbox children are fitted onto each row as makes sense, and any overflow is moved down to the next line. The flex: 200px declaration set on the articles means that each will be at least 200px wide; we'll discuss this property in more detail later on. You might also notice that the last few children on the last row are each made wider so that the entire row is still filled. But there's more we can do here. First of all, try changing your flex-direction property value to row-reverse -- now you'll se...
...ld { flex:1 100px; display: flex; flex-flow: row wrap; align-items: center; justify-content: space-around; } Finally, we set some sizing on the button, but more interestingly we give it a flex value of 1 auto. This has a very interesting effect, which you'll see if you try resizing your browser window width. The buttons will take up as much space as they can and sit as many on the same line as they can, but when they can no longer fit comfortably on the same line, they'll drop down to create new lines. button { flex: 1 auto; margin: 5px; font-size: 18px; line-height: 1.5; } Cross browser compatibility Flexbox support is available in most new browsers -- Firefox, Chrome, Opera, Microsoft Edge and IE 11, newer versions of Android/iOS, etc. However you should be aware that t...
Test Your Skills: Fundamental layout comprehension - Learn web development
d through this module then you will have already covered the basics of what you need to know to do CSS layout today, and to work with older CSS as well. This task will test some of your knowledge by way of developing a simple webpage layout using a variety of techniques. Note: You can try out solutions in the interactive editors below, however it may be helpful to download the code and use an online tool such as CodePen, jsFiddle, or Glitch to work on the tasks. If you get stuck, then ask us for help -- see the Assessment or further help section at the bottom of this page. Project Brief You have been provided with some raw HTML, basic CSS, and images -- now you need to create a layout for the design, which should look just like the image below. Basic Setup You can download the HTML...
...you could achieve some of these tasks, and there often isn't a single right or wrong way to do things. Try a few different approaches and see which works best. Make notes as you experiment. Assessment or further help You can practice these examples in the Interactive Editors mentioned above. If you would like your work assessed, or are stuck and want to ask for help: Put your work into an online shareable editor such as CodePen, jsFiddle, or Glitch. You can write the code yourself, or use the starting point files linked to in the above sections. Write a post asking for assessment and/or help at the MDN Discourse forum Learning category. Your post should include: A descriptive title such as "Assessment wanted for Fundamental Layout Comprehension". Details of what you have alread...
...g for assessment and/or help at the MDN Discourse forum Learning category. Your post should include: A descriptive title such as "Assessment wanted for Fundamental Layout Comprehension". Details of what you have already tried, and what you would like us to do, e.g. if you are stuck and need help, or want an assessment. A link to the example you want assessed or need help with, in an online shareable editor (as mentioned in step 1 above). This is a good practice to get into -- it's very hard to help someone with a coding problem if you can't see their code. A link to the actual task or assessment page, so we can find the question you want help with. In this module Introduction to CSS layout Normal flow Flexbox Grid Floats Positioning Multiple-column layout Respon...
Test your skills: Media Queries and Responsive Design - Learn web development
is aim of this task is to get you working with responsive web design with a practical task. Everything you need to know to complete this task was covered in the guide to Media Queries, and the other layout lessons in this section. Note: Due to the need to test your design in multiple screen sizes we do not have an interactive editor for this task. Download the code and work locally, or use an online tool such as CodePen, jsFiddle, or Glitch to work on the tasks. If you get stuck, then ask us for help -- see the Assessment or further help section at the bottom of this page. Your task Download the starting point. Open this in your browser and you will find a wireframed site which will load in a mobile device in a readable manner. You can drag your window smaller or use the responsive des...
...er of ways that you could create the desktop layout, enjoy experimenting. You could also add a second breakpoint perhaps creating a layout that would work well on a tablet in portrait mode. Assessment or further help You can practice these examples in the Interactive Editors mentioned above. If you would like your work assessed, or are stuck and want to ask for help: Put your work into an online shareable editor such as CodePen, jsFiddle, or Glitch. You can write the code yourself, or use the starting point files linked to in the above sections. Write a post asking for assessment and/or help at the MDN Discourse forum Learning category. Your post should include: A descriptive title such as "Assessment wanted for Responsive Web Design assessment". Details of what you have alread...
...g for assessment and/or help at the MDN Discourse forum Learning category. Your post should include: A descriptive title such as "Assessment wanted for Responsive Web Design assessment". Details of what you have already tried, and what you would like us to do, e.g. if you are stuck and need help, or want an assessment. A link to the example you want assessed or need help with, in an online shareable editor (as mentioned in step 1 above). This is a good practice to get into -- it's very hard to help someone with a coding problem if you can't see their code. A link to the actual task or assessment page, so we can find the question you want help with. ...
Getting started with CSS - Learn web development
are three different ways to apply CSS to an HTML document that you'll commonly come across, however, for now, we will look at the most usual and useful way of doing so -- linking CSS from the head of your document. Create a file in the same folder as your HTML document and save it as styles.css. The .css extension shows that this is a CSS file. To link styles.css to index.html add the following line somewhere inside the <head> of the HTML document: <link rel="stylesheet" href="styles.css"> This <link> element tells the browser that we have a stylesheet, using the rel attribute, and the location of that stylesheet as the value of the href attribute. You can test that the CSS works by adding a rule to styles.css. Using your code editor add the following to your CSS file: h1 { color: red; ...
...her it is unvisited, visited, being hovered over, focused via the keyboard, or in the process of being clicked (activated). You can use CSS to target these different states -- the CSS below styles unvisited links pink and visited links green. ...
...moving the underline, which is achieved by in the next rule: a:hover { text-decoration: none; } In the live example below, you can play with different values for the various states of a link. I have added the rules above to it, and now realise that the pink color is quite light and hard to read -- why not change that to a better color? Can you make the links bold? We have removed the underline on our link on hover. You could remove the underline from all states of a link. It is worth remembering however that in a real site, you want to ensure that visitors know that a link is a link. Leaving the underline in place, can be an important clue for people to realize that some text inside a paragraph can be clicked on -- this is the behavior they are used to. As with everything in CSS, there...
Using your new knowledge - Learn web development
CSS and test your new-found knowledge. Starting point You can work in the live editor below, or you can download the starting point to work with in your own editor. This is a single page with the HTML, plus the starting point CSS in the head of the document. If you prefer you could move this CSS to a separate file when you create the example on your local computer. Alternatively use an online tool such as CodePen, jsFiddle, or Glitch to work on the tasks. Note: If you get stuck, then ask us for help -- see the Assessment or further help section at the bottom of this page. Working with CSS The following live example shows a biography, which has been styled using CSS. The CSS properties that I have used are as follows -- each one links to its property page on MDN, which will give y...
...th something like this image. Afterwards try looking up some properties not mentioned on this page in the MDN CSS reference and get adventurous! Remember that there is no wrong answer here -- at this stage in your learning you can afford to have a bit of fun. Assessment or further help If you would like your work assessed, or are stuck and want to ask for help: Put your work into an online shareable editor such as CodePen, jsFiddle, or Glitch. Write a post asking for assessment and/or help at the MDN Discourse forum Learning category. Your post should include: A descriptive title such as "Assessment wanted for CSS First Steps". Details of what you have already tried, and what you would like us to do, e.g. if you are stuck and need help, or want an assessment. A link to...
...rite a post asking for assessment and/or help at the MDN Discourse forum Learning category. Your post should include: A descriptive title such as "Assessment wanted for CSS First Steps". Details of what you have already tried, and what you would like us to do, e.g. if you are stuck and need help, or want an assessment. A link to the example you want assessed or need help with, in an online shareable editor (as mentioned in step 1 above). This is a good practice to get into -- it's very hard to help someone with a coding problem if you can't see their code. A link to the actual task or assessment page, so we can find the question you want help with. What's next? Congratulations on finishing this first module. You should now have a good general understanding of CSS, and be...
Styling text - Learn web development
We round off the module by looking at applying custom fonts to your page, and styling lists and links. ...
... Prerequisites Before starting this module, you should already have basic familiarity with HTML, as discussed in the Introduction to HTML module, and be comfortable with CSS fundamentals, as discussed in Introduction to CSS. Note: If you are working on a computer/tablet/other device where you don't have the ability to create your own files, you could try out (most of) the code examples in an online coding program such as JSBin, CodePen or Glitch. Guides This module contains the following articles, which will teach you all of the essentials behind styling HTML text content. Fundamental text and font styling In this article we go through all the basics of text/font styling in detail, including setting font weight, family and style, font shorthand, text alignment and other effects, and ...
... coding program such as JSBin, CodePen or Glitch. Guides This module contains the following articles, which will teach you all of the essentials behind styling HTML text content. Fundamental text and font styling In this article we go through all the basics of text/font styling in detail, including setting font weight, family and style, font shorthand, text alignment and other effects, and line and letter spacing. Styling lists Lists behave like any other text for the most part, but there are some CSS properties specific to lists that you need to know about, and some best practices to consider. This article explains all. Styling links When styling links, it is important to understand how to make use of pseudo-classes to style link states effectively, and how to style links for use i...
How do I start to design my website? - Learn web development
r goals are not necessarily set in stone. They evolve over time even in the course of the project, especially if you run across unexpected obstacles or just change your mind. ...
...In sales, for instance, it's far more important and time-consuming to han...
...In sales, for instance, it's far more important and time-consuming to handle supply, payment, and shipment than to build a website where people can place orders. ...
Common questions - Learn web development
highlight some things to think about when choosing and installing a text editor for Web development. What are browser developer tools? Every browser features a set of devtools for debugging HTML, CSS, and other Web code. This article explains how to use the basic functions of your browser's devtools. ...
... How do I use GitHub Pages? This article provides a basic guide to publishing content using GitHub's gh-pages feature. ...
...roperly? This article provides some basic troubleshooting steps. How do you set up a local testing server? This article explains how to set up a simple local testing server on your machine, and the basics of how to use it. How do you upload files to a Web server? 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. How do I use GitHub Pages? This article provides a basic guide to publishing content using GitHub's gh-pages feature. How do you host your website on Google App Engine? Looking for a place to host your website? Here's a step-by-step guide to hosting your website on Google App Engine. What tools are available to debug and improve website...
Basic native form controls - Learn web development
he box) and maxlength (the maximum number of characters that can be entered into the box). They can benefit from spell checking (using the spellcheck attribute), if the browser supports it. Note: The <input> element is unique amongst HTML elements because it can take many different forms depending on its type attribute value. It is used for creating most types of form widgets including single line text fields, time and date controls, controls without text input like checkboxes, radio buttons, and color pickers, and buttons. Single line text fields A single line text field is created using an <input> element whose type attribute value is set to text, or by omitting the type attribute altogether (text is the default value). The value text for this attribute is also the fallback value if ...
...nt whose type attribute value is set to text, or by omitting the type attribute altogether (text is the default value). The value text for this attribute is also the fallback value if the value you specify for the type attribute is unknown by the browser (for example if you specify type="color" and the browser doesn't support native color pickers). Note: You can find examples of all the single line text field types on GitHub at single-line-text-fields.html (see it live also). Here is a basic single line text field example: <input type="text" id="comment" name="comment" value="I'm a text field"> Single line text fields have only one true constraint: if you type text with line breaks, the browser removes those line breaks before sending the data to the server. The following screenshot sh...
...We'll cover those in the next article, The HTML5 input types. ...
Test your skills: Form structure - Learn web development
If you get stuck, then ask us for help -- see the Assessment or further help section at the bottom of this page. ...
... legend (use "Personal details" for the first two, and "Comment information" for the second two). Mark up each text label with an appropriate element so that it is semantically associated with its respective form field. Add a suitable set of structural elements around the label/field pairs to separate them out. Download the starting point for this task to work in your own editor or in an online editor. Assessment or further help You can practice this example in the Interactive Editor above. If you would like your work assessed, or are stuck and want to ask for help: Put your work into an online shareable editor such as CodePen, jsFiddle, or Glitch. You can write the code yourself, or use the starting point files linked to in the above sections. Write a post asking for assessment...
...asking for assessment and/or help at the MDN Discourse forum Learning category. Your post should include: A descriptive title such as "Assessment wanted for Form structure 1 skill test". Details of what you have already tried, and what you would like us to do, e.g. if you are stuck and need help, or want an assessment. A link to the example you want assessed or need help with, in an online shareable editor (as mentioned in step 1 above). This is a good practice to get into -- it's very hard to help someone with a coding problem if you can't see their code. A link to the actual task or assessment page, so we can find the question you want help with. ...
Test your skills: HTML5 controls - Learn web development
This aim of this skill test is to assess whether you've understood our The HTML5 input types article. Note: You can try out solutions in the interactive editors below, however it may be helpful to download the code and use an online tool such as CodePen, jsFiddle, or Glitch to work on the tasks. If you get stuck, then ask us for help -- see the Assessment or further help section at the bottom of this page. HTML5 controls 1 First let's explore some of the new HTML5 input types. Create appropriate inputs for a user to update their details for: Email Website Phone number Favourite color Try updating the live code below to recreate the finished example: Download the starting point for this task to work in your own editor or in an online editor. HTML5 controls 2 Next, we wan...
...e current value of the slider into. Give it a class of invite-output, and semantically associate it with the input. If you do this correctly, the JavaScript included on the page will automatically update the output value when the slider is moved. Try updating the live code below to recreate the finished example: Download the starting point for this task to work in your own editor or in an online editor. Assessment or further help You can practice these examples in the Interactive Editors above. If you would like your work assessed, or are stuck and want to ask for help: Put your work into an online shareable editor such as CodePen, jsFiddle, or Glitch. You can write the code yourself, or use the starting point files linked to in the above sections. Write a post asking for assessm...
...asking for assessment and/or help at the MDN Discourse forum Learning category. Your post should include: A descriptive title such as "Assessment wanted for HTML5 controls 1 skill test". Details of what you have already tried, and what you would like us to do, e.g. if you are stuck and need help, or want an assessment. A link to the example you want assessed or need help with, in an online shareable editor (as mentioned in step 1 above). This is a good practice to get into -- it's very hard to help someone with a coding problem if you can't see their code. A link to the actual task or assessment page, so we can find the question you want help with. ...
Test your skills: Styling basics - Learn web development
If you get stuck, then ask us for help -- see the Assessment or further help section at the bottom of this page. Styling basics 1 Our basic form styling assessment is fairly free-form, and you have a lot of flexibility over what you end up doing here. ...
...ree-form, and you have a lot of flexibility over what you end up doing here. But your CSS should aim to fulfill the following requirements: Add some kind of lightweight "reset" to make fonts, padding, margin, and sizing more consistent to begin with. On top of that, add in some nice, consistent styling for the inputs and button. Use some kind of layout technique to make the inputs and labels line up neatly. Download the starting point for this task to work in your own editor or in an online editor. Assessment or further help You can practice these examples in the Interactive Editors above. If you would like your work assessed, or are stuck and want to ask for help: Put your work into an online shareable editor such as CodePen, jsFiddle, or Glitch. You can write the code yourself...
...asking for assessment and/or help at the MDN Discourse forum Learning category. Your post should include: A descriptive title such as "Assessment wanted for Styling basics 1 skill test". Details of what you have already tried, and what you would like us to do, e.g. if you are stuck and need help, or want an assessment. A link to the example you want assessed or need help with, in an online shareable editor (as mentioned in step 1 above). This is a good practice to get into -- it's very hard to help someone with a coding problem if you can't see their code. A link to the actual task or assessment page, so we can find the question you want help with. ...
UI pseudo-classes - Learn web development
tent is placed relative to an element's formatting box, but form inputs work more like replaced elements and therefore don't have one), we will add an empty <span> to hang the generated content on: <div> <label for="fname">First name: </label> <input id="fname" name="fname" type="text" required> <span></span> </div> The immediate problem with this was that the span was dropping onto a new line below the input because the input and label are both set with width: 100%. To fix this we style the parent <div> to become a flex container, but also tell it to wrap its contents onto new lines if the content becomes too long: fieldset > div { margin-bottom: 20px; display: flex; flex-flow: row wrap; } The effect this has is that the label and input sit on separate lines because they are b...
... Now onto the generated content. ...
... the example live on GitHub at radios-checked-default.html (also see the source code.) For the :indeterminate example, we've got no default selected radio button -- this is important -- if there was, then there would be no indeterminate state to style. ...
Getting started with the Web - Learn web development
ng you to the practicalities of web development. You'll set up the tools you need to construct a simple webpage and publish your own simple code. The story of your first website It's a lot of work to create a professional website, so if you're new to web development, we encourage you to start small. You won't build another Facebook right away, but it's not hard to get your own simple website online, so we'll start there. By working through the articles listed below in order, you will go from nothing to getting your first webpage online. Let's begin our journey! Installing basic software When it comes to tools for building a website, there's a lot to pick from. If you're just starting out, you might be confused by the array of code editors, frameworks, and testing tools out there. In Inst...
...meworks, and testing tools out there. 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 will your website look like? Before you start writing the code for your website, you should plan it first. What information are you showcasing? What fonts and colors are you using? What will your website look like? We outline a simple method you can follow to plan out your site's content and design. Dealing with files A website consists of many files: text content, code, stylesheets, media content, and so on. When you're building a website, you need to assemble these files into a sensible structure and make sure they can talk to one another. Dealing with files explains how to set up a sensible file structure for you...
...xamples could be games, things that happen when buttons are pressed or data is entered in forms, dynamic styling effects, animation, and much more. JavaScript basics gives you an idea of what is possible with this exciting language, and how to get started. Publishing your website Once you have finished writing the code and organizing the files that make up your website, you need to put it all online so people can find it. Publishing your sample code describes how to get your simple sample code online with minimum effort. How the web works When you access your favorite website, a lot of complicated things happen in the background that you may not know about. How the web works outlines what happens when you view a webpage on your computer. ...
Structuring a page of content - Learn web development
es, and how to represent a prospective layout design in markup. Starting point To get this assessment started, you should go and grab the zip file containing all the starting assets. The zip file contains: The HTML you need to add structural markup to. CSS to style your markup. Images that are used on the page. Create the example on your local computer, or alternatively use an online tool such as CodePen, jsFiddle, or Glitch to work on the tasks. Note: If you get stuck, then ask us for help -- see the Assessment or further help section at the bottom of this page. Project brief For this project, your task is to take the content for the homepage of a bird watching website and add structural elements to it so it can have a page layout applied to it. It needs to have: A h...
...o put where, draw out a simple block diagram of the page layout, and write on the elements you think should wrap each block. This is extremely helpful. Example The following screenshot shows an example of what the homepage might look like after being marked up. Assessment or further help If you would like your work assessed, or are stuck and want to ask for help: Put your work into an online shareable editor such as CodePen, jsFiddle, or Glitch. Write a post asking for assessment and/or help at the MDN Discourse forum Learning category. Your post should include: A descriptive title such as "Assessment wanted for Structuring a page of content". Details of what you have already tried, and what you would like us to do, e.g. if you are stuck and need help, or want an assessment...
...king for assessment and/or help at the MDN Discourse forum Learning category. Your post should include: A descriptive title such as "Assessment wanted for Structuring a page of content". Details of what you have already tried, and what you would like us to do, e.g. if you are stuck and need help, or want an assessment. A link to the example you want assessed or need help with, in an online shareable editor (as mentioned in step 1 above). This is a good practice to get into -- it's very hard to help someone with a coding problem if you can't see their code. A link to the actual task or assessment page, so we can find the question you want help with. Previous Overview: Introduction to HTML In this module Getting started with HTML What's in the head? Metadata in H...
Test your skills: Advanced HTML text - Learn web development
The aim of this skill test is to assess whether you've understood our Advanced text formatting article. Note: You can try out solutions in the interactive editors below, however it may be helpful to download the code and use an online tool such as CodePen, jsFiddle, or Glitch to work on the tasks. If you get stuck, then ask us for help -- see the Assessment or further help section at the bottom of this page. Advanced HTML text 1 In this task we want you to turn the provided animals and their definitions into a description list. Try updating the live code below to recreate the finished example: Download the starting point for this task to work in your own editor or in an online editor. Advanced HTML text 2 In this task we want you to add some semantics to the provided HTML as f...
...ronyms, providing expansions as tooltips. Semantically associate machine-readable dates with the dates in the text. Use subscript and superscript to provide correct semantics for the chemical formulae and dates, and make them display correctly. Try updating the live code below to recreate the finished example: Download the starting point for this task to work in your own editor or in an online editor. Assessment or further help You can practice these examples in the Interactive Editors above. If you would like your work assessed, or are stuck and want to ask for help: Put your work into an online shareable editor such as CodePen, jsFiddle, or Glitch. You can write the code yourself, or use the starting point files linked to in the above sections. Write a post asking for assessm...
...ng for assessment and/or help at the MDN Discourse forum Learning category. Your post should include: A descriptive title such as "Assessment wanted for Advanced HTML text 1 skill test". Details of what you have already tried, and what you would like us to do, e.g. if you are stuck and need help, or want an assessment. A link to the example you want assessed or need help with, in an online shareable editor (as mentioned in step 1 above). This is a good practice to get into -- it's very hard to help someone with a coding problem if you can't see their code. A link to the actual task or assessment page, so we can find the question you want help with. ...
What’s in the head? Metadata in HTML - Learn web development
document. This however can get confused with the <h1> element, which is used to add a top level heading to your body content -- this is also sometimes referred to as the page title. But they are different things! The <h1> element appears on the page when loaded in the browser -- generally this should be used once per page, to mark up the title of your page content (the story title, or news headline, or whatever is appropriate to your usage.) The <title> element is metadata that represents the title of the overall HTML document (not the document's content.) Active learning: Inspecting a simple example To start off this active learning, we'd like you to go to our GitHub repo and download a copy of our title-example.html page. To do this, either Copy and paste the code out of the ...
...ould also be thought of as metadata too. There are a lot of different types of <meta> elements that can be included in your page's <head>, but we won't try to explain them all at this stage, as it would just get too confusing. Instead, we'll explain a few things that you might commonly see, just to give you an idea. Specifying your document's character encoding In the example we saw above, this line was included: <meta charset="utf-8"> This element simply specifies the document's character encoding -- the character set that the document is permitted to use. utf-8 is a universal character set that includes pretty much any character from any human language. This means that your web page will be able to handle displaying any language; it's therefore a good idea to set this on every web page y...
... browser tab containing each open page, and next to bookmarked pages in the bookmarks panel. A favicon can be added to your page by: Saving it in the same directory as the site's index page, saved in .ico format (most browsers will support favicons in more common formats like .gif or .png, but using the ICO format will ensure it works as far back as Internet Explorer 6.) Adding the following line into your HTML's <head> block to reference it: <link rel="shortcut icon" href="favicon.ico" type="image/x-icon"> Here is an example of a favicon in a bookmarks panel: There are lots of other icon types to consider these days as well. For example, you'll find this in the source code of the MDN Web Docs homepage: <!-- third-generation iPad with high-resolution Retina display: --> <link re...
Mozilla splash page - Learn web development
a new directory. Then save pattern.png in the same directory (right click on the image to get an option to save it.) Access the different images in the originals directory and save them in the same way; you'll want to save them in a different directory for now, as you'll need to manipulate (some of) them using a graphics editor before they're ready to be used. Alternatively, you could use an online tool such as Glitch to create your example. This would also be useful if you want to get it assessed, or ask for help -- see the Assessment or further help section at the bottom of this page. Note: The example HTML file contains quite a lot of CSS, to style the page. You don't need to touch the CSS, just the HTML inside the <body> element -- as long as you insert the correct markup, the styling...
...es the small portrait panda image if the viewport is 600px wide or less, and the large landscape image otherwise. Example The following screenshots show what the splash page should look like after being correctly marked up, on a wide and narrow screen display. 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. Glitch is probably better for this example, as it allows you upload assets like images, whereas some of the other tools don't. Write a post asking for assessment and/or help at the MDN Discourse forum. Add the "learning" tag to your post so we are able to more easily find it. Your post should include: A descriptive title such as "Asses...
...p at the MDN Discourse forum. Add the "learning" tag to your post so we are able to more easily find it. Your post should include: A descriptive title such as "Assessment wanted for Mozilla splash page". Details of what you would like us to do -- for example what you have already tried, if you are stuck and need help,. A link to the example you want assessed or need help with, in an online editor. This is a good practice to get into -- it's very hard to help someone with a coding problem if you can't see their code. A link to the actual task or assessment page, so we can find the question you want help with. Previous Overview: Multimedia and embedding In this module Images in HTML Video and audio content From <object> to <iframe> -- other embedding technologie...
Assessment: Structuring planet data - Learn web development
ssment, make local copies of blank-template.html, minimal-table.css, and planets-data.txt in a new directory in your local computer. If you get stuck, then ask us for help -- see the Assessment or further help section at the bottom of this page. Note: Alternatively, you could use a site like JSBin or Glitch to do your assessment. You could paste the HTML, CSS and JavaScript into one of these online editors. If the online editor you are using doesn't have separate JavaScript/CSS panels, feel free to put them inline <script>/<style> elements inside the HTML page. Project brief You are working at a school; currently your students are studying the planets of our solar system, and you want to provide them with an easy-to-follow set of data to look up facts and figures about the planets. An HT...
...sit to the left of the planet name row headings (e.g. Saturn) are a little tricky to sort out -- you need to make sure each one spans the correct number of rows and columns. One way of associating headers with their rows/columns is a lot easier than the other way. Assessment or further help If you would like your work assessed, or are stuck and want to ask for help: Put your work into an online shareable editor such as CodePen, jsFiddle, or Glitch. Write a post asking for assessment and/or help at the MDN Discourse forum Learning category. Your post should include: A descriptive title such as "Assessment wanted for Structuring planet data". Details of what you have already tried, and what you would like us to do, e.g. if you are stuck and need help, or want an assessment. A...
...ost asking for assessment and/or help at the MDN Discourse forum Learning category. Your post should include: A descriptive title such as "Assessment wanted for Structuring planet data". Details of what you have already tried, and what you would like us to do, e.g. if you are stuck and need help, or want an assessment. A link to the example you want assessed or need help with, in an online shareable editor (as mentioned in step 1 above). This is a good practice to get into -- it's very hard to help someone with a coding problem if you can't see their code. A link to the actual task or assessment page, so we can find the question you want help with. Previous Overview: Tables In this module HTML table basics HTML table advanced features and accessibility Structu...
Introducing asynchronous JavaScript - Learn web development
result is returned as soon as the browser can do so. Let's look at a simple example (see it live here, and see the source): const btn = document.querySelector('button'); btn.addEventListener('click', () => { alert('You clicked me!'); let pElem = document.createElement('p'); pElem.textContent = 'This is a newly-added paragraph.'; document.body.appendChild(pElem); }); In this block, the lines are executed one after the other: We grab a reference to a <button> element that is already available in the DOM. We add a click event listener to it so that when the button is clicked: An alert() message appears. Once the alert is dismissed, we create a <p> element. We then give it some text content. Finally, we append the paragraph to the document body. While each ope...
...onous code? Let's look at a quick example. When you fetch an image from a server, you can't return the result immediately. That means that the following (pseudocode) wouldn't work: let response = fetch('myImage.png'); let blob = response.blob(); // display your image blob in the UI somehow That's because you don't know how long the image will take to download, so when you come to run the second line it will throw an error (possibly intermittently, possibly every time) because the response is not yet available. Instead, you need your code to wait until the response is returned before it tries to do anything else to it. There are two main types of asynchronous code style you'll come across in JavaScript code, old-style callbacks and newer promise-style code. In the below sections we'll review...
...createElement('img'); image.src = objectURL; document.body.appendChild(image); }).catch((error) => { console.log('There has been a problem with your fetch operation: ' + error.message); }); console.log ('All done!'); The browser will begin executing the code, see the first console.log() statement (Starting) and execute it, and then create the image variable. It will then move to the next line and begin executing the fetch() block but, because fetch() executes asynchronously without blocking, code execution continues after the promise-related code, thereby reaching the final console.log() statement (All done!) and outputting it to the console. Only once the fetch() block has completely finished running and delivering its result through the .then() blocks will we finally see the second...
Multimedia: Images - Learn web development
+ 8 bit transparency -- offer no more than 255 colors but maintain smooth transparencies. The size is not too big. Those are the PNGs you would probably want. 8 bit color + 1 bit transparency -- offer no more than 255 colors and just offer no or full transparency per pixel which makes the transparency borders appear hard and jagged. The size is small but the price is visual fidelity. A good online tool for optimizing SVGs is SVGOMG. For PNGs there is ImageOptim online or Squoosh. With photographic motifs that do not feature transparency there is a lot wider range of formats to chose from. If you want to play it safe, then you would go for well compressed Progressive JPEGs. Progressive JPEGs, in contrast to normal JPEGs, render progressively (hence the name), meaning the user sees a low-re...
...l compressed Progressive JPEGs. Progressive JPEGs, in contrast to normal JPEGs, render progressively (hence the name), meaning the user sees a low-resolution version that gains clarity as the image downloads, rather than the image loading at full resolution top-to-bottom or even only rendering once completely downloaded. A good compressor for these would be MozJPEG, e.g. available to use in the online image optimization tool Squoosh. A quality setting of 75% should yield decent results. Other formats improve on JPEG's capabilities in regards to compression, but are not available on every browser: WebP -- created by Google and nowadays supported by all major browsers except Safari. Supports transparency and also animation, but not progressive display. JPEG-XR -- created by Microsoft and ...
... costs into the equation, the only serious contender for JPEG today is WebP. Which is why you could consider offering your images in that flavor, too, for the browsers that support it. This can be done via the <picture> element with the help of a <source> element equipped with a type attribute. If all of this sounds a bit complicated or feels like too much work for your team then there is also online services that you can use as image CDNs that will automate the serving of the correct image format on-the-fly, according to the type of device or browser requesting the image. The biggest ones are Cloudinary and Image Engine. And finally, should you want to include animated images into your page, then know that Safari allows using video files within <img> and <picture> elements. These also allow...
Multimedia: video - Learn web development
ribe each of these optimization techniques. Compress all videos Most video compression work compares adjacent frames within a video, with the intent of removing detail that is identical in both frames. Compress the video and export to multiple video formats, including WebM, MPEG-4/H.264, and Ogg/Theora. Your video editing software probably has a feature to reduce file size. If not, there are online tools, such as FFmpeg (discussed in section below), that encode, decode, convert, and perform other optimization functions. Optimize <source> order Order video source from smallest to largest. For example, given video compressions in three different formats at 10MB, 12MB, and 13MB, declare the smallest first and the largest last: <video width="400" height="300" controls="controls"> <!-- Web...
...GIF. While a 128 Kb video may seem like it could provide a better user experience than a 10 MB download, a grainy GIF-like video may reflect poorly on the brand or project. See CanIUse.com for current browser support of video and other media types. Video autoplay To ensure that a looping background video autoplays, you must add several attributes to the video tag: autoplay, muted, and playsinline. <video autoplay="" loop="" muted="true" playsinline="" src="backgroundvideo.mp4"> While the loop and autoplay make sense for a looping and autoplaying video, the muted attribute is required for autoplay in mobile browsers. Playsinline is required for mobile Safari, allowing videos to play without forcing fullscreen mode. Remove audio from muted hero videos For hero-video or other video with...
... While the loop and autoplay make sense for a looping and autoplaying video, the muted attribute is required for autoplay in mobile browsers. Playsinline is required for mobile Safari, allowing videos to play without forcing fullscreen mode. Remove audio from muted hero videos For hero-video or other video without audio, removing audio is smart. <video autoplay="" loop="" muted="true" playsinline="" id="hero-video"> <source src="banner_video.webm" type='video/webm; codecs="vp8, vorbis"'> <source src="web_banner.mp4" type="video/mp4"> </video> This hero-video code (above) is common to conference websites and corporate home pages. It includes a video that is auto-playing, looping, and muted. There are no controls, so there is no way to hear audio. The audio is often empty, bu...
Routing in Ember - Learn web development
rameworks Next In this article we learn about routing, or URL-based filtering as it is sometimes referred to. We'll use it to provide a unique URL for each of the three todo views -- "All", "Active", and "Completed". Prerequisites: At minimum, it is recommended that you are familiar with the core HTML, CSS, and JavaScript languages, and have knowledge of the terminal/command line. A deeper understanding of modern JavaScript features (such as classes, modules, etc), will be extremely beneficial, as Ember makes heavy use of them. Objective: To learn about implementing routing in Ember. URL-based filtering Ember comes with a routing system that has a tight integration with the browser URL. Typically, when writing web applications, you want the pa...
...w files, but also updated an existing file, app/router.js. It contains the following contents: import EmberRouter from '@ember/routing/router'; import config from './config/environment'; export default class Router extends EmberRouter { location = config.locationType; rootURL = config.rootURL; } Router.map(function() { this.route('completed'); this.route('active'); }); The highlighted lines were added when the 2nd and 3rd commands above were run. router.js behaves as a "sitemap" for developers to be able to quickly see how the entire app is structured. It also tells Ember how to interact with your route, such as when loading arbitrary data, handling errors while loading that data, or interpreting dynamic segments of the URL. Since our data is static, we won't get to any of those ...
...It also tells Ember how to interact with your route, such as when loading arbitrary data, handling errors while loading that data, or interpreting dynamic segments of the URL. Since our data is static, we won't get to any of those fancy features, but we'll still make sure that the route provides the minimally required data to view a page. Creating the "Index" route did not add a route definition line to router.js, because like with URL navigation and JavaScript module loading, "Index" is a special word that indicates the default route to render, load, etc. To adjust our old way of rendering the TodoList app, we'll first need to replace the TodoList component invocation from the application template with an {{outlet}} call, which means "any sub-route will be rendered in place here". Go to th...
Accessibility in React - Learn web development
evious Overview: Client-side JavaScript frameworks Next In our final tutorial article, we'll focus on (pun intended) accessibility, including focus management in React, which can improve usability and reduce confusion for both keyboard-only and screenreader users. Prerequisites: Familiarity with the core HTML, CSS, and JavaScript languages, knowledge of the terminal/command line. Objective: To learn about implementing keyboard accessibility in React. Including keyboard users At this point, we've accomplished all of the features we set out to implement. A user can add a new task, check and uncheck tasks, delete tasks, or edit task names. And they can filter their task list by all, active, or completed tasks. Or, at least: they can do all of these ...
...And they can filter their task list by all, active, or completed tasks. Or, at least: they can do all of these things with a mouse. Unfortunately, these features are not very accessible to keyboard-only users. Let's explore this now. Exploring the keyboard usability problem Start by clicking on the input at the top of our app, as if you're going to add a new task. You'll see a thick, dashed outline around that input. This outline is your visual indicator that the browser is currently focused on this element. Press the Tab key, and you will see the outline appear around the "Add" button beneath the input. This shows you that the browser's focus has moved. Press Tab a few more times, and you will see this dashed focus indicator move between each of the filter buttons. Keep going until the fo...
...f.current.focus(); } }, [tasks.length, prevTaskLength]); We only try to focus on our list heading if we have fewer tasks now than we did before. The dependencies passed into this hook ensure it will only try to re-run when either of those values (the number of current tasks, or the number of previous tasks) changes. Now, when you delete a task in your browser, you will see our dotted focus outline appear around the heading above the list. Finished! You've just finished building a React app from the ground up! Congratulations! The skills you've learned here will be a great foundation to build on as you continue working with React. Most of the time, you can be an effective contributor to a React project even if all you do is think carefully about components and their state and props. Reme...
React interactivity: Editing, filtering, conditional rendering - Learn web development
'll add the finishing touches to the main areas of functionality in our Todo list app. This includes allowing you to edit existing tasks, and filtering the list of tasks between all, completed, and incomplete tasks. We'll look at conditional UI rendering along the way. Prerequisites: Familiarity with the core HTML, CSS, and JavaScript languages, knowledge of the terminal/command line. Objective: To learn about conditional rendering in React, and implementing list filtering and an editing UI in our app. Editing the name of a task We don't have a user interface for editing the name of a task yet. We'll get to that in a moment. To start with, we can at least implement an editTask() function in App.js. It'll be similar to deleteTask() because it'll take an...
...UI for editing In order to allow users to edit a task, we have to provide a user interface for them to do so. First, import useState into the Todo component like we did before with the App component, by updating the first import statement to this: import React, { useState } from "react"; We'll now use this to set an isEditing state, the default state of which should be false. Add the following line just inside the top of your Todo(props) { ... } component definition: const [isEditing, setEditing] = useState(false); Next, we're going to rethink the <Todo /> component -- from now on, we want it to display one of two possible "templates", rather than the single template it's used so far: The "view" template, when we are just viewing a todo; this is what we've used in rest of the tutorial ...
...} onClick={() => props.setFilter(props.name)} > <span className="visually-hidden">Show </span> <span>{props.name}</span> <span className="visually-hidden"> tasks</span> </button> ); } Visit your browser again. You should see that the different buttons have been given their respective names. When you press a filter button, you should see its text take on a new outline -- this tells you it has been selected. And if you look at your DevTool's Page Inspector while clicking the buttons, you'll see the aria-pressed attribute values change accordingly. However, our buttons still don't actually filter the todos in the UI! Let's finish this off. Filtering tasks in the UI Right now, our taskList constant in App() maps over the tasks state and returns a new <Todo /...
Dynamic behavior in Svelte: working with variables and props - Learn web development
ping the required features for our Svelte To-Do list app. In this article we'll be using variables and props to make our app dynamic, allowing us to add and delete todos, mark them as complete, and filter them by status. Prerequisites: At minimum, it is recommended that you are familiar with the core HTML, CSS, and JavaScript languages, and have knowledge of the terminal/command line. You'll need a terminal with node + npm installed to compile and build your app. Objective: Learn and put into practice some basic Svelte concepts, like creating components, passing data using props, render JavaScript expressions into our markup, modify the components state and iterating over lists. Code along with us Git Clone the github repo (if you haven't already...
...Try this now. <Todos {todos} /> At this point your todos should render just like they did before, except that now we're passing them in from the App.svelte component. Toggling and removing todos Let's add some functionality to toggle the task status. Svelte has the on:eventname directive for listening to DOM events. Let's add a handler to the on:click event of the checkbox inp...
...Ds for our todos! Let's declare a newTodoId variable calculated from the number of todos plus 1, and make it reactive. Add the following snippet to the <script> section: let newTodoId $: { if (totalTodos === 0) { newTodoId = 1; } else { newTodoId = Math.max(...todos.map(t => t.id)) + 1; } } Note: as you can see, reactive statements are not limited to one-liners. The following would work too, but it is a little less readable: $: newTodoId = totalTodos ? Math.max(...todos.map(t => t.id)) + 1 : 1 How does Svelte achieve this? The compiler parses the whole reactive statement, and detects that it depends on the totalTodos variable and the todos array. So whenever either of them is modified, this code is re-evaluated, updating newTodoId accordingly...
Creating our first Vue component - Learn web development
sing data to them via props, and saving data state. Note: If you need to check your code against our version, you can find a finished version of the sample Vue app code in our todo-vue repository. For a running live version, see https://mdn.github.io/todo-vue/dist/. Prerequisites: Familiarity with the core HTML, CSS, and JavaScript languages, knowledge of the terminal/command line. Vue components are written as a combination of JavaScript objects that manage the app's data and an HTML-based template syntax that maps to the underlying DOM structure. For installation, and to use some of the more advanced features of Vue (like Single File Components or render functions), you'll need a terminal with node + npm installed. Objective: To learn how to create a...
... of the label prop. Your component's template section should now look like this: <template> <div> <input type="checkbox" id="todo-item" checked="false" /> <label for="todo-item">{{label}}</label> </div> </template> Go back to your browser and you'll see the todo item rendered as before, but without a label (oh no!). Go to your browser's DevTools and you'll see a warning along these lines in the console: [Vue warn]: Missing required prop: "label" found in ---> <ToDoItem> at src/components/ToDoItem.vue <App> at src/App.vue <Root> This is because we marked the label as a required prop, but we never gave the component that prop -- we've defined where inside the template we want it used, but we haven't passed it into the component when calling it. Let's fix that.
...nteger to the end of the prefix. This will be sufficient for keeping component ids unique. Let's add the package to our project with npm; stop your server and enter the following command into your terminal: npm install --save lodash.uniqueid Note: If you prefer yarn, you could instead use yarn add lodash.uniqueid. We can now import this package into our ToDoItem component. ...
Focus management with Vue refs - Learn web development
s keyboard accessibility. We'll look at using Vue refs to handle this -- an advanced feature that allows you to have direct access to the underlying DOM nodes below the virtual DOM, or direct access from one component to the internal DOM structure of a child component. Prerequisites: Familiarity with the core HTML, CSS, and JavaScript languages, knowledge of the terminal/command line. Vue components are written as a combination of JavaScript objects that manage the app's data and an HTML-based template syntax that maps to the underlying DOM structure. For installation, and to use some of the more advanced features of Vue (like Single File Components or render functions), you'll need a terminal with node + npm installed. Objective: To learn how to handle f...
...e aren't providing a great experience for non-mouse users. Specifically, when a user activates the "Edit" Button, we remove the "Edit" Button from the DOM, but we don't move the user's focus anywhere, so in effect it just disappears. This can be disorienting for keyboard and non-visual users. To understand what's currently happening: Reload your page, then press Tab. You should see a focus outline on the input for adding new to-do items. Press Tab again. The focus should move to the "Add" button. Hit it again, and it'll be on the first checkbox. One more time, and focus should be on the first "Edit" button. Activate the "Edit" button by pressing Enter. The checkbox will be replaced with our edit component, but the focus outline will be gone. This behavior can be jarring. In addition, ...
...ItemName) { this.$emit("item-edited", newItemName); this.isEditing = false; this.focusOnEditButton(); }, editCancelled() { this.isEditing = false; this.focusOnEditButton(); }, Try editing and then saving/cancelling a to-do item via your keyboard. You'll notice that focus isn't being set, so we still have a problem to solve. If you open your console, you'll see an error raised along the lines of "can't access property "focus", editButtonRef is undefined". This seems weird. Your button ref was defined when you activated the "Edit" Button, but now it's not. What is going on? Well, remember that when we change isEditing to true, we no longer render the section of the component featuring the "Edit" Button. This means there's no element to bind the ref to, so it becomes undefined. You m...
Rendering a list of Vue components - Learn web development
y working component; we're now ready to add multiple ToDoItem components to our App. In this artcle we'll look at adding a set of todo item data to our App.vue component, which we'll then loop through and display inside ToDoItem components using the v-for directive. Prerequisites: Familiarity with the core HTML, CSS, and JavaScript languages, knowledge of the terminal/command line. Vue components are written as a combination of JavaScript objects that manage the app's data and an HTML-based template syntax that maps to the underlying DOM structure. For installation, and to use some of the more advanced features of Vue (like Single File Components or render functions), you'll need a terminal with node + npm installed. Objective: To learn how to loop thr...
...ed to get an array of to-do items. To do that, we'll add a data property to the App.vue component object, containing a ToDoItems field whose value is an array of todo items. While we'll eventually add a mechanism to add new todo items, we can start with some mock to do items. Each to-do item will be represented by an object with a name and a done property. Add a few sample to-do items, along the lines of those seen below. This way you have some data available for rendering using v-for. export default { name: 'app', components: { ToDoItem }, data() { return { ToDoItems: [ { label: 'Learn Vue', done: false }, { label: 'Create a Vue project with the CLI', done: true }, { label: 'Have fun', done: true }, { label: 'Create a to-do list', done: ...
...rictly necessary, it makes it easier for us to manage since we already need to create a unique id for each todo item anyway. Add a new prop to your ToDoItem component -- id. Make it required, and make its type a String. To prevent name collisions, remove the id field from your data attribute. You are no longer using uniqueId, so you need to remove the import uniqueId from 'lodash.uniqueid'; line, otherwise your app will throw an error. The <script> contents in your ToDoItem component should now look something like this: export default { props: { label: {required: true, type: String}, done: {default: false, type: Boolean}, id: {required: true, type: String} }, data() { return { isDone : this.done, } }, } Now, over in y...
Accessibility Features in Firefox
rd navigation within the entire Windows OS much simpler. Both history and bookmarks can be searched with a "quick search" field that quickly narrows the list down via a substring search. Bookmarks can have a keyword assigned to them which can be typed into the address bar to bring up the bookmark. A "smart keywords" feature enhances this even further by allowing custom searches from the command line such as "word punditry" to look up the word "punditry" in an online dictionary. These smart keywords can be setup via the context menu for the search field on the desired website. Integrated web search via Ctrl+K is much faster to use than first going to the search tool's web site. Custom searches can be added to this quick search bar and the user can switch between them by choosing from a drop ...
...butes Accessible Web Applications (DHTML and AJAX) IBM realized it needed a way to enable accessibility for ever more powerful web applications, beyond what you see on typical web pages today. Rather than go and write their own new web browser, IBM decided to trust in the openness of the Mozilla community, which accepted IBM's significant contributions. For example, IBM has delivered over 50,000 lines of code to enable accessibility in Firefox on Windows and especially for this new powerful world of "web applications". A web application may be an easier-to-use online tax assistant, a web calendar or a live sports statistics page, which is familiar in that it acts much like a desktop application. Whether the current buzzword for this technology is "DHTML", "AJAX" or "Web 2.0" doesn't really ma...
...use the same core accessibility work applies to Linux. The two companies anticipate that in 2007, Firefox will support topnotch screen reader accessibility on UNIX and Linux. That's the great thing about the open Firefox community model and source code license -- anyone can contribute, and everyone benefits. Downloads, Support and More Information Firefox information and downloads General online support and community forums Accessibility newsgroup for users. Can also be accessed as a mailing list. Accessibility compliance statement (section 508): http://www.mozilla.com/firefox/vpat.html ...
Debugging Table Reflow
m and not the source of layout bugs is a frame reflow debug log. Look there especially how the maxElementsize (MES) and desired size are propagated. Block Reflow Another way to debug the reflow process is implemented inside nsBlockFrame.cpp. ...
...e nsBlockFrame.cpp. It can be invoked by set GECKO_BLOCK_DEBUG_FLAGS=reflow The available options are: reflow really-noisy-reflow max-element-size space-manager 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 table layout ...
...sAnonymous=0 constraint=0 widths=-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 **END COL DUMP** **START COL DUMP** colIndex=2 isAnonymous=0 constraint=0 widths=-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 **END COL DUMP** **START COL DUMP** colIndex=3 isAnonymous=0 constraint=0 widths=-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 **END COL DUMP** ***END TABLE DUMP*** The en stands for entrance (ex for leaving a routine). The first line of the data dump shows that no width has yet been assigned to the columns mColWidths=-1 -1 -1 -1, -1 stands for: #define WIDTH_NOT_SET -1 This is followed by a reference to the column frame 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. The index of the column, whether it is anonymous and...
Configuring Build Options
builds. Most of the time a mozconfig file is not required. The default options are the most well-supported, so it is preferable to add as few options as possible. Please read the following directions carefully before building, and follow them in order. Skipping any step may cause the build to fail, or the built software to be unusable. Build options, including options not usable from the command-line, may appear in "confvars.sh" files in the source tree. Using a mozconfig configuration file The choice of which Mozilla application to build and other configuration options can be configured in a mozconfig file. (It is possible to manually call configure with command-line options, but this is not recommended). The mozconfig file should be in your source directory (that is, /mozilla-central/mozc...
...ot intermingled in your directory system and you can build multiple applications (e.g., Firefox and Thunderbird) from the same source tree. If you do not specify a MOZ_OBJDIR, it will be automatically set to @TOPSRCDIR@/obj-@CONFIG_GUESS@. If you need to re-run configure, the easiest way to do it is using ./mach configure; running configure manually is strongly discouraged. Adding the following line to your mozconfig allows you to change the objdir: mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/obj-@CONFIG_GUESS@ It is a good idea to have your objdir name start with obj so that Mercurial ignores it. Sometimes it can be useful to build multiple versions of the source (such as with and without diagnostic asserts). To avoid the time it takes to do a full rebuild, you can create multiple mozconfig f...
...n each object directory. For example: ac_add_options --disable-optimize --enable-debug mk_add_options MOZ_OBJDIR=/mozilla/src/obj-@CONFIG_GUESS@ mk_add_options MOZ_BUILD_PROJECTS="browser mail" ac_add_app_options browser --enable-application=browser ac_add_app_options mail --enable-application=comm/mail If you want to build only one project using this mozconfig, use the following command line: MOZ_CURRENT_PROJECT=browser ./mach build This will build only the browser. Using multiple mozconfig files Alternatively, you may want to create separate mozconfig files. As an example, the following steps can be used to build Firefox and Thunderbird. You should first create three mozconfig files. mozconfig-common: # add common options here, such as making an optimized release build mk_ad...
Old Thunderbird build
nbundled folder's name is now "mozilla" and not "mozilla-central"). Then run "python client.py checkout" to ensure you are up-to-date. The source code requires 3.6GB of free space or more and additionally 5GB or more for default build. Build configuration To build Thunderbird, you need to add a file named mozconfig to the root directory of the comm-central checkout that contains the following line: ac_add_options --enable-application=mail You can create a file with this line by doing this: cd comm-central echo 'ac_add_options --enable-application=mail' > mozconfig If you omit this line, the build system will build Firefox instead. Other build configuration options can be added to this file, although it's strongly recommended that you only use options that you fully understand. For exa...
...DIR it cannot be a sibling folder to your source directory. Use an absolute path to be sure! Building Thunderbird Before you start, make sure that the version you checked out is not busted. For hg tip, you should see green Bs on https://treeherder.mozilla.org/#/jobs?repo=comm-central To start the build, cd into the comm-central subdirectory, and run: ./mozilla/mach build mach is our command-line tool to streamline common developer tasks. See the mach article for more. Building can take a significant amount of time, depending on your system, OS, and chosen build options. Linux builds on a fast box may take under 15 minutes, but Windows builds on a slow box may take several hours. Tips for making builds faster. The executable will be at the location listed under Running below. Building ...
...dows builds on a slow box may take several hours. Tips for making builds faster. The executable will be at the location listed under Running below. Building Thunderbird and Lightning If you've set up your build environment as above, then all you need to do is: echo 'ac_add_options --enable-calendar' >> mozconfig in the comm-central directory, or just add the ac_add_options --enable-calendar line to your mozconfig with your favorite editor. Then just re-run the mach command above (you can do the addition before running mach for the first time). Running To run your build, you can use ./mozilla/mach run There are various command line parameters you can add, e.g. to specify a profile. Various temporary files, libraries, and the Thunderbird executable will be found in your object direct...
Obsolete Build Caveats and Tips
the code for Firefox 3/Mozilla 1.9 and earlier can check out the latest source using CVS. In reality, you should probably not need to do this, since that code is very obsolete. This note below seems redundant as this is true by default https://msdn.microsoft.com/en-us/library/dh8che7s%28v=vs.110%29.aspx Note: Starting with Gecko 7.0, you should no longer include "-Zc:wchar_t-" in the command line when building on Windows. If you're using Visual Studio, go to Project Properties > C/C++ > Language > Treat wchar_t as Built-in Type and set it to "yes". From Source_Code/Mercurial mozilla-2.0 (Firefox 4.0) Code for the Firefox 4.0 (Gecko 2.0) release lives in releases/mozilla-2.0. To get this code, do the following: # Pull the Mozilla source to the folder 20src/ - may take a while # as h...
...uninstall it. The SDK will break builds even if you try to use other SDKs. Other possible workarounds: Use another SDK (the one shipped with Visual Studio 9). Delete the vcvars32.bat file and repair your Visual Studio installation with the setup program. Edit vcvars32.bat to correct the problem (see http://blogs.msdn.com/windowssdk/arc...vironment.aspx "Workaround: Repair the VS2008 command line build environment by editing c:\Program Files\Microsoft Visual Studio 9.0\VC\bin\vcvars32.bat manually"). SDKs older than the Server 2003 R2 Platform SDK aren't supported either. From Windows build prerequisites [en-US] Microsoft Visual C++ (MSVC) Depending on what you're building, you will need to use one of several available versions of Microsoft Visual C++ (MSVC) and/or Microsoft Visu...
... Visual C++ 10 is available from Microsoft as part of the free Visual C++ 2010 Express Edition. Visual C++ 9 is available from Microsoft as part of the free Visual C++ 2008 Express Edition with SP1 (make sure you get this and not the one without SP1!). You do not need to install the Silverlight runtime or the SQL Server 2008 Express Edition when offered. Alternatively you can install the command-line compiler as part of the Windows 7 SDK, but you are then expected to use the included WinDbg debugger. The Visual C++ 8 command-line compiler is included with the Vista SDK, but you are then expected to use the included WinDbg debugger. From Configuring Build Options [en-US] Note: Starting with Gecko 5.0, building Firefox has become extremely simple. The default application is now Firefox, ...
Experimental features in Firefox
39607. Release channel Version added Enabled by default? Nightly 78 Yes Developer Edition 78 Yes Beta 78 Yes Release 78 No Preference name network.preload CSS Display stray control characters in CSS as hex boxes This feature renders control characters (Unicode category Cc) other than tab (U+0009), line feed (U+000A), form feed (U+000C), and carriage return (U+000D) as a hexbox when they are not expected. See bug 1099557 for more details. Release channel Version added Enabled by default? Nightly 43 Yes Developer Edition 43 No Beta 43 No Release 43 No Preference name layout.css.control-characters.enable...
...ore details. Release channel Version added Enabled by default? Nightly 43 Yes Developer Edition 43 No Beta 43 No Release 43 No Preference name layout.css.control-characters.enabled or layout.css.control-characters.visible Property: initial-letter The initial-letter CSS property is part of the CSS Inline Layout specification and allows you to specify how dropped, raised, and sunken initial letters are displayed. See bug 1223880 for more details. Release channel Version added Enabled by default? Nightly 50 No Developer Edition 50 No Beta 50 No Release 50 No Preference name layout.css.initial-letter.enabl...
...04 and bug 1137699 for more details. Release channel Version added Enabled by default? Nightly 72 No Developer Edition 72 No Beta 72 No Release 72 No Preference name devtools.inspector.color-scheme-simulation.enabled Execution context selector This feature displays a button on the console's command line that lets you change the context in which the expression you enter will be executed. See bug 1605154 and bug 1605153 for more details. Release channel Version added Enabled by default? Nightly 75 No Developer Edition 75 No Beta 75 No Release 75 No Preference name devtools.webconsole.input.context Mo...
Gecko's "Almost Standards" Mode
As of Mozilla 1.0.1 and 1.1 beta, there is a new rendering mode referred to as "almost standards" mode. This is added to the long-standing "quirks" and "standards" modes. "Almost standards" rendering mode is exactly the same as "standards" mode in all details save one, where it works like "quirks" mode: the height calculations for line boxes and some of the inline elements in them. A common case that this affects is the layout of images inside table cells. This means that sliced-images-in-tables layouts are less likely to fall apart in Gecko-based browsers based on the rendering engine found in Mozilla 1.0.1 or later when in either "quirks" or "almost standards" mode. (See the DevEdge article "Images, Tables, and Mysterious Gaps" for a detailed explanation of how such layouts are tre...
...outs are less likely to fall apart in Gecko-based browsers based on the rendering engine found in Mozilla 1.0.1 or later when in either "quirks" or "almost standards" mode. ...
...ther "quirks" or "almost standards" mode. (See the DevEdge article "Images, Tables, and Mysterious Gaps" for a detailed explanation of how such layouts are treated in "standards" mode.) In slightly more detail, what differs in almost-standards mode is roughly this: inline boxes that have no non-whitespace text as a child and have no border, padding, or margin: do not influence the size of the line box (that is, their line-height is ignored) do not get a height (e.g., for their background) larger than that of their descendants, even if their font size is larger (if they have no descendants, they are zero-height positioned at their baseline) Other than this one difference, "almost standards" and "standards" modes are exactly the same in terms of layout and other behaviors. Triggering "Al...
How Mozilla determines MIME Types
e image. If the server did not send a Content-Type header, Mozilla uses the unknown decoder to find a MIME type. File URIs For file: URIs, Mozilla will ask the ExternalHelperAppService for a MIME type. FTP Like HTTP URIs without a MIME type, FTP URIs go through the unknown decoder. Unknown Decoder Located at netwerk/streamconv/converters/nsUnknownDecoder.cpp, the interesting part starts at line 287, the sSnifferEntries array together with the DetermineContentType function. It does the following: Checks the start of the file for "magic numbers"; this can currently detect PDF and Postscript. If the file starts with <?xml, asks the ExternalHelperAppService for a MIME type for the URI. This is done because the generic text/xml MIME type does not work for XUL files, and XHTML files get a...
...Firstly, the Operating System is asked for a MIME type. (On Unix, this means checking mime.types.) If that fails, a user-supplied helper app is searched for by extension, and the specified MIME type will be used...
...is not listed there, it becomes interesting. Firstly, the Operating System is asked for a MIME type. (On Unix, this means checking mime.types.) If that fails, a user-supplied helper app is searched for by extension, and the specified MIME type will be used. (i.e. the list in Edit/Preferences/Helper Applications) If that failed, a list of "extra" MIME types is searched for an extension match. See line 507 for the complete list. If that also failed, the list of loaded plugins is checked for a plugin that can handle this extension, and is asked for the MIME type If no plugin is registered, the ext-to-type-mapping XPCOM category is searched for the extension. This allows extensions to register additional mappings. The key of the category entry is the extension without leading dot, the value is ...
Extending a Protocol
ng and receiving messages. And we also need to implement the actual management of these objects by dom/ipc/WindowGlobalChild.{h|cpp} and dom/ipc/WindowGlobalParent.{h|cpp}. If we now do ./mach build, it complains that "fatal error: 'mozilla/dom/EchoChild.h' file not found". That gives us a good place to start. Defining EchoChild.h Create ./dom/ipc/EchoChild.h, and define it as follows - the inline comments describe what's going on: #ifndef mozilla_dom_EchoChild_h #define mozilla_dom_EchoChild_h // We include the protocol, which is automatically generated for us. #include "mozilla/dom/PEchoChild.h" namespace mozilla { namespace dom { // Note that EchoChild extends the protocol implementation. // the protocol implementation will give us the actual // methods for sending messages, as we w...
...tically generated for us. #include "mozilla/dom/PEchoChild.h" namespace mozilla { namespace dom { // Note that EchoChild extends the protocol implementation. // the protocol implementation will give us the actual // methods for sending messages, as we will soon see. class EchoChild final : public PEchoChild { friend class PEchoChild; // Allows us to participate in reference counting NS_INLINE_DECL_THREADSAFE_REFCOUNTING(EchoChild, final) public: explicit EchoChild(); protected: void ActorDestroy(ActorDestroyReason aWhy) override; // We get SendEcho(nsCString& aString) from the superclass. private: ~EchoChild() = default; bool mActorAlive; }; } // end of namespace dom } // end of namespace Mozilla And add the EchoChild.h to dom/ipc/moz.build, as part of the EXPORT...
... // end of namespace Mozilla And add the EchoChild.h to dom/ipc/moz.build, as part of the EXPORTS.mozilla.dom array. Again, remember that this must be in alphabetical order! Compiling this will now complain: "fatal error: 'mozilla/dom/EchoParent.h' file not found", so let's define EchoParent.h. Defining EchoParent.h Like before, create ./dom/ipc/EchoParent.h, and code it as follows - the inline comments describe what's going on. Note the RecvEcho(), we finally get to define where a message is received, yay!: #ifndef mozilla_dom_EchoParent_h #define mozilla_dom_EchoParent_h #include "mozilla/dom/PEchoParent.h" namespace mozilla { namespace dom { class EchoParent final : public PEchoParent { friend class PEchoParent; NS_INLINE_DECL_THREADSAFE_REFCOUNTING(EchoParent, final) publ...
gettext
It will be extracted by xgettext. */ ___('A string with context.', 'Unique context string'); $num = 1; // L10N: This is another block comment that will be extracted by xgettext. printf(n___("%d user likes this.", "%d users like this.", $num), $num); ...
...$message, $message_plural, $num, $context ="") { if($context != "") { return npgettext($context, $message, $message_plural, $num); } else { return ngettext($message, $message_plural, $num); } } // L10N: This is a block comment one line directly above the gettext function call. It will be extracted by xgettext. echo ___('A simple string.'); echo /* L10N: This is an inline comment. It will be extracted by xgettext. */ ___('A string with context.', 'Unique context string'); $num = 1; // L10N: This is another block comment that will be extracted by xgettext. printf(n___("%d user likes this.", "%d users like this.", $num), $num); // L10N: This block comment will not be extracted by xgettext because it's two lines above the gettext function call. $num = 4; printf(n__...
..."Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2009-09-28 16:18+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=CHARSET\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n" #. L10N: This is a block comment one line directly above the gettext function call. It will be extracted by xgettext. #: file.php:12 msgid "A simple string." msgstr "" #. L10N: This is an inline comment. It will be extracted by xgettext. #: file.php:14 msgctxt "Unique context string" msgid "A string with context." msgstr "" #. L10N: This is another block comment that will be extracted by xgettext. #: file.php:18 #, php-format msgid "%d...
Extras
/radialGradient> </defs> <g> <animateMotion path="M0,0 L3,0 L2,5 L5,5 L0,4 L5,2 z" begin="0s" dur="0.5s" repeatCount="indefinite"/> <circle fill="url(#radGrad2)" r="5px" cx="5px" cy="5px"/> </g> </svg> </mtext> </msup> <mrow> <mo>d</mo> <mi>?</mi> </mrow> </math> <div style="width: 300px; margin-left: auto; margin-right: auto;"> <svg width="300px" height="250px"> <defs> <linearGradient id="grad1" x1="0%" y1="0%" x2="100%" y2="0%"> <stop offset="0%" style="stop-color:rgb(0,0,255);stop-opacity:1"/> <stop offset="100%" style="stop-color:rgb(0,255,0);stop-opacity:1"/> </linearGradient> <linearGradient id="grad2" x1="0%" y1="0%" x2="0%" y2="100%"> <stop offset="0%" style="stop-color:rgb(255,0,0);stop-opacity:1"/> <stop offset="100%" style="stop-color:rgb(255,255,0);stop-o...
..."grad1" x1="0%" y1="0%" x2="100%" y2="0%"> <stop offset="0%" style="stop-color:rgb(0,0,255);stop-opacity:1"/> <stop offset="100%" style="stop-color:rgb(0,255,0);stop-opacity:1"/> </linearGradient> <linearGradient id="grad2" x1="0%" y1="0%" x2="0%" y2="100%"> <stop offset="0%" style="stop-color:rgb(255,0,0);stop-opacity:1"/> <stop offset="100%" style="stop-color:rgb(255,255,0);stop-opacity:1"/> </linearGradient> <radialGradient id="grad3" cx="50%" cy="50%" r="50%" fx="50%" fy="50%"> <stop offset="0%" style="stop-color:rgb(0,255,255);stop-opacity:1"/> <stop offset="100%" style="stop-color:rgb(255,255,255);stop-opacity:.8"/> </radialGradient> </defs> <rect width="300" height="250" fill="url(#grad1)"/> <g transform="translate(150,125)"> <g> <animateTransform attributeName="transform" ...
..."60" requiredExtensions="http://www.w3.org/1998/Math/MathML"> <math display="block"> <mrow> <munderover> <mo>?</mo> <mrow> <mi>n</mi> <mo>=</mo> <mn>0</mn> </mrow> <mrow> <mo>+</mo> <mi>?</mi> </mrow> </munderover> <mfrac> <msup> <mi>?</mi> <mi>n</mi> </msup> <mrow> <mi>n</mi> <mo>!</mo> </mrow> </mfrac> </mrow> </math> </foreignObject> <text>exp(?)</text> </switch> </g> </g> </svg> </div> Inline JavaScript HTML Content <math display="block"> <mfrac> <mtext id="num">Mouse</mtext> <mtext id="denum">Over</mtext> </mfrac> </math> JavaScript Content function whoIsThereAlert(evt) { alert("Who is there?"); } function attachListener(id) { document.getElementById(id).addEventListener("mouseover", whoIsThereAlert); } function init() { attachListener("num"); attachListener("denum")...
Investigating leaks using DMD heap scan mode
we only want these logs in content processes, in order to make shutdown faster. The allowed values here are the same as those returned by XRE_GetProcessType(), so adjust as needed. Finally, the --dmd option need to be passed in so that DMD will be run. --mode=scan is needed so that when we get a DMD log the entire contents of each block of memory is saved for later analysis. With that command line in hand, you can start Firefox. Be aware that this may take multiple minutes if you have optimization disabled. Once it has started, go through the steps you need to reproduce your leak. If your leak is a ghost window, it can be handy to get an about:memory report and write down the PID of the leaking process. You may want to wait 10 or so seconds after this to make sure as much as possible is c...
...897082c00 [nsGlobalWindowInner # 2147483662 inner https://www.example.com] Root 0x7f0882fe3230 is a ref counted object with 1 unknown edge(s). known edges: 0x7f08975a24c0 [FragmentOrElement (xhtml) head https://www.example.com] --[mAttrsAndChildren[i]]--> 0x7f0882fe3230 0x7f08967e7b20 [JS Object (HTMLScriptElement)] --[UnwrapDOMObject(obj)]--> 0x7f0882fe3230 The first two lines mean that the script element 0x7f0882fe3230 contains a strong reference to the EventListenerManager 0x7f0899b4e550. "[via hash] mListenerManager" is a description of that strong reference. 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. Most of the time, th...
... until you have a small list of things to analyze. Example analysis of block_analyzer.py results In one debugging session where I was investigating the leak from bug 1451985, I eventually reduced the list of entries until this was the most suspicious looking entry: 0x7f0892f29630 size = 392 bytes at byte offset 56 mozilla::dom::ScriptLoader::ProcessExternalScript[...] [...] I went to that line of ScriptLoader::ProcessExternalScript(), and it contained a call to ScriptLoader::CreateLoadRequest(). Fortunately, this method mostly just contains two calls to new, one for ScriptLoadRequest and one for ModuleLoadRequest. (This is where an unoptimized build comes in handy, as it would have pointed out the exact line. Unfortunately, in this particular case, the unoptimized build was so slow I w...
Refcount tracing and balancing
balance tree allows AddRef and Release calls that we know are matched to be eliminated from the tree, so it makes it much easier to debug reference count leaks of objects that have a large amount of reference counting traffic. XPCOM_MEM_ALLOC_LOG For platforms that don't have stack-crawl support, XPCOM supports logging at the call site to AddRef/Release using the usual cpp __FILE__ and __LINE__ number macro expansion hackery. This results in slower code, but at least you get some data about where the leaks might be occurring from. You must also set one or two additional environment variables, XPCOM_MEM_LOG_CLASSES and XPCOM_MEM_LOG_OBJECTS, to reduce the set of objects being logged, in order to improve performance to something vaguely tolerable. XPCOM_MEM_LOG_CLASSES This var...
...e you've picked an object that leaked, you can use tools/rb/filter-log.pl to filter the log file to drop the call stack for other objects; This process reduces the size of the log file and also improves the performance. perl -w tools/rb/filter-log.pl --object 0x00253ab0 < ./refcounts.log > my-leak.log Linux Users The log file generated on Linux system often lack function names, file names and line numbers. Linux users need to run a script to fix the call stack. python tools/rb/fix_stacks.py < ./refcounts.log > fixed_stack.log Post-processing step 3: building the balance tree Now that you've the log file fully prepared, you can build a balance tree. This process takes all the stack AddRef() and Release() stack traces and munges them into a call graph. Each node in the graph represents a...
...ddRef() is cancelled by another Release() somewhere else in the code. So the game is to try to match them with one another. Exclude Functions. To aid in this process, you can create an "excludes file", that lists the name of functions that you want to exclude from the tree building process (presumably because you've matched them). make-tree.pl has an option --exclude [file], where [file] is a newline-separated list of function names that will be excluded from consideration while building the tree. Specifically, any call stack that contains that call site will not contribute to the computation of balance factors in the tree. How to instrument your objects for refcount tracing and balancing The process is the same as instrumenting them for BloatView, because BloatView and refcount tracing sha...
Performance
e How to figure out why restyle is taking so long Power profiling Power profiling overview This page provides an overview of relevant information, including details about hardware, what can be measured, and recommended approaches. It should be the starting point for anybody new to power profiling. tools/power/rapl (Mac, Linux) tools/power/rapl is a command-line utility in the Mozilla codebase that uses the Intel RAPL interface to gather direct power estimates for the package, cores, GPU and memory. powermetrics (Mac-only) powermetrics is a command-line utility that gathers and displays a wide range of global and per-process measurements, including CPU usage, GPU usage, and various wakeups frequencies. TimerFirings logging (All platforms) ...
...ctivity Monitor and top are three related Mac tools that have major flaws but often consulted by users, and so are worth understanding. Intel Power Gadget (Windows, Mac, Linux) Intel Power Gadget provides real-time graphs for package and processor RAPL estimates. It also provides an API through which those estimates can be obtained. perf (Linux-only) perf is a powerful command-line utility that can measure many different things, including energy estimates and high-context measurements of things such as wakeups. turbostat (Linux-only) turbostat is a command-line utility that gathers and displays various power-related measurements, with a focus on per-CPU measurements such as frequencies and C-states. powertop (Linux-only) powertop is an interactive comman...
...tility that can measure many different things, including energy estimates and high-context measurements of things such as wakeups. turbostat (Linux-only) turbostat is a command-line utility that gathers and displays various power-related measurements, with a focus on per-CPU measurements such as frequencies and C-states. powertop (Linux-only) powertop is an interactive command-line utility that gathers and displays various power-related measurements. Related Topics JavaScript, XPCOM, Developing Mozilla, Extensions, Addons ...
Profile Manager
the profile in the main window, and hit the "Start Firefox" button: Firefox will be launched with that profile, and Profile Manager will terminate. The version of Firefox which will be launched is indicated in the "Firefox version" dropdown in the Launch Options box: There are several additional launch options available for Firefox. ...
...ow, and hit the "Start Firefox" button: Firefox will be launched with that profile, and Profile Manager will terminate. The version of Firefox which will be launched is indicated in the "Firefox version" dropdown in the Launch Options box: There are several additional launch options available for Firefox. These cause Firefox to be launched with various command-line arguments. ...
...profile, and Profile Manager will terminate. The version of Firefox which will be launched is indicated in the "Firefox version" dropdown in the Launch Options box: There are several additional launch options available for Firefox. These cause Firefox to be launched with various command-line arguments. See Command Line Options for a description of these. Launch Option Command Line Argument Run Firefox in offline mode -offline Run Firefox in safe mode -safe-mode Start Firefox with a console -console Start new instance -no-remote Note: It isn't possible to start a second instance of Firefox without passing it the -no-remote command line argument. For this reason, if you attempt to launch Firefox using Profile Manage...
NSS Sample Code Sample_1_Hashing
if the name is not a supported algorithm */ static SECOidTag HashNameToOIDTag(const char *hashName) { int i, nhashes = sizeof(HASH_NAMES); SECOidTag hashtag = SEC_OID_UNKNOWN; for (i = 0; i < nhashes; i++) { if (PORT_Strcasecmp(hashName, HASH_NAMES[i].hashName) == 0) { hashtag = HASH_NAMES[i].oid; break; } } return hashtag; } /* * Newline */ static void Newline(PRFileDesc* out) { PR_fprintf(out, "\n"); } /* * PrintAsHex */ void PrintAsHex(PRFileDesc* out, unsigned char *data, unsigned int len) { unsigned i; int column; unsigned int limit = 15; unsigned int level = 1; column = level; if (!len) { PR_fprintf(out, "(empty)\n"); return; } for (i = 0; i < len; i++) { if (i !
...n = level; if (!len) { PR_fprintf(out, "(empty)\n"); return; } for (i = 0; i < len; i++) { if (i != len - 1) { PR_fprintf(out, "%02x:", data[i]); column += 3; } else { PR_fprintf(out, "%02x", data[i]); column += 2; break; } if (column > 76 || (i % 16 == limit)) { Newline(out); column = level; limit = i % 16; } } if (column != level) { Newline(out); } } /* * Prints a usage message and exits */ static void Usage(const char *progName) { int htype; int HASH_AlgTOTAL = sizeof(HASH_NAMES) / sizeof(HASH_NAMES[0]); fprintf(stderr, "Usage: %s -t type [ < input ] [ > output ]\n", progName); fprintf(st...
...e; PLOptStatus status; SECStatus rv; char *hashName = NULL; char *progName = strrchr(argv[0], '/'); progName = progName ? ...
Hashing - sample 1
if the name if not a supported algorithm */ static SECOidTag HashNameToOIDTag(const char *hashName) { int i, nhashes = sizeof(HASH_NAMES); SECOidTag hashtag = SEC_OID_UNKNOWN; for (i = 0; i < nhashes; i++) { if (PORT_Strcasecmp(hashName, HASH_NAMES[i].hashName) == 0) { hashtag = HASH_NAMES[i].oid; break; } } return hashtag; } /* * Newline */ static void Newline(PRFileDesc* out) { PR_fprintf(out, "\n"); } /* * PrintAsHex */ void PrintAsHex(PRFileDesc* out, unsigned char *data, unsigned int len) { unsigned i; int column; unsigned int limit = 15; unsigned int level = 1; column = level; if (!len) { PR_fprintf(out, "(empty)\n"); return; } for (i = 0; i < len; i++) { if ...
...n = level; if (!len) { PR_fprintf(out, "(empty)\n"); return; } for (i = 0; i < len; i++) { if (i != len - 1) { PR_fprintf(out, "%02x:", data[i]); column += 3; } else { PR_fprintf(out, "%02x", data[i]); column += 2; break; } if (column > 76 || (i % 16 == limit)) { Newline(out); column = level; limit = i % 16; } } if (column != level) { Newline(out); } } /* * Prints a usage message and exits */ static void Usage(const char *progName) { int htype; int HASH_AlgTOTAL = sizeof(HASH_NAMES) / sizeof(HASH_NAMES[0]); fprintf(stderr, "Usage: %s -t type [ < input ] [ > output ]\n", progName); fprintf(s...
...e; PLOptStatus status; SECStatus rv; char *hashName = NULL; char *progName = strrchr(argv[0], '/'); progName = progName ? ...
sample1
not a supported algorithm */ static SECOidTag HashNameToOIDTag(const char *hashName) { int i, nhashes = sizeof(HASH_NAMES); SECOidTag hashtag = SEC_OID_UNKNOWN; for (i = 0; i < nhashes; i++) { if (PORT_Strcasecmp(hashName, HASH_NAMES[i].hashName) == 0) { hashtag = HASH_NAMES[i].oid; break; } } return hashtag; } /* Newline */ static void Newline(PRFileDesc* out) { PR_fprintf(out, "\n"); } /* PrintAsHex */ void PrintAsHex(PRFileDesc* out, unsigned char *data, unsigned int len) { unsigned i; int column; unsigned int limit = 15; unsigned int level = 1; column = level; if (!len) { PR_fprintf(out, "(empty)\n"); return; } for (i = 0; i < len; i...
...if (!len) { PR_fprintf(out, "(empty)\n"); return; } for (i = 0; i < len; i++) { if (i != len - 1) { PR_fprintf(out, "%02x:", data[i]); column += 3; } else { PR_fprintf(out, "%02x", data[i]); column += 2; break; } if (column > 76 || (i % 16 == limit)) { Newline(out); column = level; limit = i % 16; } } if (column != level) { Newline(out); } } /* Prints a usage message and exits */ static void Usage(const char *progName) { int htype; int HASH_AlgTOTAL = sizeof(HASH_NAMES) / sizeof(HASH_NAMES[0]); fprintf(stderr, "Usage: %s -t type [ < input ] [ > output ]\n", progName); ...
...PLOptState *optstate; PLOptStatus status; SECStatus rv; char *hashName = NULL; char *progName = strrchr(argv[0], '/'); progName = progName ? ...
nss tech note1
oted.When needed, it tells the decoder where in the target data to save the current component. It is normally relative to the dest argument passed to the decoder. If templates are nested, the offset applies to the location of the current component within the target component, typically the decoded SEQUENCE. sub+ . This field does not apply to all template types. If kind contains the SEC_ASN1_INLINE or SEC_ASN1_POINTER modifiers, then it must point to the required subtemplate. If kind contains the SEC_ASN1_XTRN or SEC_ASN1_DYNAMIC modifiers, this is a pointer to a callback function that will dynamically return the required subtemplate. size+ . This field does not apply to all template types. It is only required for dynamically allocating memory for the structure if the template is being i...
... that explicit tagging is being used. This is always a constructed type. It requires a subtemplate defining the types of the data within. SEC_ASN1_ANY: allows the decoder to match this template with any component type, regardless of the tag in the input data. If used in conjunction with SEC_ASN1_OPTIONAL as part of a sequence, this must be the last template in the template array. ...
...This requires that the subtemplate contains a non-zero size field. ...
NSS tools : ssltab
Name ssltap -- Tap into SSL connections and display the data going by Synopsis libssltap [-vhfsxl] [-p port] [hostname:port] Description The SSL Debugging Tool ssltap is an SSL-aware command-line proxy. It watches TCP connections and displays the data going by. If a connection is SSL, the data display includes interpreted SSL records and handshaking Options -v Print a version string for the tool. -h Turn on hex/ASCII printing. Instead of outputting raw data, the command interprets each record as a numbered line of hex values, followed by the same data as ASCII characters. The two parts are separated by a vertical bar. Nonprinting characters are replaced by dots. -f Turn on fancy printing. Output is printed in colored HTML. Data sent from the client to the server is in blue; the server'...
...You can use this option to upload the output into a browser. -s Turn on SSL parsing and decoding. The tool does not automatically detect SSL sessions. If you are intercepting an SSL connection, use this option so that the tool can detect and decode SSL structures. If the tool detects a certificate chain, it saves the DER-encoded certificates into files in the current directory. ...
... 72 70 6f | unications Corpo b0: 72 61 74 69 6f 6e 31 11 30 0f 06 03 55 04 0b 13 | ration1.0...U... c0: 08 48 61 72 64 63 6f 72 65 31 27 30 25 06 03 55 | .Hardcore1'0%..U d0: 04 03 13 1e 48 61 72 64 63 6f 72 65 20 43 65 72 | ....Hardcore Cer e0: 74 69 66 69 63 61 74 65 20 53 65 72 76 65 72 20 | tificate Server f0: 49 49 30 1e 17 0d 39 38 30 35 31 36 30 31 30 33 | II0...9805160103 <additional data lines> ] <additional records in same format> Server socket closed. Example 4 In this example, the -s option turns on SSL parsing, and the -h option turns on hex/ASCII format. Both formats are shown for each record. The output is routed to a text file. $ ssltap -hs -p 444 interzone.mcom.com:443 > hs.txt Output Connected to interzone.mcom.com:443 --> [ 0: 80 3d 01 03 00 00 24 00 00 00 10 01 00 80 02 00 ...
NSS tools : ssltap
Name ssltap -- Tap into SSL connections and display the data going by Synopsis libssltap [-vhfsxl] [-p port] [hostname:port] Description The SSL Debugging Tool ssltap is an SSL-aware command-line proxy. It watches TCP connections and displays the data going by. If a connection is SSL, the data display includes interpreted SSL records and handshaking Options -v Print a version string for the tool. -h Turn on hex/ASCII printing. Instead of outputting raw data, the command interprets each record as a numbered line of hex values, followed by the same data as ASCII characters. The two parts are separated by a vertical bar. Nonprinting characters are replaced by dots. -f Turn on fancy printing. Output is printed in colored HTML. Data sent from the client to the server is in blue; the server'...
...You can use this option to upload the output into a browser. -s Turn on SSL parsing and decoding. The tool does not automatically detect SSL sessions. If you are intercepting an SSL connection, use this option so that the tool can detect and decode SSL structures. If the tool detects a certificate chain, it saves the DER-encoded certificates into files in the current directory. ...
... 72 70 6f | unications Corpo b0: 72 61 74 69 6f 6e 31 11 30 0f 06 03 55 04 0b 13 | ration1.0...U... c0: 08 48 61 72 64 63 6f 72 65 31 27 30 25 06 03 55 | .Hardcore1'0%..U d0: 04 03 13 1e 48 61 72 64 63 6f 72 65 20 43 65 72 | ....Hardcore Cer e0: 74 69 66 69 63 61 74 65 20 53 65 72 76 65 72 20 | tificate Server f0: 49 49 30 1e 17 0d 39 38 30 35 31 36 30 31 30 33 | II0...9805160103 <additional data lines> ] <additional records in same format> Server socket closed. Example 4 In this example, the -s option turns on SSL parsing, and the -h option turns on hex/ASCII format. Both formats are shown for each record. The output is routed to a text file. $ ssltap -hs -p 444 interzone.mcom.com:443 > hs.txt Output Connected to interzone.mcom.com:443 --> [ 0: 80 3d 01 03 00 00 24 00 00 00 10 01 00 80 02 00 ...
NSS Tools modutil
You can use the tool to add and delete PKCS #11 modules, change passwords, set defaults, list module contents, enable or disable slots, enable or disable FIPS 140-2 compliance, and assign default providers for cryptographic operations. This tool can also create key3.db, cert8.db, and secmod.db security database files. ...
...in the JAR archive's manifest file. The script can have any name. The metainfo tag for this is Pkcs11_install_script. To declare meta-information in the manifest file, put it in a file that is passed to the Netscape Signing Tool. Sample Script For example, the PKCS #11 installer script could be in the file pk11install. ...
...st --> value valuelist <null>value ---> key_value_pair stringkey_value_pair --> key { valuelist }key --> stringstring --> simple_string "complex_string"simple_string --> [^ \t\n\""{""}"]+ (No whitespace, quotes, or braces.)complex_string --> ([^\"\\\r\n]|(\\\")|(\\\\))+ (Quotes andbackslashes must be escaped with a backslash. A complex string must notinclude newlines or carriage returns.) Outside of complex strings, all white space (for example, spaces, tabs, and carriage returns) is considered equal and is used only to delimit tokens. Keys Keys are case-insensitive. This section discusses the following keys: Global KeysPer-Platform KeysPer-File Keys Global Keys ForwardCompatible Gives a list of platforms that are forward compatible. If the...
NSS Tools ssltap
It watches TCP connections and displays the data going by. If a connection is SSL, the data display includes interpreted SSL records and handshaking. Availability This tool is known to build on Solaris 2.5.1 (SunOS 5.5.1) and Windows NT 4.0. Description The ssltap command opens a socket on a rendezvous port and waits for an incoming connection from the client side. Once this connection arrives, the tool makes another connection to the specified host name and port on the server side. ...
...ap [-vhfsxl] [-p port] hostname:port Options The command does not require any options other than hostname:port, but you normally use them to control the connection interception and output. The options for the command are the following: -v Print a version string for the tool. -h Turn on hex/ASCII printing. Instead of outputting raw data, the command interprets each record as a numbered line of hex values, followed by the same data as ASCII characters. The two parts are separated by a vertical bar. Nonprinting characters are replaced by dots. -f Turn on fancy printing. Output is printed in colored HTML. Data sent from the client to the server is in blue; the server's reply is in red. When used with looping mode, the different connections are separated with horizontal lines. You can...
... b0: 72 61 74 69 6f 6e 31 11 30 0f 06 03 55 04 0b 13 | ration1.0...U... c0: 08 48 61 72 64 63 6f 72 65 31 27 30 25 06 03 55 | .Hardcore1'0%..U d0: 04 03 13 1e 48 61 72 64 63 6f 72 65 20 43 65 72 | ....Hardcore Cer e0: 74 69 66 69 63 61 74 65 20 53 65 72 76 65 72 20 | tificate Server f0: 49 49 30 1e 17 0d 39 38 30 35 31 36 30 31 30 33 | II0...9805160103<additional data lines>]<additional records in same format>Server socket closed. Example 4 In this example, the -s option turns on SSL parsing, and the -h options turns on hex/ASCII format. Both formats are shown for each record. The output is routed to a text file. Command ssltap.exe -hs -p 444 interzone.mcom.com:443 > hs.txt Output Connected to interzone.mcom.com:443--> [ 0: 80 3d 01 03 00 00 24 00...
NSS tools : ssltap
Mozilla › Projects › NSS › tools › ssltap
Name ssltap -- Tap into SSL connections and display the data going by Synopsis libssltap [-vhfsxl] [-p port] [hostname:port] Description The SSL Debugging Tool ssltap is an SSL-aware command-line proxy. It watches TCP connections and displays the data going by. If a connection is SSL, the data display includes interpreted SSL records and handshaking Options -v Print a version string for the tool. -h Turn on hex/ASCII printing. Instead of outputting raw data, the command interprets each record as a numbered line of hex values, followed by the same data as ASCII characters. The two parts are separated by a vertical bar. Nonprinting characters are replaced by dots. -f Turn on f...
...acters. The two parts are separated by a vertical bar. Nonprinting characters are replaced by dots. -f Turn on fancy printing. Output is printed in colored HTML. Data sent from the client to the server is in blue; the server's reply is in red. When used with looping mode, the different connections are separated with horizontal lines. You can use this option to upload the output into a browser. -s Turn on SSL parsing and decoding. The tool does not automatically detect SSL sessions. If you are intercepting an SSL connection, use this option so that the tool can detect and decode SSL structures. If the tool detects a certificate chain, it saves the DER-en...
...1 74 69 6f 6e 31 11 30 0f 06 03 55 04 0b 13 | ration1.0...U... c0: 08 48 61 72 64 63 6f 72 65 31 27 30 25 06 03 55 | .Hardcore1'0%..U d0: 04 03 13 1e 48 61 72 64 63 6f 72 65 20 43 65 72 | ....Hardcore Cer e0: 74 69 66 69 63 61 74 65 20 53 65 72 76 65 72 20 | tificate Server f0: 49 49 30 1e 17 0d 39 38 30 35 31 36 30 31 30 33 | II0...9805160103 <additional data lines> ] <additional records in same format> Server socket closed. Example 4 In this example, the -s option turns on SSL parsing, and the -h option turns on hex/ASCII format. Both formats are shown for each record. The output is routed to a text file. $ ssltap -hs -p 444 interzone.mcom.com:443 > hs.txt Output Connected to interzone.mcom.com:443 --> [ 0: 80 3d 01 03 00 00...
Rhino shell
nstalled, the shell restricts scripts permissions based on their URLs according to Java policy settings. This is available only if JVM implements Java2 security model. Predefined Properties Scripts executing in the shell have access to some additional properties of the top-level object. arguments The arguments object is an array containing the strings of all the arguments given at the command line when the shell was invoked. environment Returns the current environment object. history Displays the shell command history. help() Executing the help function will print usage and help messages. defineClass(className) Define an extension using the Java class named with the string argument className. Uses ScriptableObject.defineClass() to define the extension. deserialize(filename) Resto...
... the prompt. version([number]) Get or set JavaScript version number. If no argument is supplied, the current version number is returned. If an argument is supplied, it is expected to be one of 100, 110, 120, 130, 140, 150, 160 or 170 to indicate JavaScript version 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6 or 1.7 respectively. Examples Invocation Here the shell is invoked three times from the command line. (The system command prompt is shown as $.) The first invocation executes a script specified on the command line itself. The next invocation has no arguments, so the shell goes into interactive mode, reading and evaluating each line as it is typed in. Finally, the last invocation executes a script from a file and accesses arguments to the script itself. $ java org.mozilla.javascript.tools.shell.
...opt={input: "c\na\nb", output: 'Sort Output:\n'} js> runCommand("sort", opt) 0 js> print(opt.output) Sort Output: a b c js> var opt={input: "c\na\nb", output: 'Sort Output:\n', err: ''} js> runCommand("sort", "--bad-arg", opt) 2 js> print(opt.err) /bin/sort: unrecognized option `--bad-arg' Try `/bin/sort --help' for more information. ...
JS_CompileFunction
e. Although it may still work in some browsers, its use is discouraged since it could be removed at any time. Try to avoid using it. Creates a JavaScript function from a text string. Syntax JSFunction * JS_CompileFunction(JSContext *cx, JSObject *obj, const char *name, unsigned int nargs, const char **argnames, const char *body, size_t length, const char *filename, unsigned int lineno); JSFunction * JS_CompileUCFunction(JSContext *cx, JSObject *obj, const char *name, unsigned int nargs, const char **argnames, const jschar *body, size_t length, const char *filename, unsigned int lineno); Name Type Description cx JSContext * The context in which to compile the function. Requires request. In a JS_THREADSAFE build, the caller must be ...
... argnames const char ** Names to assign to the arguments passed to the function. body const char * or const jschar * String containing the body of the function to compile. length size_t The length, in characters, of body. filename const char * Name of file or URL containing the function. Used to report filename or URL in error messages. lineno unsigned int Line number. Used to report the offending line in the file or URL if an error occurs. Description JS_CompileFunction compiles a function from a text string, bytes, and optionally associates it with a JS object, obj. JS_CompileUCFunction is the Unicode version of the function. name is the name to assign to the newly created function. nargs is the number of arguments t...
...y of names to assign each argument. The number of argument names should match the number of arguments specified in nargs. body is a string containing the source code of the function. length is the length of the source code in characters. filename is the name of the file (or URL) containing the function. This information is used in error messages if an error occurs during compilation. Similarly, lineno is used to report the line number where an error occurred during compilation. If both obj and name are non-null, the new function becomes a method of obj. (A new property is defined on obj with the given name and the new Function object as its value.) On success, JS_CompileFunction and JS_CompileUCFunction return a pointer to the newly compiled function. On error or exception, they return NUL...
JS_CompileFunctionForPrincipals
s, its use is discouraged since it could be removed at any time. Try to avoid using it. Create a security-enabled JS function from a text string. Syntax JSFunction * JS_CompileFunctionForPrincipals(JSContext *cx, JSObject *obj, JSPrincipals *principals, const char *name, unsigned int nargs, const char **argnames, const char *body, size_t length, const char *filename, unsigned int lineno); JSFunction * JS_CompileUCFunctionForPrincipals(JSContext *cx, JSObject *obj, JSPrincipals *principals, const char *name, unsigned int nargs, const char **argnames, const jschar *body, size_t length, const char *filename, unsigned int lineno); Name Type Description cx JSContext * The context in which to compile the function. Requires request. In a J...
...mes const char ** Names to assign to the arguments passed to the function. body const char * or const jschar * String containing the source code of the function to compile. length size_t The length, in characters, of body. filename const char * Name of file or URL containing the function. Used to report filename or URL in error messages. lineno unsigned int Line number. Used to report the offending line in the file or URL if an error occurs. Description JS_CompileFunctionForPrincipals compiles a security-enabled function from a text string, bytes, and associates it with a JS object, obj. JS_CompileUCFunctionForPrincipals is the Unicode version of the function. principals is a pointer to the JSPrincipals structure that c...
...an array of names to assign each argument. The number of argument names should match the number of arguments specified in nargs. body is the string containing the source code of the function. length is the length of the string in characters. filename is the name of the file (or URL) containing the function. This information is passed in messages if an error occurs during compilation. Similarly, lineno is used to report the line number of the function or file where an error occurred during compilation. On success, JS_CompileFunctionForPrincipals and JS_CompileUCFunctionForPrincipals return a pointer to the newly compiled function. On error or exception, they return NULL. See Also MXR ID Search for JS_CompileFunctionForPrincipals MXR ID Search for JS_CompileUCFunctionForPrincipals JSFUN...
JS_EvaluateScript
Obsolete since JSAPI 36This feature is obsolete. Although it may still work in some browsers, its use is discouraged since it could be removed at any time. Try to avoid using it. Compile and execute a script. Syntax JSBool JS_EvaluateScript(JSContext *cx, JSObject *obj, const char *src, unsigned int length, const char *filename, unsigned int lineno, jsval *rval); JSBool JS_EvaluateUCScript(JSContext *cx, JSObject *obj, const jschar *src, unsigned int length, const char *filename, unsigned int lineno, jsval *rval); Name Type Description cx JSContext * The context in which to run the script. Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext. obj JSObject * The scope in whi...
...which to execute the script. This parameter is documented in detail at JS_ExecuteScript. src const char * or const jschar * String containing the script to compile and execute. length unsigned int The length of src, in characters. filename const char * Name of file or URL containing the script. Used to report filename or URL in error messages. lineno unsigned int Line number. Used to report the offending line in the file or URL if an error occurs. rval jsval * Out parameter. On success, if rval is not NULL, *rval receives the result value. Description JS_EvaluateScript compiles and executes a script in the specified scope, obj. JS_EvaluateUCScript is the Unicode version of the function. src is the string contai...
...mpiles and executes a script in the specified scope, obj. JS_EvaluateUCScript is the Unicode version of the function. src is the string containing the text of the script. length indicates the size of the text version of the script in characters. filename is the name of the file (or URL) containing the script. This information is used in messages if an error occurs during compilation. Similarly, lineno is used to report the line number of the script or file where an error occurred during compilation. rval is an optional out parameter. If it is non-null, then on success, the result value is stored in *rval. This value is determined the same way as for the standard eval function. In the common case where the script is just an expression, the result value is simply the value of that expression.
JSDBGAPI
The JSDBG API is obsolete and has been removed in SpiderMonkey 35. See bug 1069694. ...
... The JSDBG API is obsolete and has been removed in SpiderMonkey 35. See bug 1069694. ...
...valFramePrincipals JS_GetFrameAnnotation JS_SetFrameAnnotation JS_GetFramePrincipalArray JS_IsNativeFrame JS_GetFrameObject JS_GetFrameScopeChain JS_GetFrameCallObject JS_GetFrameThis JS_GetFrameFunction JS_GetFrameFunctionObject JS_IsConstructorFrame JS_IsDebuggerFrame JS_GetFrameReturnValue JS_SetFrameReturnValue JS_GetFrameCalleeObject JS_GetScriptFilename JS_GetScriptBaseLineNumber JS_GetScriptLineExtent JS_GetScriptVersion JS_GetTopScriptFilenameFlags JS_GetScriptFilenameFlags JS_FlagScriptFilenamePrefix JSFILENAME_NULL JSFILENAME_SYSTEM JSFILENAME_PROTECTED Evaluating debug code JS_EvaluateInStackFrame Examining object properties typedef JSPropertyDesc JSPD_ENUMERATE JSPD_READONLY JSPD_PERMANENT JSPD_ALIAS JSPD_ARGUMENT JSPD_VARIABLE...
Thread Sanitizer
able LLVM specific code and build workarounds ac_add_options --enable-thread-sanitizer # If clang is already in your $PATH, then these can simply be: # export CC=clang # export CXX=clang++ export CC="/path/to/clang" export CXX="/path/to/clang++" # llvm-symbolizer displays much more complete backtraces when data races are detected. # If it's not already in your $PATH, then uncomment this next line: #export LLVM_SYMBOLIZER="/path/to/llvm-symbolizer" # Add TSan to our compiler flags export CFLAGS="-fsanitize=thread -fPIC -pie" export CXXFLAGS="-fsanitize=thread -fPIC -pie" # Additionally, we need the TSan flag during linking. Normally, our C/CXXFLAGS would # be used during linking as well but there is at least one place in our build where # our CFLAGS are not added during linking. # Note: ...
... Starting Firefox After the build has completed, you can start Firefox from the objdir as usual. Building only the JavaScript shell If you want to build only the JavaScript shell instead of doing a full Firefox build, the build script below will...
...The default way of symbolizing the traces is much slower than using llvm-symbolizer for that purpose: LLVM ships with a symbolizer binary that TSan will readily use to immediate...
Gecko states
stants are defined in nsIAccessibleStates. States List STATE_UNAVAILABLE The object is unavailable, i.e. disabled. Applied to: all roles. STATE_SELECTED The object is selected, i.e. indicates this object is the child of an object that allows its children to be selected and that this child is one of those children that has been selected. Applied to: ROLE_MENUITEM, ROLE_CELL, ROLE_OUTLINEITEM, XXX: continue Events: EVENT_STATE_CHANGE ?oncomitant state: STATE_SELECTABLE STATE_FOCUSED The object is focused Applied to: Events: Concomitant state: STATE_FOCUSABLE STATE_PRESSED The object is pressed. STATE_CHECKED The object is checked STATE_MIXED Indicates that the state of a three-state check box or toolbar button is not determined. The check box is neither checked nor...
...s therefore in the third or mixed state. STATE_READONLY The object is designated read-only. STATE_HOTTRACKED The object is hot-tracked by the mouse, which means that its appearance has changed to indicate that the mouse pointer is located over it. Isn't used STATE_DEFAULT This state represents the default button in a window. STATE_EXPANDED Children of this object that have the ROLE_OUTLINEITEM role are displayed. STATE_COLLAPSED Children of this object that have the ROLE_OUTLINEITEM role are hidden. STATE_BUSY The control cannot accept input at this time. STATE_FLOATING Children "owned" not "contained" by parent STATE_CHECKABLE Indicates scrolling or moving text or graphics. STATE_ANIMATED The object's appearance changes rapidly or constantly. Graphics that are occasional...
...r editable areas that have any kind of autocompletion EXT_STATE_DEFUNCT Object no longer exists EXT_STATE_SELECTABLE_TEXT For text which is selectable, object must implement nsIAccessibleText EXT_STATE_EDITABLE Implements nsIAccessibleEditableText EXT_STATE_ACTIVE This window is currently the active window EXT_STATE_MODAL Must do something with control before leaving it EXT_STATE_MULTI_LINE Edit control that can take multiple lines EXT_STATE_HORIZONTAL Uses horizontal layout EXT_STATE_OPAQUE Indicates this object paints every pixel within its rectangular region EXT_STATE_SINGLE_LINE This text object can only contain 1 line of text EXT_STATE_TRANSIENT EXT_STATE_VERTICAL Especially used for sliders and scrollbars EXT_STATE_STALE Object not dead, but not up-to-date eithe...
Embedded Dialog API
ation on writing factories or components? I can't find any.) Both contain implementations of nsIPromptService as native dialogs. The replacement library should be installed during application initialization. The default dialog-posing library is a component (PromptService for instance is part of the embedding component), registered as a component during Gecko initialization (by NS_InitEmbedding). (line number accurate in version 1.30). After initializing embedding, an application can override a default factory by registering its replacement. A PowerPlant example can be found at CBrowserApp::OverrideComponents (line number accurate in version 1.24) and an MFC example at CMfcEmbedApp::OverrideComponents (line number accurate in version 1.20). The PowerPlant example is more is more straightforward...
...ode's dialogs to be overrideable, they can't be implemented directly in the code. All UI-related code must be implemented in a registered component so that it can be swapped out by the embedding application. nsIPromptService is the canonical example. Of course this is a relatively simple example. More complex dialogs may themselves require their own interface. (Examples to be added as they come online. The print dialogs should be available soon.) Dialogs posed by the embedding app ("down calls") Some components will not pose dialogs directly, but maintain a database of information an embedding app may wish to display as a dialog. Preferences are the canonical example. In this case, we must be sure to have an API which an embedding app can use to populate its own dialog, should it decide to es...
...calls") Some components will not pose dialogs directly, but maintain a database of information an embedding app may wish to display as a dialog. Preferences are the canonical example. In this case, we must be sure to have an API which an embedding app can use to populate its own dialog, should it decide to eschew Mozilla's XUL version. These components need build no dialog posing interface. Guidelines A few restrictions on each component's UI interface... Most if not all of these dialogs will need to be child/dependent/transient windows, so each method responsible for actually opening a window must take an nsIDOMWindow *aParent parameter, and use that window as the dialog's parent, if non-null. To make our embedding API as consistent as possible, we'd like to impose a few coding conventions o...
Mork
Mozilla › Tech › Mork
atabase format. At its core, it can be viewed as a set of rows, collections of name-value pairs, which can be organized into various tables. Rows need not be in a table, nor need they be in only one table. Values are merely an opaque sequence of bytes, so their actual content is dependent on the mork consumer. Except when parsing values, whitespace ('\b', '\t', '\r', '\n', '\f', ' ', and '\x7f'), line continuations ('\\' followed by a newline), and comments (C++ or C style) can be ignored. In practice, only C++-style comments, and the standard whitespace characters ('\t', ' ', '\r', '\n') appear to be used. The grammar for mork is as follows: file = header ( dictionary | table | group | row )* header = '// <!-- <mdb:mork:z v="1.4"/> -->' dictionary = '<' ( metaDictionary | alias )* '>' table ...
...It is structured as a comment so it can be safely ignored by the parser. The header is: // <!-- <mdb:mork:z v="1.4"/> --> This file is therefore version 1.4 of the Zany Mork format for the Message Database. Versions 1.0-1.3 were never used in any publicly-available source code. Other serializations of mork have also never been used, so the Zany Mork version 1.4 format h...
...convention is to use and store the hexadecimal value for the output. Aliases are how dictionary values are stored. They use the same semantics of cells for the value, except that it cannot refer to a mid. The values of cells and aliases, when not specified by a mid reference, are one of the cases where whitespace is significant. Using the '\' character quotes the next character; at the end of the line, it represents a continuation such as that found in C\C++ code. The '$' character quotes the next two characters (which must be valid hexadecimal digits) and these three in total represent an octet with the value of the digits. Mids are unique identifiers represented by the tuple (scope, id); if the ids are the same but the scopes are different, the two mids are different. In many places, the mid...
XPCOM array guide
Mozilla › Tech › XPCOM › Guide › Arrays
nsCOMArray. Example: a content node's list of nsIContent children. Otherwise use nsIArray and make liberal use of QueryElementAt(). The point of nsCOMArray is that it's a template, and all the pointers in it must be pointers to the same type; it's nice to be able to use it because you get type-safety and don't have to spend time and code QIing (like you have to with nsIArray). Array Guidelines Here are a few simple rules which will keep your code clean and your developers happy: Use typesafe arrays like nsCOMArray<T> nsTArray<T> wherever possible. Avoid all obsolete arrays and enumerators. Avoid creating temporary arrays. Scriptable Arrays nsIArray / nsIMutableArray Usage nsIArray is useful if you need to pass arrays of COM objects through interfaces or require a scriptable...
...); // now enumerate the elements ... Typesafe Arrays nsCOMArray<T> nsCOMArray<T> is a wrapper around nsTArray<T>, so it has a similar API. It enforces both typesafety and XPCOM reference counting by keeping an owning reference to each element in the array. Usage It is most often used as a member of a C++ class to store a list of well-typed XPCOM objects. It is also usually declared as an inline member rather than a pointer. As a class member, nsCOMArray<T> is preferred over nsIArray when access to the array is confined to the class itself. For example, here is its use in a class: class NodeContainer { public: void AddNode(nsINode* node); private: nsCOMArray<nsINode> mNodes; }; // typesafety of mNodes ensures that we only append an nsINode* void NodeContainer::AddNode(nsINode* no...
...cts, starting at the third object in the array (that is, the object with index value 2): myArray.RemoveObjectsAt(2, 3); nsTArray<T> nsTArray<T> is a typesafe array for holding various objects. It can be used to hold objects directly, not just pointers to objects. Usage It is most often used as a member of a C++ class to store a list of well-typed objects. It is also usually declared as an inline member rather than a pointer. For example, here is its use in a class: class MediaList { public: void AddMedium(const nsString& aMedium); private: nsTArray<nsString> mMedia; }; // typesafety of mMedia ensures that we only append an nsString void NodeContainer::AddMedium(const nsString& aMedium) { mMedia.AppendElement(aMedium); } nsTArray<T> can also be declared on the stack to collec...
How to build an XPCOM component in JavaScript
nd the NSGetModule and QueryInterface functions for you. Note: it doesn't do the work of creating your interface definition file or the type library for you, so you still have to go through those steps above if they haven't been done. The library provides a simple example of its use in the source code (js/xpconnect/loader/XPCOMUtils.jsm), but here's another using this example. ...
...If...
...rom the source. Delete compreg.dat and xpti.dat from the components directory. Delete compreg.dat and xpti.dat from your profile directory. Restart application. Using Your Component Using wrappedJSObject If you only intend to access your component from JavaScript, i.e. ...
Creating the Component Code
ister a component is to run the application regxpcom. Without any arguments passed to regxpcom, the program registers the component in the default component registry. We suggest that when you are testing your component in the Mozilla or Netscape client, you copy your component into the components directory in the client's installation folder. When it is copied there, run regxpcom from the command line to register that component and all the others in that directory. Several new options have been added to regxpcom in versions 1.4 and later. You can run regxpcom with the -h option to see full usage options. Registration Alternatives A Gecko embedding application may provide other ways to register XPCOM components. XPInstall, the cross-platform installation technology that Mozilla uses to insta...
... classes and the code you need to create a basic component has the following structure: * required includes and constants * WebLock: public iWebLock * WebLockFactory: public nsIFactory * WebLockModule: public nsIModule In XPCOM, all of these classes also derive from the nsISupports base interface. Digging In: Required Includes and Constants Let's take a look at the first several lines of code in the component and discuss what they mean in XPCOM. The includes and definitions at the top of an XPCOM source file can give you an idea about some of the data types and techniques we'll be discussing more in the upcoming chapters. For example, MOZILLA_STRICT_API is a variable that shields you from certain private, non-XPCOM headers. For example, including nsIComponentManager.idl with...
...t uniquely identifies the component. All of the 128-bit numbers used in XPCOM - the class and the interface IDs - are examples of UUIDs, or universal unique identifiers, which were discussed in Object Interface Discovery. Generating CIDs To generate a CID for your component, you can use the uuidgen tool that comes with most Unix distributions and with Microsoft Visual C++. uuidgen is a command-line tool that returns a unique 128-bit number when you call it with no arguments: $ uuidgen ce32e3ff-36f8-425f-94be-d85b26e634ee On Windows, a program called guidgen.exe does the same thing and also provides a graphical user interface if you'd rather point and click. Or you can use one of the special "bots" on IRC in #developers, where you can also get help from human beings. irc irc.mozilla.org ...
mozITXTToHTMLConv
summary to this article. ...
... Constant ...
...er-edited HTML. whattodo A bit field composed of the Conversion control attributes indicating what conversions to apply. Return value A normalized version of the original HTML string. citeLevelTXT() Returns the "cite level" of the specified text; that is, it indicates how many levels of email reply quotes are used, when the text uses "quote" characters (such as ">") at the beginning of the line to indicate cite levels. unsigned long citeLevelTXT( in wstring line, out unsigned long logLineStart ); Parameters line The original line of text, which may begin with one or more cite characters such as ">". logLineStart On output, this parameter is set to indicate the offset into the string of the first non-cite character. You must set this value to zero before calling this method.
nsIApplicationCacheService
netwerk/base/public/nsIApplicationCacheService.idlScriptable This interface manages the set of application cache groups that manage offline resources for web applications. 1.0 66 Introduced Gecko 1.9.1 Inherits from: nsISupports Last changed in Gecko 1.9.1 (Firefox 3.5 / Thunderbird 3.0 / SeaMonkey 2.0) Method overview void cacheOpportunistically(in nsIApplicationCache cache, in ACString key); nsIApplicationCache chooseApplicationCache(in ACString key); nsIApplicationCache createApplicationCache(in ACString group); void deactivateGroup(in ACString group); nsIApplicationCache getActiveCache(in ACString group); nsIApplicationCache getApplicationCache(in ACString clientID); void getGroups([optional] out unsigned long count, [array, size_is(count), ...
...he application cache object. Return value The application cache object for the specified client ID. getGroups() Returns the list of application cache groups. ...
...tion cache groups. ...
nsIConsoleService
nts.interfaces.nsIConsoleService); consoleService.logStringMessage(msg); } Alternative logging methods include Components.utils.reportError and dump(). Logging a message with additional information To include other information an nsIConsoleMessage object must be used. In this example nsIScriptError, which implements nsIConsoleMessage, is used to include information about the source file and line number of the error. function myLogToConsole(aMessage, aSourceName, aSourceLine, aLineNumber, aColumnNumber, aFlags, aCategory) { var consoleService = Components.classes["@mozilla.org/consoleservice;1"] .getService(Components.interfaces.nsIConsoleService); var scriptError = Components.classes["@mozilla.org/scripterror;1"] ...
...ColumnNumber, aFlags, aCategory) { var consoleService = Components.classes["@mozilla.org/consoleservice;1"] .getService(Components.interfaces.nsIConsoleService); var scriptError = Components.classes["@mozilla.org/scripterror;1"] .createInstance(Components.interfaces.nsIScriptError); scriptError.init(aMessage, aSourceName, aSourceLine, aLineNumber, aColumnNumber, aFlags, aCategory); consoleService.logMessage(scriptError); } aMessage -- the string to be logged. You must provide this. aSourceName -- the URL for a file associated with an error. This will be a hyperlink in the Error Console, so you'd better use real URL. You may pass null if it's not applicable. aSourceLine -- the line #aLineNumber from ...
...aCategory); consoleService.logMessage(scriptError); } aMessage -- the string to be logged. You must provide this. aSourceName -- the URL for a file associated with an error. This will be a hyperlink in the Error Console, so you'd better use real URL. You may pass null if it's not applicable. aSourceLine -- the line #aLineNumber from aSourceName file. You are responsible for providing this line. You may pass null if you are lazy; this will prevent the source line showing in the Error Console. aLineNumber and aColumnNumber -- specify the exact location of an error. aColumnNumber is used to draw the arrow pointing to the problem character. aFlags -- one of flags declared in nsIScriptError. At the time of writing, possible values are: nsIScriptError.errorFlag = 0 nsIScriptError.
nsIEditorMailSupport
nsISupportsArray getEmbeddedObjects(); Parameters None. Return value An nsISupportsArray containing the IMG and OBJECT tags of the current document. insertAsCitedQuotation() Insert a string as quoted text (whose representation is dependent on the editor type), replacing the selected...
...on() Insert a string as quoted text (whose representation is dependent on the editor type), replacing the selected text (if any). nsIDOMNode insertAsQuotation( in AString aQuotedText ); Parameters aQuotedText The actual text to be quoted. Return value The nsIDOMNode which was inserted. insertTextWithQuotations() Inserts a plain text string at the current location, with special processing for lines beginning with ">", which will be treated as mail quotes and inserted as plain text quoted blocks. If the selection is not collapsed, the selection is deleted and the insertion takes place at the resulting collapsed selection. void insertTextWithQuotations( in DOMString aStringToInsert ); Parameters aStringToInsert The string to be inserted pasteAsCitedQuotation() Paste a string as quoted t...
...tml? pasteAsQuotation() Paste the text in the OS clipboard at the cursor position, as a quotation (whose representation is dependent on the editor type), replacing the selected text (if any). void pasteAsQuotation( in long aSelectionType ); Parameters aSelectionType Text or html? rewrap() Rewrap the selected part of the document, re-quoting if necessary. void rewrap( in boolean aRespectNewlines ); Parameters aRespectNewlines Try to maintain newlines in the original? stripCites() Strip any citations in the selected part of the document. void stripCites(); Parameters None. ...
nsIProcess
y executing process. It no longer returns a value. void run( in boolean blocking, [array, size_is(count)] in string args, in unsigned long count ); Parameters blocking If true, this method will block until the process terminates; if false, the method returns immediately. args An array of count arguments, using the native character set, to be passed to the executable on its command line. count The number of arguments in the args array. runAsync() Asynchronously runs the process with which the object was initialized, optionally calling an observer when the process finishes running. void runAsync( [array, size_is(count)] in string args, in unsigned long count, in nsIObserver observer, Optional in boolean holdWeak Optional ); Parameters args An array of argument...
...r. runw() Executes the file this object was initialized with. void runw( in boolean blocking, [array, size_is(count)] in wstring args, in unsigned long count ); Parameters blocking If true, this method will block until the process terminates; if false, the method returns immediately. args An array of count arguments, using UTF-16, to be passed to the executable on its command line. count The number of arguments in the args array. runwAsync() Asynchronously runs the process with which the object was initialized, optionally calling an observer when the process finishes running. void runwAsync( [array, size_is(count)] in wstring args, in unsigned long count, in nsIObserver observer, Optional in boolean holdWeak Optional ); Parameters args An array of argum...
...var args = ["argument1", "argument2"]; process.run(false, args, args.length); See also nsIFile nsIProcess2 Obsolete since Gecko 1.9.2 ...
nsIScriptError2
is associated. 1.0 66 Introduced Gecko 2.0 Obsolete Gecko 12.0 Inherits from: nsIScriptError Last changed in Gecko 9.0 (Firefox 9.0 / Thunderbird 9.0 / SeaMonkey 2.6) In Gecko 12.0 this Interface was merged into the nsIScriptError interface. Method overview void initWithWindowID(in wstring message, in wstring sourceName, in wstring sourceLine, in PRUint32 lineNumber, in PRUint32 columnNumber, in PRUint32 flags, in string category, in unsigned long long innerWindowID); Attributes Attribute Type Description innerWindowID unsigned long long The inner window ID with which the error is associated. This is zero if the error was initialized by calling nsIScriptError.init() instead of initWithWindowID(). ...
...rror is associated. This is zero if the error was initialized by calling nsIScriptError.init() instead of initWithWindowID(). Read only. timeStamp long long Elapsed time, in milliseconds, from a platform-specific zero time to the time the message was created. Read only. Methods initWithWindowID() void init( in wstring message, in wstring sourceName, in wstring sourceLine, in PRUint32 lineNumber, in PRUint32 columnNumber, in PRUint32 flags, in string category, in unsigned long long innerWindowID ); Parameters message The text of the message to add to the log. sourceName The URL of the file in which the error occurred. This will be a hyperlink in the JavaScript Console, so you should use a real URL. You may pass null if it's not applicable. sourc...
... in PRUint32 lineNumber, in PRUint32 columnNumber, in PRUint32 flags, in string category, in unsigned long long innerWindowID ); Parameters message The text of the message to add to the log. sourceName The URL of the file in which the error occurred. This will be a hyperlink in the JavaScript Console, so you should use a real URL. You may pass null if it's not applicable. sourceLine The line number in the source file on which the error occurred. You are responsible for providing that line. You may pass null if you are lazy; that will prevent showing the source line in JavaScript Console. lineNumber The number of the line where the error occurred. columnNumber The column number where the error occurred. This is used to draw an arrow pointing to the problem character. fl...
nsIScriptableIO
be one of the following types: nsIFile: An object returned by getFile() or getFileWithPath(), or any object implementing the nsIFile interface. nsITransport: A transport object such as a socket. nsIInputStream: A stream returned by a previous call to this method, or any other object that implements nsIInputStream. string: A string from which to read data. aMode A space-delineated string of mode terms controlling the manner in which the stream is accessed. If none of these modes are desired, specify an empty string. text: Read Unicode-converted text. The default character set is UTF-8; to read text in another character set, set the aCharSet argument to the desired character set. buffered: A stream that uses a buffer to hold a block of the next piece of the data t...
...ase object to which to write. This should be one of the following types: nsIFile: An object returned by getFile() or getFileWithPath(), or any object implementing the nsIFile interface. nsITransport: A transport object such as a socket. nsIOutputStream: A stream returned by a previous call to this method, or any other object that implements nsIOutputStream. aMode A space-delineated string of mode terms controlling the manner in which the stream is accessed. If none of these modes are desired, specify an empty string. text: Write Unicode-converted text. The default character set is UTF-8; to write text in another character set, set the aCharSet argument to the desired character set. buffered: A stream that buffers the data being written. This mode is generally used...
...ppend("myobject.json"); if (!file.exists()) file.create(Ci.nsIFile.NORMAL_FILE_TYPE, 0600); var stream = IO.newOutputStream(file, "text write create truncate"); stream.writeString(json); stream.close(); Example: Reading from a file var file = IO.getFile("Profile", null); file.append("localstore.json"); if (file.exists()) { var stream = IO.newInputStream(file, "text"); var json = stream.readLine(); stream.close(); } See also nsIFile, nsIInputStream, nsIOutputStream ...
nsITaskbarTabPreview
dows and cannot be prevented. When there are no more tab previews left for a window, the window preview is automatically made visible again. An application may have as many tab previews as memory allows. You can't directly instantiate this interface; instead, call the nsIWinTaskbar.createTaskbarTabPreview(). Method overview void EnsureRegistration(); Violates the XPCOM interface guidelines nativeWindow GetHWND(); Violates the XPCOM interface guidelines void move(in nsITaskbarTabPreview aNext); Attributes Attribute Type Description icon imgIContainer The icon displayed next to the title in the preview. This is null by default. title DOMString The title displayed above the thumbnail. By default, this is an empty ...
...ce guidelines void move(in nsITaskbarTabPreview aNext); Attributes Attribute Type Description icon imgIContainer The icon displayed next to the title in the preview. This is null by default. title DOMString The title displayed above the thumbnail. By default, this is an empty string. Methods Violates the XPCOM interface guidelines EnsureRegistration() Used internally to ensure that the taskbar knows about this preview. If a preview is not registered, the API call to set its sibling (via the move() method) will fail silently. This method is only invoked when it's safe to make taskbar API calls. void EnsureRegistration(); Parameters None. ...
... nativeWindow GetHWND(); Parameters None. Return value The HWND for the preview's proxy window. move() Relocates the preview relative to another tab preview from the same window. ...
nsIWebBrowserPersist
n location (not origin) PERSIST_FLAGS_DONT_FIXUP_LINKS 512 Do not make any adjustments to links. PERSIST_FLAGS_SERIALIZE_OUTPUT 1024 Force serialization of output (one file at a time; not concurrent) PERSIST_FLAGS_DONT_CHANGE_FILENAMES 2048 Don't make any adjustments to filenames. PERSIST_FLAGS_FAIL_ON_BROKEN_LINKS 4096 Fail on broken in-line links. PERSIST_FLAGS_CLEANUP_ON_FAILURE 8192 Automatically cleanup after a failed or cancelled operation, deleting all created files and directories. This flag does nothing for failed upload operations to remote servers. PERSIST_FLAGS_AUTODETECT_APPLY_CONVERSION 16384 Let the WebBrowserPersist decide whether the incoming data is encoded and whether it needs to go thr...
...p even if when not doing formatted output (for example for text fields). ENCODE_FLAGS_WRAP 32 Wrap documents at the specified column. ENCODE_FLAGS_FORMAT_FLOWED 64 For plain text output. Output for format flowed (RFC 2646). This is used when converting to text for mail sending. This differs just slightly but in an important way from normal formatted, and that is that lines are space stuffed. This can't (correctly) be done later. ENCODE_FLAGS_ABSOLUTE_LINKS 128 Convert links to absolute links where possible. ENCODE_FLAGS_ENCODE_W3C_ENTITIES 256 Attempt to encode entities standardized at W3C (HTML, MathML, and so on.). This is a catch-all flag for documents with mixed contents. Beware of interoperability issues. See below for other flag...
... ENCODE_FLAGS_ABSOLUTE_LINKS 128 Convert links to absolute links where possible. ENCODE_FLAGS_ENCODE_W3C_ENTITIES 256 Attempt to encode entities standardized at W3C (HTML, MathML, and so on.). This is a catch-all flag for documents with mixed contents. Beware of interoperability issues. See below for other flags which might likely do what you want. ENCODE_FLAGS_CR_LINEBREAKS 512 Output with carriage return line breaks. May also be combined with ENCODE_FLAGS_LF_LINEBREAKS and if neither is specified, the platform default format is used. ENCODE_FLAGS_LF_LINEBREAKS 1024 Output with linefeed line breaks. May also be combined with ENCODE_FLAGS_CR_LINEBREAKS and if neither is specified, the platform default format is used. ENCODE_FLAGS_N...
nsIXPConnect
void addJSHolder(in voidPtr aHolder, in nsScriptObjectTracerPtr aTracer); Native code only! void clearAllWrappedNativeSecurityPolicies(); nsIXPConnectJSObjectHolder createSandbox(in JSContextPtr cx, in nsIPrincipal principal); Native code only! ...
...se when creating the sandbox object. principal The principal (or null to use the null principal) to use when evaluating code in this sandbox. ...
... Missing Description Exceptions thrown Missing Exception Missing Description createStackFrameLocation() nsIStackFrame createStackFrameLocation( in PRUint32 aLanguage, in string aFilename, in string aFunctionName, in PRInt32 aLineNumber, in nsIStackFrame aCaller ); Parameters aLanguage Missing Description aFilename Missing Description aFunctionName Missing Description aLineNumber Missing Description aCaller Missing Description Return value Missing Description Exceptions thrown Missing Exception Missing Description debugDump() void debugDump( in short depth ); Parameters depth Missing Description Exceptions thrown Missing Exception Missing Description debugDumpEvalInJSStackFrame() void debugDumpEvalInJSStackFrame( in PRUint32 aFrameNu...
Frequently Asked Questions
nsCOMPtrs, you'll get a better introduction in the Getting Started Guide. The FAQ is divided into sections to help you find what you're looking for faster. In most cases, the answer will just refer back into the reference manual, above. No need to explain things twice :-). Buildtime Errors The build just broke. It's not in your code, or it's not on your platform, but there's an nsCOMPtr on the line where the error is and you're suspicious. You're looking in the right place. comparing an nsCOMPtr to a raw XPCOM interface pointer declaring an nsCOMPtr to a forward-declared class not linking to XPCOM not including nsCOMPtr.h different settings of NSCAP_FEATURE_DEBUG_PTR_TYPES Runtime Errors NS_ASSERTION "QueryInterface needed" May be caused by a class that derives from a given interfac...
...ointer to the object to a raw pointer to that interface, then assign the raw pointer to another nsCOMPtr for that interface. NS_PRECONDITION "You can't dereference a NULL nsCOMPtr with operator->()" NS_PRECONDITION "You can't dereference a NULL nsCOMPtr with operator*()" Other issues printf("%x\n", mynsCOMPtr); can cause the program to crash on SIGILL (illegal instruction), and not on the line with the printf, which can make it tricky to figure out. For debugging purposes you can write printf("%x\n", mynsCOMPtr.get()); How do I... initialize an nsCOMPtr? Release an nsCOMPtr before it goes out of scope? Assign 0 into it. Whenever an nsCOMPtr takes on a new value, it always Releases its old value, if any. Assigning in the value 0 is just like assigning in a raw pointer that happens ...
...o solve this problem, you should comment it, e.g., // Warning: this getter doesn't AddRef() its result. If the getter returns the new pointer as its function result, no worries, General Does nsCOMPtr bloat the code? Are nsCOMPtrs fast? Can I use them in tight loops? Bibliography Web Resources nsCOMPtr.h, and nsCOMPtr.cpp are the source to nsCOMPtr. You can examine the source to nsCOMPtr online using (the wonderful) LXR. Exploring this code is not an adventure for the faint of heart. Some COM Ownership Guidelines. Interface Pointers Considered Harmful by Don Box originally appeared in the September 1995 issue of "The C++ Report". COM Smart Pointers Even More Harmful by Don Box is a follow-up article that originally appeared in the February 1996 issue of "The C++ Report". Books E...
Reference Manual
terface. In debug builds, if you subvert this invariant with one of the assignment forms that doesn't call QueryInterface, nsCOMPtr will assert at runtime in the bad assignment. // Given two un-related interfaces |nsIFoo| and |nsIBar|... nsIBar* bar = ...; // ... nsCOMPtr<nsIFoo> foo = bar; // NS_ASSERTION: "QueryInterface needed" // ...even assuming you can get the line to compile // (either by casting, or because the types are related by C ) This invariant is relaxed for nsCOMPtr<nsISupports>. Like nsISupports* (or even void*), people generally use nsCOMPtr<nsISupports> to mean "any XPCOM interface." It would be annoying if nsCOMPtr forced you to QueryInterface to the XPCOM-correct nsISupports within an object in places where you don't care...
...ink with the XPCOM library. When NSCAP_FEATURE_DEBUG_PTR_TYPES is turned on, instead of holding its underlying pointer in a variable of type nsISupports*, the nsCOMPtr holds it in a pointer matching the underlying type. This allows source level debuggers to more easily "follow" the pointer. However, the routines that would normally be factored into a base class now must become template-specific inlines. There is no factored base class. This implies that the entire application must be compiled with the same setting of NSCAP_FEATURE_DEBUG_PTR_TYPES, else some parts will be expecting a base class and others will not. The app will not link. Unit Tests The unit tests for nsCOMPtr can be found in the file /xpcom/tests/TestCOMPtr.cpp Initialization and Assignment Built-in forms Assignment into, o...
...ointer. The destructor, which corresponds to client code calling Release against a raw XPCOM interface pointer, is factored, requiring the extra time required to invoke a subroutine call, though this is balanced against the cost already present in both cases of calling Release which may, in turn, invoke delete and the referents destructor. All nsCOMPtrs constructors and assignment operators are inline. The simple constructors, i.e., those that don't query, do only exactly the same work that you would do by hand. Any routines that call more than one of AddRef, Release, or QueryInterface, are factored, and hence have the additional cost of invoking a subroutine call. Only the fact that some routines are factored, thus introducing the overhead of an additional subroutine call, and that initializa...
Using the clipboard
that you want to copy. Now that we have the object to copy, a transferring object needs to be created: var str = "Text to copy"; var trans = Transferable(sourceWindow); trans.addDataFlavor("text/unicode"); // We multiply the length of the string by 2, since it's stored in 2-byte UTF-16 // format internally. trans.setTransferData("text/unicode", SupportsString(str), str.length * 2); The first line gets the transferring component which implements nsITransferable. Next we need to initialize it with a "privacy context", which will ensure that source data from inside private browsing mode will be cleared when the mode is exited. Please note: the sourceWindow variable is a placeholder for whatever window owns the data being copied -- from any DOM element you can obtain it via element.ownerDocum...
...nsferData is called which copies the data from the string into the transferable. This function takes three parameters. The first is the flavor we are setting, the second is the object holding the string, and the third is the length of the data, in bytes. Here, the length is multiplied by two because we are using a Unicode string which requires two bytes per character. You can repeat the last two lines and call addDataFlavor and setTransferData for multiple flavors. That way, you could have a text version and an HTML version of the content. The Transferable object will hold its own copy of the data. When you've added all the flavors you want, you can put it all on the clipboard at once. The transferable object will hold all of the data that you want until you're ready to put it on the clipboar...
... trans.init(null) trans.addDataFlavor("text/unicode"); This code gets the system clipboard object and a transferable object. The flavor is added to the transferable. Next, we need to get the data from the clipboard: Services.clipboard.getData(trans, Services.clipboard.kGlobalClipboard); var str = {}; var strLength = {}; trans.getTransferData("text/unicode", str, strLength); The first line performs the opposite of setData. The data currently on the system clipboard is placed into the transferable. Next we create two JavaScript objects which will hold the return values from getTransferData. Then we use getTransferData to retrieve the data from the transferable. We specify the flavor we would like to get. The data will be converted if it is not available in the desired flavor, and a...
Working with Multiple Versions of Interfaces
this note, I needed to obtain the HWND of the document (yes its on Windows) in order to identify each particular extension instance. To do this I used the accessibility framework: HWND getHwnd(nsIDOMNode *node){ HWND self = NULL; nsresult rv; nsCOMPtr<nsIAccessibleRetrieval> refp; refp = do_CreateInstance( "@mozilla.org/accessibleRetrieval;1", &rv); if (NS_FAILED(rv)){ return self; } //line 6. nsCOMPtr<nsIAccessible> accnode; rv = refp->GetAccessibleFor(node, getter_AddRefs(accnode)); if(NS_FAILED(rv)){ return self; } void *wh = NULL; nsCOMPtr<nsIAccessibleDocument> accdocnode; accdocnode = do_QueryInterface(accnode, &rv); if(NS_FAILED(rv)){ return self; } rv = accdocnode->GetWindowHandle(&wh); if(NS_SUCCEEDED(rv)){ self = static_cast<HWND>(wh); } return self; } ...
...we can follow to rectify this. We build construct our XPCOM component so that first tries to get the interface by it's new IID, then if that fails, attempts plan B. Plan B is simply trying to get the interface by it's older IID. For expository purposes we will do this in two stages; buoyed by the fact that it is the actual route we took. The Optimist's Solution The first thing we do is replace line 6 above by our plan B: if (NS_FAILED(rv)){ return getHwndB(node); } //new line 6. and then implement plan B. We first dredge out the old interface identifiers from our yea olde Firefox 1.5 SDK: static const nsIID IAR_IID_OLD = { 0x663ca4a8, 0xd219, 0x4000, { 0x92, 0x5d, 0xd8, 0xf6, 0x64, 0x06, 0xb6, 0x26 }}; static const nsIID IAD_IID_OLD = {0x8781fc88, 0x355f, 0x4439, { 0x88, 0x1f, 0x6...
...essibility/nsIAccessibleDocument.h" I even silenced my friend the compiler by enclosing both incantations within a compiler pragma: #pragma warning(push) #pragma warning(disable : 4005) ... #pragma warning(pop) So now I have to own up to the ugly hack. I did have to delve into my old versions and change: NS_DEFINE_STATIC_IID_ACCESSOR(...) to NS_DECLARE_STATIC_IID_ACCESSOR(...) This ugliness aside, my plan B routine now looks like: HWND getHwndB(nsIDOMNode *node){ HWND self = NULL; nsresult rv; nsCOMPtr<nsIComponentManager> compMgr; rv = NS_GetComponentManager(getter_AddRefs(compMgr)); if (NS_FAILED(rv)){ return self; } nsCOMPtr<nsIAccessibleRetrieval_old> refp; //N.B. _old rv = compMgr->CreateInstanceByContractID(accRetCID, 0, ...
Xptcall Porting Guide
e xpcom interface that. Here are examples of this implementation for Win32 and Linux x86, NetBSD x86, and FreeBSD. These implementations use the basic strategy of: figure out how much stack space is needed for the params, make the space in a new frame, copy the params to that space, invoke the method, cleanup and return. C++ is used where appropriate, Assembly language is used where necessary. Inline assembly language is used here, but it is equally valid to use separate assembly language source files. Porters can decide how best to do this for their platforms. The stubs functionality is more complex. The goal here is a class whose vtbl can look like the vtbl of any arbitrary xpcom interface. Objects of this class can then be built to impersonate any xpcom object. The base interface for this ...
...nded using platform specific macros to define the stub functions. These '.inc' files are checked into cvs. However, they can be regenerated as necessary (i.e. to change the number of stubs or to change their specific declaration) using the Perl script xptcall/public/genstubs.pl. Here are examples of this implementation for Win32 and Linux x86, NetBSD x86, and FreeBSD. Both of these examples use inline assembly language. That is just how I decided to do it. You can do it as you choose. The Win32 version is somewhat tighter because the __declspec(naked) feature allows for very small stubs. However, the __stdcall requires the callee to clean up the stack, so it is imperative that the interface information scheme allow the code to determine the correct stack pointer fixup for return without fail, ...
... to do it. You can do it as you choose. The Win32 version is somewhat tighter because the __declspec(naked) feature allows for very small stubs. However, the __stdcall requires the callee to clean up the stack, so it is imperative that the interface information scheme allow the code to determine the correct stack pointer fixup for return without fail, else the process will crash. I opted to use inline assembler for the gcc Linux x86 port. I ended up with larger stubs than I would have preferred rather than battle the compiler over what would happen to the stack before my asm code began running. I believe that the non-assembly parts of these files can be copied and reused with minimal (but not zero) platform specific tweaks. Feel free to copy and paste as necessary. Please remember that safety ...
The libmime module
am. The parser is object-oriented. There is a class for each MIME type, and each class is responsible for parsing itself, and/or handing the input data off to one of its child objects. The definition of these classes is somewhat idiosyncratic and consists of an internally defined object system, instead of C++. There is one header file and one source file for each class (for example, the MimeInlineText class is defined in "mimetext.h" and "mimetext.c".) Each header file follows the following boiler-plate form: typedefs These come first to avoid circular dependencies. typedef struct FoobarClass FoobarClass; typedef struct Foobar Foobar; Class Declaration Theis structure defines the callback routines and other per-class data of the class defined in this module. struct...
...| | | |--- MimeMultipartRelated | | | | | |--- MimeMultipartAppleDouble | | | | | |--- MimeSunAttachment | | | | | |--- MimeMultipartSigned (abstract) | | | |--- MimeMessage | | | |--- MimeUntypedText | |--- MimeLeaf (abstract) | | | |--- MimeInlineText (abstract) | | | | | |--- MimeInlineTextPlain | | | | | |--- MimeInlineTextHTML | | | | | |--- MimeInlineTextRichtext | | | | | | | |--- MimeInlineTextEnriched | | | | | |--- MimeInlineTextVCard | | | | | |--- MimeInlineTextCalendar |...
... | | | |--- MimeInlineTextPlain | | | | | |--- MimeInlineTextHTML | | | | | |--- MimeInlineTextRichtext | | | | | | | |--- MimeInlineTextEnriched | | | | | |--- MimeInlineTextVCard | | | | | |--- MimeInlineTextCalendar | | | |--- MimeInlineImage | | | |--- MimeExternalObject | |--- MimeExternalBody ...
customDBHeaders Preference
rough in developing a custom column to display a 'Superfluous' column within Thunderbird's main view. The data will come from a custom header labeled X-Superfluous. Setting the Preferences Although there are various ways to set preferences, I tend to just navigate to the directory where my profile is stored and edit the user.js file with my favorite text editor. ...
...ous,x-other"); IMPORTANT: Please pay careful attention to the case of the mailnews.customDBHeaders preference. Because comparisons are case-insensitive, all of the custom headers get set to lowercase when the data gets migrated to the message database. Also, it has been brought to my attention that the delimiter has been changed to a space in the latest code. ...
...' encoding='UTF-8'?> <RDF xmlns='http://www.w3.org/1999/02/22-rdf-syntax-ns#' xmlns:em='http://www.mozilla.org/2004/em-rdf#'> <Description about='urn:mozilla:install-manifest'> <em:id>superfluous@yoursite.com</em:id> <em:version>0.1.1</em:version> <em:type>2</em:type> <!-- 2 is type 'extension' --> <em:targetApplication> <Description> <!-- This next line identifies TBird as target --> <em:id>{3550f703-e582-4d05-9a08-453d09bdfdc6}</em:id> <em:minVersion>2*</em:minVersion> <em:maxVersion>3.0.0.*</em:maxVersion> </Description> </em:targetApplication> <em:name>superfluous</em:name> <em:description>Test Superfluous Extension</em:description> <em:creator>Garrett Comeaux</em:creator> </Description>...
Mozilla
ild with tests disabled (--disable-tests). Browser security An important aspect of developing code for any browser, including Firefox, as well as any Web-oriented project, is its security. These articles provide important guides and references to ensuring the code you write is secure, including both design recommendations and testing guidelines. Bugzilla bugzilla.mozilla.org (often abbreviated b.m.o) is Mozilla.org's bug-tracking system, a database for recording bugs and enhancement requests for Firefox, Thunderbird, SeaMonkey, Camino, and other mozilla.org projects. Building Mozilla In this article, we list documents that will guide you in bui...
...s to sort out which should be used under what circumstances. Chrome registration Chrome is the set of user interface elements of the application window that are outside the window's content area. Toolbars, menu bars, progress bars, and window title bars are all examples of elements that are typically part of the chrome. Command line options Command line options are used to specify various startup options for Mozilla applications.This page describes the commonly used options and how to use them. You can open the command line interface by pressing shift + F2. Continuous Integration When you push a commit to mozilla-central or a related repository, it initia...
...S, XUL, JavaScript, and render it on the user's screen or print it. In XUL-based applications Gecko also renders the application's user interface. Gecko's "Almost Standards" Mode "Almost standards" rendering mode is exactly the same as "standards" mode in all details save one, where it works like "quirks" mode: the height calculations for line boxes and some of the inline elements in them. Geckoview-Junit Tests The geckoview-junit tests are on-device Android junit tests written for geckoview. Getting from Content to Layout Gecko maintains two separate representations of a document in memory: the content tree and the frame tree. Changes to a document originate in the c...
Plug-in Basics - Plugins
browser in its own application space and does not interact with the browser or the web. When the browser encounters a MIME type, it always searches for a registered plug-in first. If there are no matches for the MIME type, it looks for a helper application. Plug-ins and helper applications fill different application needs. For more information about helper applications, refer to the Netscape online help. How plug-ins work The life cycle of a plug-in, unlike that of an application, is completely controlled by the web page that calls it. This section gives you an overview of the way that plug-ins operate in the browser. When Gecko starts, it looks for plugin modules in particular places on the system. For more information about where Gecko looks for plugin modules on different systems, see...
... more detail. Understanding the runtime model Plug-ins are dynamic code modules that are associated with one or more MIME types. When the browser starts, it enumerates the available plug-ins (this step varies according to platform), reads resources from each plug-in file to determine the MIME types for that plug-in, and registers each plug-in library for its MIME types. The following stages outline the life of a plug-in from loading to deletion: When Gecko encounters data of a MIME type registered for a plug-in (either embedded in an HTML page or in a separate file), it dynamically loads the plug-in code into memory, if it hasn't been loaded already, and it creates a new instance of the plug-in. Gecko calls the plug-in API function NP_Initialize when the plug-in code is first loaded. B...
...ME type. The following example uses JavaScript to determine whether the Adobe Flash plug-in is installed. If it is, a movie is displayed. ...
Version, UI, and Status Information - Plugins
<< PreviousNext >> This chapter describes the functions that allow a plug-in to display a message on the status line, get agent information, and check on the current version of the Plug-in API and the browser. Displaying a Status Line Message Users are accustomed to checking the UI status line at the bottom of the browser window for updates on the progress of an operation or the URL of a link on the page. You can also use the status line to notify the user of plug-in-related information. The user might appreciate seeing the percentage completed of the current operation or the URL of a button or other link object when the cursor is over it, all of which the browser shows. In fact, your plug-in interface should be consistent with the rest of the browser in this way. To accomplish...
...lated information. The user might appreciate seeing the percentage completed of the current operation or the URL of a button or other link object when the cursor is over it, all of which the browser shows. In fact, your plug-in interface should be consistent with the rest of the browser in this way. To accomplish this, the plug-in calls the NPN_Status method to display your message on the status line. void NPN_Status(NPP instance, const char *message); The instance parameter is the current plug-in instance, that is, the one that the status message belongs to. In the message parameter, pass the string you want to display on the status line. The browser always displays the last status line message it receives, regardless of the message source. For this reason, your message is always display...
...You should use a different method to display messages that the user needs to see, such as error messages. ...
Gecko Plugin API Reference - Plugins
te Attributes Using the embed Element for Plug-in Display Using Custom embed Attributes Plug-in References Plug-in Development Overview Writing Plug-ins Registering Plug-ins MS Windows Unix Mac OS X Drawing a Plug-in Instance Handling Memory Sending and Receiving Streams Working with URLs Getting Version and UI Information Displaying Messages on the Status Line Making Plug-ins Scriptable Building Plug-ins Building, Platforms, and Compilers Building Carbonized Plug-ins for Mac OS X Type Libraries Installing Plug-ins Native Installers XPI Plug-ins Installations Plug-in Installation and the Windows Registry Initialization and Destruction Initialization Instance Creation Instance Destruction Shutdown Initialize an...
...The names of all of these methods begin with NPP_ to indicate that they are implemented by the plug-in and called by the browser. For an overview of how these ...
... Pushes the popups-enabled state. NPN_ReloadPlugins Reloads all plug-ins in the Plugins directory. NPN_RequestRead Requests a range of bytes for a seekable stream. NPN_SetValue Sets windowless plug-in as transparent or opaque. NPN_SetValueForURL Allows a plug-in to change the stored information associated with a URL, in particular its cookies. NPN_Status Displays a message on the status line of the browser window. NPN_UserAgent Returns the browser's user agent field. NPN_Version Returns version information for the Plug-in API. NPN_Write Pushes data into a stream produced by the plug-in and consumed by the browser. Scripting plugins How the DOM handles scripting Threading model Security model What's in the plugin code? Accessing browser objects from a plugin How to c...
Debugging service workers - Firefox Developer Tools
n: This gives you some advice on what to do if you don't have a service worker registered, and were perhaps expecting there to be one registered! Let's start by troubleshooting this. Getting your service worker to register Before you can look at your service worker in action in the Applications panel, you need to successfully register it. Registration is done with a block of code along these lines, using the register() method: if('serviceWorker' in navigator) { navigator.serviceWorker .register('sw.js') .then(function() { console.log('Service Worker Registered'); }); } If you get the path wrong, for example, you'll get an error in the Web Console giving you a hint as to what's wrong, which depends on what exactly is wrong with the code. If this is not enough to h...
... when the service worker is stopped). When pressed, this takes you straight to the JavaScript debugger view of your service worker code, and you can use the full power of the debugger to debug it -- stepping through code, etc. Testing a service worker cache If you are using your service worker to store your site assets in Cache Storage (using the Cache API), which is essential for creating offline apps, it can be annoying to test the cache. When you fill up the cache with assets, but then want to alter the behavior slightly, you previously had to manually write code to empty the cache, and then fill it again. The Firefox DevTools' Storage tab has a Cache Storage section that lists all the different Caches you have stored under each different origin. Right/Ctrl clicking on one of the ca...
...gin. Delete "name of cache" -- delete only the highlighted cache. You can also click on one of the individual items stored in the cache, then Right/Ctrl click on it to get options for deleting just that item, or every item in the cache. These options make it much easier to remove a cache if it is required for testing a code update. It is also worth knowing that if you are testing an app's offline capabilities, you'll be able to see whether requests are being retrieved from a service worker-initiated cache rather than from the network by looking at Network Monitor. Resources retrieved from the cache are indicated with service worker in the Transferred column. Note: There is currently a bug whereby the Network Monitor cannot show network requests from a service worker running in a diff...
Search - Firefox Developer Tools
nd down arrows to move through the list, and Return to open the file you want: Searching within a file To search for a particular substring in the file currently loaded into the source pane, press Control + F (or Command + F on a Mac) while the source pane is focused. Press Return to search. The debugger will display the number of matches in the code and highlight each result: Using the Outline tab If you are searching for a specific function within the current JavaScript file, you can use the Outline tab in the debugger to find it quickly. The Outline tab lists the functions in the current file. The default sort order is by the order in the file but you can simplify the search by click on "Sort by name" at the bottom of the tab. You can further simplify the search by filtering the ...
...For example, if I enter "load" when viewing the above list, I get the following: Only the functions with load in their name are shown. This feature may not seem terribly useful when searching a file with a handful of functions in it but when you are searching through a file with dozens of functions, it comes in handy. ...
...th dozens of functions, it comes in handy. Searching in all files You can also search for a string in all of the files included in the currently opened project. Press Shift + Ctrl + F (Windows and Linux) or Shift + Cmd + F (macOS) and then enter the string you are trying to find. 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. Click on any entry in the list to go directly to the line in the file where the string occurs. ...
Step through code - Firefox Developer Tools
When the debugger is stopped at a breakpoint, you can step through it using four buttons in the toolbar: In order, the buttons are: Play: run to the next breakpoint Step over: advance to the next line in the same function. ...
... When the debugger is stopped at a breakpoint, you can step through it using four buttons in the toolbar: In order, the buttons are: Play: run to the next breakpoint Step over: advance to the next line in the same function. ...
...at if you've got your DevTools open in a separate window, as many people do, it can be easier to have the buttons available right there to move the code forward while you are looking at the result. If you want to turn this feature off, since Firefox 71 you can do so by going to about:config in a new tab, setting the devtools.debugger.features.overlay pref to false, and restarting the browser. Inline variable preview New in Firefox 71, the source pane now gives you an instant preview of the variables on each line of code you've stepped through. See Set a breakpoint > Inline variable preview for more information. ...
Debugger - Firefox Developer Tools
If it is ever called, a contradiction has been proven, and the debugger is free to assume that everything is true. onError(frame,report) SpiderMonkey is about to report an error inframe.Report is an object describing the error, with the following properties: message The fully formatted error message. file If present, the source file name, URL, etc. (If this property is present, theline property will be too, and vice versa.) line If present, the source line number at which the error occurred. lineText If present, this is the source code of the offending line. offset The index of the character within lineText at which the error occurred. warning Present and true if this is a warning; absent otherwise. strict Present and true if this error or warning is due to ...
...y is an object whose properties restrict which scripts are returned; a script must meet all the criteria given byquery to be returned. Ifquery is omitted, we return the Debugger.Script instances for all debuggee scripts. Querymay have the following properties: url The script's url property must be equal to this value. source The script's source property must be equal to this value. line The script must at least partially cover the given source line. If this property is present, the url property must be present as well. column The script must include given column on the line given by the line property. If this property is present, the url and line properties must both be present as well. innermost If this property is present and true, the script must be the innermost sc...
... Otherwise, if value is some other kind of object, and hence not a proper debuggee value, throw a TypeError instead. Static methods of the Debugger Object The functions described below are not called with a this value. isCompilableUnit(source) Given a string of source code, designated bysource, return false if the string might become a valid JavaScript statement with the addition of more lines. Otherwise return true. The intent is to support interactive compilation - accumulate lines in a buffer until isCompilableUnit is true, then pass it to the compiler. Source Metadata Generated from file: js/src/doc/Debugger/Debugger.md Watermark: sha256:03b36132885e046a5f213130ba22b1139b473770f7324b842483c09ab7665f7c Changeset: e91b2c85aacd ...
Tutorial: Show Allocations Per Call Path - Firefox Developer Tools
} for (let [site, total] of totals) { childMapFor(site); } // Print the allocation count for |site|. Print // |children|'s entries as |site|'s child nodes. Indent // the whole thing by |indent|. function walk(site, children, indent) { var name, place; if (site) { name = site.functionDisplayName; place = ' ' + site.source + ':' + site.line + ':' + site.column; } else { name = '(root)'; place = ''; } console.log(indent + totals.get(site) + ': ' + name + place); for (let [child, grandchildren] of children) walk(child, grandchildren, indent + ' '); } walk(null, rootChildren, ''); } })(); In the Scratchpad, ensure that no text is selected, and press the "Run" button. (If...
... current browser tab. In the browser tab, click on the text that says "Click here...". The event handler should add some text to the end of the page. Back in the browser console, evaluate the expression demoPlotAllocations(). This stops logging allocations, and displays a tree of allocations: An allocation plot, displayed in the console The numbers at the left edge of each line show the total number of objects allocated at that site or at sites called from there. After the count, we see the function name, and the source code location of the call site or allocation. The (root) node's count includes objects allocated in the content page by the web browser, like DOM events. Indeed, this display shows that popup.xml and content.js, which are internal components of Firefo...
...xml and content.js, which are internal components of Firefox, allocated more objects in the page's compartment than the page itself. (We will probably revise the allocation log to present such allocations in a way that is more informative, and that exposes less of Firefox's internal structure.) As expected, the onclick handler is responsible for all allocation done by the page's own code. (The line number for the onclick handler is 1, indicating that the allocating call is located on line one of the handler text itself. We will probably change this to be the line number within page.html, not the line number within the handler code.) The onclick handler calls doDivsAndSpans, which calls divsAndSpans, which invokes closures of factory to do all the actual allocation. (It is unclear why spa...
Aggregate view - Firefox Developer Tools
shot. You'll then see a list of all the functions that allocated objects, ordered by the size of the allocations they made: The structure of this view is very much like the structure of the Call Tree, only it shows allocations rather than processor samples. So, for example, the first entry says that: 4,832,592 bytes, comprising 93% of the total heap usage, were allocated in a function at line 35 of "alloc.js", or in functions called by that function We can use the disclosure triangle to drill down the call tree, to find the exact place your code made those allocations. It's easier to explain this with reference to a simple example. For this we'll use the DOM allocation example. This page simply runs a script that creates a large number of DOM nodes (200 HTMLDivElement objects and 4...
...LSpanElement objects). Let's get an allocation trace: open the Memory tool check "Record call stacks" load https://mdn.github.io/performance-scenarios/dom-allocs/alloc.html take a snapshot select "View/Aggregate" select "Group by/Call Stack" You should see something like this: This is telling us that 93% of the total heap snapshot was allocated in functions called from "alloc.js", line 35 (our initial createToolbars() call). We can use the disclosure arrow to expand the tree to find out exactly where we're allocating memory: This is where the "Bytes" and "Count" columns are useful: they show allocation size and number of allocations at that exact point. So in the example above, we can see that we made 4002 allocations, accounting for 89% of the total heap, in createToolbar...
...eToolbars() call). We can use the disclosure arrow to expand the tree to find out exactly where we're allocating memory: This is where the "Bytes" and "Count" columns are useful: they show allocation size and number of allocations at that exact point. So in the example above, we can see that we made 4002 allocations, accounting for 89% of the total heap, in createToolbarButton(), at alloc.js line 9, position 23: that is, the exact point where we create the <span> elements. The file name and line number is a link: if we click it, we go directly to that line in the debugger: Inverted Call Stack The Call Stack view is top-down: it shows allocations that happen at that point or points deeper in the call tree. So it's good for getting an overview of where your program is memory-hungry. Ho...
Edit Shape Paths in CSS - Firefox Developer Tools
icon alongside any valid value, e.g. one for shape-outside. Clicking the icon will cause the Editor to highlight the shape. To deactivate the Shape Path Editor click on the icon again, or select another element or a different editor. Note that the Shape Path Editor does not persist between page reloads -- if you reload your page you will need to select the element again. ...
...to highlight the shape. To deactivate the Shape Path Editor click on the icon again, or select another element or a different editor. Note that the Shape Path Editor does not persist between page reloads -- if you reload your page you will need to select the element again. Understanding the lines drawn by the editor Once you have selected a shape on your page, the Shape Path Editor will draw lines to help you understand the path that is being created. A solid line shows the outline of the shape that is wrapping the text. This is your shape. If the shape is clipped by the margin box then the margin box will make up part of this line. A dashed line demonstrates the outline of the shape which extends past the margin box reference; this is the area that will be clipped by the margin box. ...
... offset values. polygon() If the value of shape-outside is polygon() then you are using the polygon basic shape. This is the most complex of the basic shape values, therefore the tool gives you more options when editing these: Clicking on the shapes icon will activate the Shapes Path Editor and give you the option to move any of the points of your polygon shape. Double-click anywhere on a line of the shape and you will get a new point to adjust. Double click on an existing point and it will be removed. Remember that a polygon needs at least three points. Moving and scaling shapes There is extra functionality available on the shape highlight -- if you Ctrl/Cmd + click on the shapes icon for your shape the highlight will change, instead providing the ability to scale and/or move it...
Animating CSS properties - Firefox Developer Tools
to the work the browser is doing to render your site, and how you can apply that insight to diagnose and fix performance problems. If you want to play along, the demo website is here. It looks like this: It has two controls: a button to start/stop the animation, and a radio group to choose to animate using margin, or to animate using transform. There are a number of elements, and we've added a linear-gradient background and a box-shadow to each element, because they are both relatively expensive effects to paint. There's also a video version of this walkthrough: Animating using margin Leaving the "Use margin" option set, start the animation, open the Performance tool, and make a recording. You'll only need to record a few seconds. Open up the first recording. Exactly what you'll see d...
...n Leaving the "Use margin" option set, start the animation, open the Performance tool, and make a recording. You'll only need to record a few seconds. Open up the first recording. Exactly what you'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. Waterfall overview This is showing a compressed view of the Waterfall. The predominance of green is telling us that we're spending a lot of time painting. Frame rate This is showing frame rate. Average frame rate here is 46.67fps, well below the target of 60fps. Worse, though, is that the frame rate is very jagged, with lots of dips into the twenties and teens. It's unlikely you'...
...is: Waterfall overview Compared with the version that uses margin, we're seeing a lot less green and a lot more pink, which could be either layout or style recalculation. Frame rate Compared with the version that uses margin, this is looking pretty good. We're averaging nearly 60fps, and apart from one dip near the start, we're getting a consistently high frame rate. Waterfall The timeline view shows the reason for the improved frame rate. Compared with the version that uses margin, we're not spending any time time in layout or (more importantly in this case) in paint: In this case, using transform significantly improved the site's performance, and the performance tools were able to show how and why it did. ...
Tips - Firefox Developer Tools
ck on a node to expand or collapse it and all its descendants. Click on the last breadcrumb button to scroll the selection into view in the inspector. Click the "ev" icon besides a node to see all event listeners attached to it. Press S with a node selected to see it in the page (same as right-click a node and click "Scroll Into View"). Right-click a node and click "Use in Console" to command line as tempN variable. When selecting elements: Shift + click to select an element but keep selecting (picker mode doesn't disengage). Use <-/-> to navigate to parents/children elements (if they're hard to select). In the rules view: Click the inspector icon () next to any selector to highlight all elements that match it. Click the inspector icon () next to the element{} rule to lock the ...
...to view the MDN docs for this property. Click on the filter icon () next to an overridden property to find which other property overrides it. Right-click on a name, value, or rule to copy anything from the name, the value, the declaration or the whole rule to your clipboard. Web Console In all panels: Esc opens the split console; useful when debugging, or inspecting nodes In the command line: $0 references the currently selected node. $() is a shortcut to document.querySelector(). $$() returns an array with the results from document.querySelectorAll(). copy copies anything as a string. Right-click a node in the Inspector and click "Use in Console" to create a tempN variable for it. cd switches the JavaScript evaluation context to a different iframe in the page. console.table...
...ersistent logs" in the settings to keep logged messages from before even after navigation. Check "Enable timestamps" in the settings to show timestamps besides the logged messages. Debugger Skip JavaScript libraries in debugging sessions via the black box icon (). Press Ctrl+Alt+F to search in all scripts. Press Ctrl+D to search for a function definition. Press Ctrl+L to go to a specific line. Style Editor The black box icon () in the style sheet pane toggles the visibility of a style sheet. Click an @media rule to apply it in Responsive Design Mode. Click the import button () to import a style sheet or the create button () to create a new one. Click the options button in the style sheet pane and click "Show original sources" to toggle the display of CSS preprocessor files. ...
Web Console Helpers - Firefox Developer Tools
$(selector, element) Looks up a CSS selector string selector , returning the first node descended from element that matches. If unspecified, element defaults to document. Equivalent to document.querySelector() or calls the $ function in the page, if it exists. See the QuerySelector code snippet. $$(selector, element) Looks up a CSS selector string selector, returning an array of DOM nodes descended from element that match. If unspecified, element defaults to document. This is like for document.querySelectorAll(), but returns an array instead of a NodeList. $0 The currently-inspected element in the page. ...
... $$(selector, element) Looks up a CSS selector string selector, returning an array of DOM nodes descended from element that match. If unspecified, element defaults to document. This is like for document.querySelectorAll(), but returns an array instead of a NodeList. $0 The currently-inspected element in the page. $_ Stores the result of the last expression executed in the console's command line. For example, if you type "2+2 <enter>", then "$_ <enter>", the console will print 4. $x(xpath, element, resultType) Evaluates the XPath xpath expression in the context of element and returns an array of matching nodes. If unspecified, element defaults to document. The resultType parameter specifies the type of result to return; it can be an XPathResult constant, or a corresponding string: "num...
...ge. This helper accepts multiple different ways of identifying the frame to switch to. You can supply any of the following: a selector string to be passed to document.querySelector to locate the iframe element the iframe element itself the content window inside the iframe See working with iframes. clear() Clears the console output area. clearHistory() Just like a normal command line, the console command line remembers the commands you've typed. Use this function to clear the console's command history. copy() Copies the argument to the clipboard. If the argument is a string, it's copied as-is. If the argument is a DOM node, its outerHTML is copied. Otherwise, JSON.stringify will be called on the argument, and the result will be copied to the clipboard. help()Deprecated sin...
AbstractRange - Web APIs
at indicates the start and end points of a section of content within the document. As an abstract interface, you will not directly instantiate an object of type AbstractRange. Instead, you will use the Range or StaticRange interfaces. To understand the difference between those two interfaces, and how to choose which is appropriate for your needs. ...
...bject of type AbstractRange. Instead, you will use the Range or StaticRange interfaces. To understand the difference between those two interfaces, and how to choose which is appropriate for your needs. ...
...A collapsed range is one whose start position and end position are the same, resulting in a zero-character-long range. endContainer Read only The DOM Node in which the end of the range, as specif...
AddressErrors - Web APIs
r of the same name in an address described using PaymentAddress. AddressErrors is the type of the object returned by shippingAddressErrors in the PaymentDetailsUpdate passed into PaymentRequestUpdateEvent.updateWith() by the shippingaddresschange event handler if a change to the address resulted in a validation error occurring. See the examples below to see how this works. Properties addressLine A DOMString which, if present, indicates that the addressLine property of the PaymentAddress could not be validated. The contents of the string provide a human-readable explanation of the validation failure, and ideally suggestions to correct the problem. city A DOMString which, if present, indicates that the city property of the PaymentAddress could not be validated. The contents of the strin...
...the supported payment handlers and the details for those. In this example, only the Basic Card handler is supported, and it's configured to permit both debit and credit cards from Visa, Master Card, American Express, and Discover. defaultPaymentDetails describes the payment being requested. A description of the total amount being requested (including a label and the currency used), a list of the line items (in this case only one, "Original donation amount"), and a list of shipping options available; in this case only one. Process the payment The main payment processing code is found in the process() method, up next. let request; function process() { let options = {requestShipping: true}; try { request = new PaymentRequest(supportedHandlers, defaultPaymentDetails, options); //...
...() for information about event handlers and how they work. HTML Here's the simple HTML for this example. <p>Donate US $65 to our worthwhile cause and we will send you a totally not-useless gift as a token of our thanks!</p> <button id="pay">Donate Now</button> Result The final product is below. Note: if you have content blocking features enabled in your browser, the example may not work inline below. In that case, you can view the example on its own page. Specifications Specification Status Comment Payment Request APIThe definition of 'AddressErrors' in that specification. Candidate Recommendation Initial definition. ...
AnalyserNode.fftSize - Web APIs
, a DOMException with the name IndexSizeError is thrown. 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. For more complete applied examples/information, check out our Voice-change-O-matic demo (see app.js lines 128-205 for relevant code). var audioCtx = new (window.AudioContext || window.webkitAudioContext)(); var analyser = audioCtx.createAnalyser(); ... analyser.fftSize = 2048; var bufferLength = analyser.frequencyBinCount ; var dataArray = new Uint8Array(bufferLength); analyser.getByteTimeDomainData(dataArray); // draw an oscilloscope of the current audio source function draw() { drawV...
...yser.frequencyBinCount ; var dataArray = new Uint8Array(bufferLength); analyser.getByteTimeDomainData(dataArray); // draw an oscilloscope of the current audio source function draw() { drawVisual = requestAnimationFrame(draw); analyser.getByteTimeDomainData(dataArray); canvasCtx.fillStyle = 'rgb(200, 200, 200)'; canvasCtx.fillRect(0, 0, WIDTH, HEIGHT); canvasCtx.lineWidth = 2; canvasCtx.strokeStyle = 'rgb(0, 0, 0)'; canvasCtx.beginPath(); var sliceWidth = WIDTH * 1.0 / bufferLength; var x = 0; for(var i = 0; i < bufferLength; i++) { var v = dataArray[i] / 128.0; var y = v * HEIGHT/2; if(i === 0) { canvasCtx.moveTo(x, y); } else { canvasCtx.lineTo(x, y); } x...
... Working Draft ...
Animation() - Web APIs
The Animation() constructor of the Web Animations API returns a new Animation object instance. Syntax var animation = new Animation([effect][, timeline]); Parameters effect Optional The target effect, as an object based on the AnimationEffectReadOnly interface, to assign to the animation. Although in the future other effects such as SequenceEffects or GroupEffects might be possible, the only kind of effect currently available is KeyframeEffect. This can be null (which is the default) to indicate that there should be no effect applied. ...
...]); Parameters effect Optional The target effect, as an object based on the AnimationEffectReadOnly interface, to assign to the animation. Although in the future other effects such as SequenceEffects or GroupEffects might be possible, the only kind of effect currently available is KeyframeEffect. This can be null (which is the default) to indicate that there should be no effect applied. timeline Optional Specifies the timeline with which to associate the animation, as an object of a type based on the AnimationTimeline interface. Currently the only timeline type available is DocumentTimeline, but in the future there my be timelines associated with gestures or scrolling, for example. The default value is Document.timeline, but this can be set to null as well. Examples In the Follow the...
...e. Currently the only timeline type available is DocumentTimeline, but in the future there my be timelines associated with gestures or scrolling, for example. The default value is Document.timeline, but this can be set to null as well. Examples In the Follow the White Rabbit example, the Animation() constructor is used to create an Animation for the rabbitDownKeyframes using the document's timeline: var rabbitDownAnimation = new Animation(rabbitDownKeyframes, document.timeline); Specifications Specification Status Comment Web AnimationsThe definition of 'Animation()' in that specification. Working Draft Editor's draft. ...
AudioListener - Web APIs
default is 0. AudioListener.positionZ Represents the longitudinal (back and forth) position of the listener in a right-hand cartesian coordinate sytem. The default is 0. AudioListener.forwardX Represents the horizontal position of the listener's forward direction in the same cartesian coordinate sytem as the position (positionX, positionY, and positionZ) values. The forward and up values are linearly independent of each other. The default is 0. AudioListener.forwardY Represents the vertical position of the listener's forward direction in the same cartesian coordinate sytem as the position (positionX, positionY, and positionZ) values. The forward and up values are linearly independent of each other. The default is 0. AudioListener.forwardZ Represents the longitudinal (back and forth) p...
...e sytem as the position (positionX, positionY, and positionZ) values. The forward and up values are linearly independent of each other. The default is 0. AudioListener.forwardZ Represents the longitudinal (back and forth) position of the listener's forward direction in the same cartesian coordinate sytem as the position (positionX, positionY, and positionZ) values. The forward and up values are linearly independent of each other. The default is -1. AudioListener.upX Represents the horizontal position of the top of the listener's head in the same cartesian coordinate sytem as the position (positionX, positionY, and positionZ) values. The forward and up values are linearly independent of each other. The default is 0. AudioListener.upY Represents the vertical position of the top of the list...
...the same cartesian coordinate sytem as the position (positionX, positionY, and positionZ) values. The forward and up values are linearly independent of each other. The default is 0. AudioListener.upY Represents the vertical position of the top of the listener's head in the same cartesian coordinate sytem as the position (positionX, positionY, and positionZ) values. The forward and up values are linearly independent of each other. The default is 1. AudioListener.upZ Represents the longitudinal (back and forth) position of the top of the listener's head in the same cartesian coordinate sytem as the position (positionX, positionY, and positionZ) values. The forward and up values are linearly independent of each other. The default is 0. Methods AudioListener.setOrientation() Sets the o...
BaseAudioContext.createAnalyser() - Web APIs
baseAudioContext.createAnalyser(); Returns An AnalyserNode. 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. For more complete applied examples/information, check out our Voice-change-O-matic demo (see app.js lines 128-205 for relevant code). var audioCtx = new (window.AudioContext || window.webkitAudioContext)(); var analyser = audioCtx.createAnalyser(); ... analyser.fftSize = 2048; var bufferLength = analyser.frequencyBinCount; var dataArray = new Uint8Array(bufferLength); analyser.getByteTimeDomainData(dataArray); // draw an oscilloscope of the current audio source function draw() { drawVi...
...lyser.frequencyBinCount; var dataArray = new Uint8Array(bufferLength); analyser.getByteTimeDomainData(dataArray); // draw an oscilloscope of the current audio source function draw() { drawVisual = requestAnimationFrame(draw); analyser.getByteTimeDomainData(dataArray); canvasCtx.fillStyle = 'rgb(200, 200, 200)'; canvasCtx.fillRect(0, 0, WIDTH, HEIGHT); canvasCtx.lineWidth = 2; canvasCtx.strokeStyle = 'rgb(0, 0, 0)'; canvasCtx.beginPath(); var sliceWidth = WIDTH * 1.0 / bufferLength; var x = 0; for(var i = 0; i < bufferLength; i++) { var v = dataArray[i] / 128.0; var y = v * HEIGHT/2; if(i === 0) { canvasCtx.moveTo(x, y); } else { canvasCtx.lineTo(x, y); } x...
... Working Draft ...
Using dynamic styling information - Web APIs
erties List page. To modify styles to a document using CSS syntax, one can insert rules or insert <style> tags whose innerHTML property is set to the desired CSS. Modify an element's style The element style property (see also the section "DOM Style Object" below) can also be used to get and set the styles on an element. However, this property only returns style attributes that have been set in-line (e.g, <td style="background-color: lightblue"> returns the string "background-color:lightblue", or directly for that element using element.style.propertyName, even though there may be other styles on the element from a stylesheet). Also, when you set this property on an element, you override any styles that have been set elsewhere for that element's particular property you are setting. Setting t...
... for an element. See Example 6: getComputedStyle in the examples chapter for more information on how to use this method. DOM Style Object The style object represents an individual style statement. Unlike the individual rules available from the document.styleSheets collection, the style object is accessed from the document or from the elements to which that style is applied. It represents the in-line styles on a particular element. More important than the two properties noted here is the use of the style object to set individual style properties on an element: <!DOCTYPE html> <html> <head> <title>style Property Example</title> <link rel="StyleSheet" href="example.css" type="text/css"> <script type="text/javascript"> function stilo() { document.getElementById('d').style.col...
...by getting a reference to it and then use its setAttribute method to specify the CSS property and its value. var el = document.getElementById('some-element'); el.setAttribute('style', 'background-color:darkblue;'); Be aware, however, that setAttribute removes all other style properties that may already have been defined in the element's style object. If the some-element element above had an in-line style attribute of say style="font-size: 18px", that value would be removed by the use of setAttribute. ...
CSS Painting API - Web APIs
c get contextOptions() { return {alpha: true}; } paint(ctx, size, props, args) { const x = 0; const y = size.height * 0.3; const blockWidth = size.width * 0.33; const blockHeight = size.height * 0.85; const theColor = props.get( '--boxColor' ); const strokeType = args[0].toString(); const strokeWidth = parseInt(args[1]); console.log(theColor); if ( strokeWidth ) { ctx.lineWidth = strokeWidth; } else { ctx.lineWidth = 1.0; } if ( strokeType === 'stroke' ) { ctx.fillStyle = 'transparent'; ctx.strokeStyle = theColor; } else if ( strokeType === 'filled' ) { ctx.fillStyle = theColor; ctx.strokeStyle = theColor; } else { ctx.fillStyle = 'none'; ctx.strokeStyle = 'none'; } ctx.beginPath(); ctx.moveTo( x, y ); ctx.lineTo( blockWid...
...idth; } else { ctx.lineWidth = 1.0; } if ( strokeType === 'stroke' ) { ctx.fillStyle = 'transparent'; ctx.strokeStyle = theColor; } else if ( strokeType === 'filled' ) { ctx.fillStyle = theColor; ctx.strokeStyle = theColor; } else { ctx.fillStyle = 'none'; ctx.strokeStyle = 'none'; } ctx.beginPath(); ctx.moveTo( x, y ); ctx.lineTo( blockWidth, y ); ctx.lineTo( blockWidth + blockHeight, blockHeight ); ctx.lineTo( x, blockHeight ); ctx.lineTo( x, y ); ctx.closePath(); ctx.fill(); ctx.stroke(); for (let i = 0; i < 4; i++) { let start = i * 2; ctx.beginPath(); ctx.moveTo( blockWidth + (start * 10) + 10, y); ctx.lineTo( blockWidth + (start * 10) + 20, y); ctx.lineTo( blockWidth + (start * 10) + 20 + blockHeight, blockHeight)...
...Width + blockHeight, blockHeight ); ctx.lineTo( x, blockHeight ); ctx.lineTo( x, y ); ctx.closePath(); ctx.fill(); ctx.stroke(); for (let i = 0; i < 4; i++) { let start = i * 2; ctx.beginPath(); ctx.moveTo( blockWidth + (start * 10) + 10, y); ctx.lineTo( blockWidth + (start * 10) + 20, y); ctx.lineTo( blockWidth + (start * 10) + 20 + blockHeight, blockHeight); ctx.lineTo( blockWidth + (start * 10) + 10 + blockHeight, blockHeight); ctx.lineTo( blockWidth + (start * 10) + 10, y); ctx.closePath(); ctx.fill(); ctx.stroke(); } } }); We then include the paintWorklet: <ul> <li>item 1</li> <li>item 2</li> <li>item 3</li> <li>item 4</li> <li>item 5</li> <li>item 6</li> <li>item 7</li> <li>item 8</li> <li>item 9</li>...
CanvasRenderingContext2D.beginPath() - Web APIs
Path() method of the Canvas 2D API starts a new path by emptying the list of sub-paths. Call this method when you want to create a new path. Note: To create a new sub-path, i.e., one matching the current canvas state, you can use CanvasRenderingContext2D.moveTo(). Syntax void ctx.beginPath(); Examples Creating distinct paths This example creates two paths, each of which contains a single line. ...
...u want to create a new path. Note: To create a new sub-path, i.e., one matching the current canvas state, you can use CanvasRenderingContext2D.moveTo(). Syntax void ctx.beginPath(); Examples Creating distinct paths This example creates two paths, each of which contains a single line. HTML <canvas id="canvas"></canvas> JavaScript The beginPath() method is called before beginning each line, so that they may be drawn with different colors. ...
...his example creates two paths, each of which contains a single line. HTML <canvas id="canvas"></canvas> JavaScript The beginPath() method is called before beginning each line, so that they may be drawn with different colors. const canvas = document.getElementById('canvas'); const ctx = canvas.getContext('2d'); // First path ctx.beginPath(); ctx.strokeStyle = 'blue'; ctx.moveTo(20, 20); ctx.lineTo(200, 20); ctx.stroke(); // Second path ctx.beginPath(); ctx.strokeStyle = 'green'; ctx.moveTo(20, 20); ctx.lineTo(120, 120); ctx.stroke(); Result Specifications Specification Status Comment HTML Living StandardThe definition of 'CanvasRenderingContext2D.beginPath' in that specification. Living Standard ...
CanvasRenderingContext2D.moveTo() - Web APIs
oordinates. Syntax void ctx.moveTo(x, y); Parameters x The x-axis (horizontal) coordinate of the point. y The y-axis (vertical) coordinate of the point. Examples Creating multiple sub-paths This example uses moveTo() to create two sub-paths within a single path. Both sub-paths are then rendered with a single stroke() call. ...
... x The x-axis (horizontal) coordinate of the point. y The y-axis (vertical) coordinate of the point. Examples Creating multiple sub-paths This example uses moveTo() to create two sub-paths within a single path. Both sub-paths are then rendered with a single stroke() call. HTML <canvas id="canvas"></canvas> JavaScript The first line begins at (50, 50) and ends at (200, 50). The second line begins at (50, 90) and ends at (280, 120). ...
...hin a single path. Both sub-paths are then rendered with a single stroke() call. HTML <canvas id="canvas"></canvas> JavaScript The first line begins at (50, 50) and ends at (200, 50). The second line begins at (50, 90) and ends at (280, 120). var canvas = document.getElementById('canvas'); var ctx = canvas.getContext('2d'); ctx.beginPath(); ctx.moveTo(50, 50); // Begin first sub-path ctx.lineTo(200, 50); ctx.moveTo(50, 90); // Begin second sub-path ctx.lineTo(280, 120); ctx.stroke(); Result Specifications Specification Status Comment HTML Living StandardThe definition of 'CanvasRenderingContext2D.moveTo' in that specification. Living Standard ...
CanvasRenderingContext2D.strokeText() - Web APIs
The CanvasRenderingContext2D method strokeText(), part of the Canvas 2D API, strokes -- that is, draws the outlines of -- the characters of a text string at the specified coordinates. An optional parameter allows specifying a maximum width for the rendered text, which the user agent will achieve by condensing the text or by using a lower font size. This method draws directly to the canvas without modifying the current path, so any subsequent fill() or stroke() calls will have no effect on it. Use the fillText() method to fill the text characters rather than having just their outlines drawn. Syntax CanvasRenderingContext2D.strokeText(text, x, y [, maxWidth]); Parameters text A DOMString specifying the text string to render into the context. The text is rendered using the settings s...
... x The x-axis coordinate of the point at which to begin drawing the text. y The y-axis coordinate of the point at which to begin drawing the text. maxWidth Optional The maximum width the text may be once rendered. ...
... rendered. If not specified, there is no limit to the width of the text. However, if this value is provided, the user agent will adjust the kerning, select a more horizontally condensed font (if one is available or can be generated without loss of quality), or scale down to a smaller font size in order to fit the text in the specified width. Return value undefined. Examples Drawing text outlines This example writes the words "Hello world" using the strokeText() method. HTML First, we need a canvas to draw into. This code creates a context 400 pixels wide and 150 pixels high. <canvas id="canvas" width="400" height="150"></canvas> JavaScript The JavaScript code for this example follows. const canvas = document.getElementById('canvas'); const ctx = canvas.getContext('2d'); ctx.fon...
Manipulating video using canvas - Web APIs
Note that you can simply pass the video element into the context's drawImage() method to draw the current video frame into the context. The result is: Line 3 fetches a copy of the raw graphics data for the curre...
...ecent frame of video data, which looks like this: In line 2, that frame of video is copied into the graphics context ctx1 of the first canvas, specifying as the height and width the values we previously saved to draw the frame at half size. Note that you can simply pass the video element into the context's drawImage() method to draw the current video frame into the context. The result is: Line 3 fetches a copy of the raw graphics data for the current frame of video by calling the getImageData() method on the first context. This provides raw 32-bit pixel image data we can then manipulate. Line 4 computes the number of pixels in the image by dividing the total size of the frame's image data by four. The for loop that begins on line 6 scans through the frame's pixels, pulling out the r...
...ground image imported from foo.png. Every pixel in the frame's image data that is found that is within the parameters that are considered to be part of the green screen has its alpha value replaced with a zero, indicating that the pixel is entirely transparent. As a result, the final image has the entire green screen area 100% transparent, so that when it's drawn into the destination context in line 13, the result is an overlay onto the static backdrop. The resulting image looks like this: This is done repeatedly as the video plays, so that frame after frame is processed and displayed with the chroma-key effect. View the full source for this example. ...
DOMImplementation.createHTMLDocument() - Web APIs
Line 16 pulls the contentDocument of the frame; this is the document i...
...(p); } catch(e) { console.log(e); } // Copy the new HTML document into the frame let destDocument = frame.contentDocument; let srcNode = doc.documentElement; let newNode = destDocument.importNode(srcNode, true); destDocument.replaceChild(newNode, destDocument.documentElement); } The code in lines 4-12 handle creating the new HTML document and inserting some content into it. Line 4 uses createHTMLDocument() to construct a new HTML document whose <title> is "New Document". Lines 5 and 6 create a new paragraph element with some simple content, and then lines 8-12 handle inserting the new paragraph into the new document. Line 16 pulls the contentDocument of the frame; this is the document into which we'll be injecting the new content. The next two lines handle importing the...
...le> is "New Document". Lines 5 and 6 create a new paragraph element with some simple content, and then lines 8-12 handle inserting the new paragraph into the new document. Line 16 pulls the contentDocument of the frame; this is the document into which we'll be injecting the new content. The next two lines handle importing the contents of our new document into the new document's context. Finally, line 20 actually replaces the contents of the frame with the new document's contents. View Live Examples The returned document is pre-constructed with the following HTML: <!doctype html> <html> <head> <title>title</title> </head> <body> </body> </html> Specifications Specification Status Comment DOMThe definition of 'DOMImplementation.createHTMLDocument' in that speci...
Element: DOMMouseScroll event - Web APIs
The DOM DOMMouseScroll event is fired asynchronously when mouse wheel or similar device is operated and the accumulated scroll amount is over 1 line or 1 page since last event. It's represented by the MouseScrollEvent interface. This event was only implemented by Firefox. You should instead use the standard wheel event. Bubbles Yes Cancelable Yes Interface MouseScrollEvent If you want to prevent the default action of mouse wheel events, it's not enough to handle only this event on Gecko because If scroll amount by a native mouse wheel event is less than 1 line (or less than 1 page when the system setting is by page scroll), other mouse wheel events may be fired without this event. On Gecko 17 (Firefox 17) or later, you need to call prevent...
...additional property beyond standard events. detail The detail property describes the scroll more precisely, with positive values indicating scrolling downward and negative values indicating scrolling upward. If the event represents scrolling up by a page, the value of detail is -32768. If the event indictes scrolling down by a page, the value is +32768. ...
... is +32768. Any other value represents the number of lines to scroll, with the direction indicated by the value's sign. Note: Trusted events are never sent with a value of 0 for detail. Trusted events are never fired with 0. Note: If the platform's native mouse wheel events only provide scroll distance by pixels, or if the speed can be customized by the user, the value is computed using the line height of the nearest scrollable ancestor element of the event's target. If that element's font size is smaller than mousewheel.min_line_scroll_amount, that preference's value is used as the line height. ...
Element.getClientRects() - Web APIs
utside the border box of the table. When called on SVG elements other than an outer-<svg>, the "viewport" that the resulting rectangles are relative to is the viewport that the element's outer-<svg> establishes (and to be clear, the rectangles are also transformed by the outer-<svg>'s viewBox transform, if any). Originally, Microsoft intended this method to return a TextRectangle object for each line of text. However, the CSSOM working draft specifies that it returns a DOMRect for each border box. For an inline element, the two definitions are the same. But for a block element, Mozilla will return only a single rectangle. Firefox 3.5 note Firefox 3.5 adds width and height properties to the TextRectangle object. The amount of scrolling that has been done of the viewport area (or an...
... rects are painted for the paragraph in the second block, and for the <span> element in the third block. <h3>A paragraph with a span inside</h3> <p>Both the span and the paragraph have a border set. The client rects are in red. Note that the p has onlyone border box, while the span has multiple border boxes.</p> <div> <strong>Original</strong> <p> <span>Paragraph that spans multiple lines</span> </p> </div> <div> <strong>p's rect</strong> <p class="withClientRectsOverlay"> <span>Paragraph that spans multiple lines</span> </p> </div> <div> <strong>span's rect</strong> <p> <span class="withClientRectsOverlay">Paragraph that spans multiple lines</span> </p> </div> Example 2: This HTML creates three ordered lists. Client rects are painted for the <ol> in the ...
...ad> <tr><th>thead</th></tr> </thead> <tbody> <tr><td>tbody</td></tr> </tbody> </table> </div> CSS The CSS draws borders around the paragraph and the <span> inside each <div> block for the first example, around the <ol> and <li> for the second example, and around <table>, <th>, and <td> elements for the third example. strong { text-align: center; } div { display: inline-block; width: 150px; } div p, ol, table { border: 1px solid blue; } span, li, th, td { border: 1px solid green; } JavaScript The JavaScript code draws the client rects for all HTML elements that have CSS class withClientRectsOverlay assigned. function addClientRectsOverlay(elt) { /* Absolutely position a div over each client rect so that its border width is the same as the rectang...
Element.scrollIntoView() - Web APIs
ble to the user Syntax element.scrollIntoView(); element.scrollIntoView(alignToTop); // Boolean parameter element.scrollIntoView(scrollIntoViewOptions); // Object parameter Parameters alignToTop Optional Is a Boolean value: If true, the top of the element will be aligned to the top of the visible area of the scrollable ancestor. Corresponds to scrollIntoViewOptions: {block: "start", inline: "nearest"}. This is the default value. If false, the bottom of the element will be aligned to the bottom of the visible area of the scrollable ancestor. Corresponds to scrollIntoViewOptions: {block: "end", inline: "nearest"}. scrollIntoViewOptions Optional Is an Object with the following properties: behavior Optional Defines the transition animation. One of auto or smooth. De...
...a of the scrollable ancestor. Corresponds to scrollIntoViewOptions: {block: "end", inline: "nearest"}. scrollIntoViewOptions Optional Is an Object with the following properties: behavior Optional Defines the transition animation. One of auto or smooth. Defaults to auto. block Optional Defines vertical alignment. One of start, center, end, or nearest. Defaults to start. inline Optional Defines horizontal alignment. One of start, center, end, or nearest. Defaults to nearest. ...
...ignment. One of start, center, end, or nearest. Defaults to start. inline Optional Defines horizontal alignment. One of start, center, end, or nearest. Defaults to nearest. Example var element = document.getElementById("box"); element.scrollIntoView(); element.scrollIntoView(false); element.scrollIntoView({block: "end"}); element.scrollIntoView({behavior: "smooth", block: "end", inline: "nearest"}); Notes The element may not be scrolled completely to the top or bottom depending on the layout of other elements. Specifications Specification Status Comment CSS Object Model (CSSOM) View ModuleThe definition of 'Element.scrollIntoView()' in that specification. Working Draft Initial definition ...
EventTarget - Web APIs
and may have listeners for them. Element, Document, and Window are the most common event targets, but other objects can be event targets, too. For example XMLHttpRequest, AudioNode, AudioContext, and others. Many event targets (including elements, documents, and windows) also support setting event handlers via onevent properties and attributes. ...
... example XMLHttpRequest, AudioNode, AudioContext, and others. Many event targets (including elements, documents, and windows) also support setting event handlers via onevent properties and attributes. ...
... Methods EventTarget.addEventListener() Registers an event handler of a specific event type on the EventTarget. EventTarget.removeEventListener() Removes an event listener from the EventTarget. ...
Frame Timing API - Web APIs
mations, etc. A frame rate of 60 fps (frames per second) for a 60 Hz refresh rate is a common target for a good responsive user experience. This means the browser should process a frame in about 16.7 ms. An application can register a PerformanceObserver for "frame" performance entry types. The observer (callback) will be notified when new "frame" events are added to the browser's performance timeline and the frame's duration (length of time) will be available. This data can be used to help identify areas that take too long to provide a good user experience. Example code of the interfaces described in this document is included in Using the Frame Timing API. Performance frames The PerformanceFrameTiming interface extends the following PerformanceEntry properties (for "frame" performance entr...
... timestamp indicating the difference between the startTimes of two successive frames. This data, particularly the duration timestamp, can be used to help identify performance problems. Frame observers The performance observer interfaces allow an application to register an observer for specific performance event types. When one of those event types is recorded in the browser's performance timeline, the application is notified of the event via the observer's callback function that was specified when the observer was created. To observe "frame" performance entry types, the application first creates a PerformanceObserver object with a specific frame observer callback (function). Next, PerformanceObserver.observe() is used to specify the set of performance events to observe - in this case, ju...
... was specified when the observer was created. To observe "frame" performance entry types, the application first creates a PerformanceObserver object with a specific frame observer callback (function). Next, PerformanceObserver.observe() is used to specify the set of performance events to observe - in this case, just the "frame" event type. When the browser adds a new frame to the performance timeline, the specified observer callback will be invoked. Accessing frame data When a frame observer is invoked, frame performance entries can be retrieved by calling PerformanceObserverEntryList.getEntriesByType() with an argument of "frame". This method returns a list of "frame" PerformanceEntry objects. Each frame object's duration property returns the timestamp of two consecutive frames. If this va...
HTMLCanvasElement.toBlob() - Web APIs
parse to convert the canvas to ico. Windows XP doesn't support converting from PNG to ico, so it uses bmp instead. A download link is created by setting the download attribute. The value of the download attribute is the name it will use as the file name. ...
...he canvas to ico. Windows XP doesn't support converting from PNG to ico, so it uses bmp instead. A download link is created by setting the download attribute. The value of the download attribute is the name it will use as the file name. ...
... '-moz-parse-options:format=bmp;bpp=32'); Save toBlob to disk with OS.File (chrome/add-on context only) This technique saves it to the desktop and is only useful in Firefox chrome context or add-on code as OS APIs are not present on web sites. var canvas = document.getElementById('canvas'); var d = canvas.width; ctx = canvas.getContext('2d'); ctx.beginPath(); ctx.moveTo(d / 2, 0); ctx.lineTo(d, d); ctx.lineTo(0, d); ctx.closePath(); ctx.fillStyle = 'yellow'; ctx.fill(); function blobCallback(iconName) { return function(b) { var r = new FileReader(); r.onloadend = function () { // r.result contains the ArrayBuffer. Cu.import('resource://gre/modules/osfile.jsm'); var writePath = OS.Path.join(OS.Constants.Path.desktopDir, iconNam...
HTMLCanvasElement.toDataURL() - Web APIs
DOMString containing the requested data URI. Exceptions SecurityError The canvas's bitmap is not origin clean; at least some of its contents have or may have been loaded from a site other than the one from which the document itself was loaded. ...
...ally change images You can use this technique in coordination with mouse events in order to dynamically change images (gray-scale vs. ...
...nts in order to dynamically change images (gray-scale vs. ...
HTMLDetailsElement - Web APIs
The HTMLDetailsElement interface provides special properties (beyond the regular HTMLElement interface it also has available to it by inheritance) for manipulating <details> elements. ...
... The HTMLDetailsElement interface provides special properties (beyond the regular HTMLElement interface it also has available to it by inheritance) for manipulating <details> elements. ...
... HTMLDetailsElement.open Is a boolean reflecting the open HTML attribute, indicating whether or not the element's contents (not counting the <summary>) is to be shown to the user. Methods No specific method; inherits m...
HTMLDialogElement - Web APIs
The HTMLDialogElement interface provides methods to manipulate <dialog> elements. It inherits properties and methods from the HTMLElement interface. ...
... The HTMLDialogElement interface provides methods to manipulate <dialog> elements. It inherits properties and methods from the HTMLElement interface. ...
... HTMLDialogElement.open A Boolean reflecting the open HTML attribute, indicating whether the dialog is available for interaction. HTMLDialogElement.returnValue A DOMString that sets or returns the return value for the di...
HTMLImageElement.sizes - Web APIs
ormation and selects an image and width that best meets the specified values. How exactly the images are used may depend upon the browser and what the pixel density of the user's display is. Buttons at the bottom of the example let you actually modify the sizes property slightly, switching the largest of the three widths for the image between 40em and 50em. ...
...actually modify the sizes property slightly, switching the largest of the three widths for the image between 40em and 50em. HTML <article> <h1>An amazing headline</h1> <div class="test"></div> <p>This is even more amazing content text. It's really spectacular. And fascinating. Oh, it's also clever and witty. ...
...the largest of the three widths for the image between 40em and 50em. HTML <article> <h1>An amazing headline</h1> <div class="test"></div> <p>This is even more amazing content text. It's really spectacular. And fascinating. Oh, it's also clever and witty. Award-winning stuff, I'm sure.</p> <img src="/files/16870/new-york-skyline-wide.jpg" srcset="/files/16870/new-york-skyline-wide.jpg 3724w, /files/16869/new-york-skyline-4by3.jpg 1961w, /files/16871/new-york-skyline-tall.jpg 1060w" sizes="((min-width: 50em) and (max-width: 60em)) 50em, ((min-width: 30em) and (max-width: 50em)) 30em, (max-width: 30em) 20em"> <p>Then there's even more amazing stuff to say down here. Can you believe it? I sure can't.
HTMLMarqueeElement - Web APIs
The HTMLMarqueeElement interface provides methods to manipulate <marquee> elements. It inherits properties and methods from the HTMLElement interface. ...
... The HTMLMarqueeElement interface provides methods to manipulate <marquee> elements. It inherits properties and methods from the HTMLElement interface. ...
... HTMLMarqueeElement.behavior Sets how the text is scrolled within the marquee. Possible values are scroll, slide and alternate. If no value is specified, the default value is scroll. HTMLMarqueeElement.bgColor Sets the ...
Basic concepts - Web APIs
IndexedDB is useful for applications that store a large amount of data (for example, a catalog of DVDs in a lending library) and applications that don't need persistent internet connectivity to work (for example, mail clients, to-do lists, and notepads). ...
...anism by which data is stored in the database. The object store persistently holds records, which are key-value pairs. Records within an object store are sorted according to the keys in an ascending order. Every object store must have a name that is unique within its database. The object store can optionally have a key generator and a key path. If the object store has a key path, it is using in-line keys; otherwise, it is using out-of-line keys. For the reference documentation on object store, see IDBObjectStore. version When a database is first created, its version is the integer 1. Each database has one version at a time; a database can't exist in multiple versions at once. The only way to change the version is by opening it with a greater version than the current one. This will star...
...s in an object store using the index. key generator A mechanism for producing new keys in an ordered sequence. If an object store does not have a key generator, then the application must provide keys for records being stored. Generators are not shared between stores. This is more a browser implementation detail, because in web development, you don't really create or access key generators. in-line key A key that is stored as part of the stored value. It is found using a key path. An in-line key can be generated using a generator. After the key has been generated, it can then be stored in the value using the key path or it can also be used as a key. out-of-line key A key that is stored separately from the value being stored. key path Defines where the browser should extract the key fro...
Transcoding assets for Media Source Extensions - Web APIs
o Big Buck Bunny [0] here. Big Buck Bunny is licensed under the Creative Commons Attribution 3.0 license. Throughout this tutorial, you'll see the filename trailer_1080p.mov which is the download. [0] (c) Copyright 2008, Blender Foundation / www.bigbuckbunny.org / https://peach.blender.org/about/ Tools required When working with MSE, the following tools are a must have: ffmpeg -- A command-line utility for transcoding your media into the required formats. You can download a version for your system at the Download FFmpeg page. Extract the executable from the archive file and add it's location to your PATH statement. OSX users can also use homebrew to install ffmpeg. Bento4 -- A set of command-line utilities for getting asset metadata and creating content for DASH. To install, you'll nee...
...n2 -- Bento4 uses it. Get these installed successfully before moving to the next step. Sample media should be placed in the Bento4 utils directory and worked here. Note: The prebuilt ffmpeg does not include libfdk_aac due to licensing reasons. Bento4 uses this by default, so you need to compile ffmpeg if necessary. If you don't need it, add --audio-codec=aac to the mp4-dash-encode.py command line. Container and Codec Support As specified in section 1.1 of the MSE spec: Goals, MSE is designed not to require support for any particular media format or codec. While this is true on paper, browser support varies for specific container/codec combinations. To check if the browser supports a particular container, you can pass a string of the MIME type to the MediaSource.isTypeSupported method...
... atoms of an MP4. Note: The fragmented version is slightly larger than the original, due to additional metadata spread throughout the file. This is usually a file size increase of 1 percent or less. ...
PerformanceFrameTiming - Web APIs
user experience. This means the browser should process a frame in about 16.7ms. An application can register a PerformanceObserver for "frame" performance entry types and the observer can retrieve data about the duration of each frame event. This information can be used to help identify areas that take too long to provide a good user experience. ...
...formance entry types and the observer can retrieve data about the duration of each frame event. This information can be used to help identify areas that take too long to provide a good user experience. ...
... PerformanceEntry.name Returns the ...
RTCDtlsTransport - Web APIs
also used to provide information about SCTP packets transmitted and received by an connection's data channels. Features of the DTLS transport include the addition of security to the underlying transport; the RTCDtlsTransport interface can be used to obtain information about the underlying transport and the security added to it by the DTLS layer. ...
...ude the addition of security to the underlying transport; the RTCDtlsTransport interface can be used to obtain information about the underlying transport and the security added to it by the DTLS layer. ...
...block; position: absolute; top: 0; left: 0;" viewbox="-50 0 600 70" preserveAspectRatio="xMinYMin meet"><a xlink:href="/docs/Web/API/RTCDtlsTransport" target="_top"><rect x="1" y="1" width="160" height="50" fill="#F4F7F8" stroke="#D4DDE4" stroke-width="2px" /><text x="81" y="30" font-size="12px" font-family="Consolas,Monaco,Andale Mono,monospace" fill="#4D4E53" text-anchor="middle" alignment-baseline="middle">RTCDtlsTransport</text></a></svg></div> a:hover text { fill: #0095DD; pointer-events: all;} PropertiesiceTransport Read only The read-only RTCDtlsTransport property iceTransport contains a reference to the underlying RTCIceTransport.state Read only The state read-only property of the RTCDtlsTransport interface provides information which describes a Datagram Transport Layer Se...
RTCIceCandidate.priority - Web APIs
The RTCIceCandidate interface's read-only priority property specifies the candidate's priority according to the remote peer; the higher this value is, the better the remote peer considers the candidate to be. As is the case with most of RTCIceCandidate's properties, the value of priority is extracted from the candidate a-line string specified when creating the RTCIceCandidate. The a-line string is obtained either from the RTCIceCandidateInit property candidate or from an a-line string passed into RTCPeerConnection.addIceCandidate() instead of an RTCIceCandidate. Syntax var priority = RTCIceCandidate.priority; Value A long, unsigned integer value indicating the priority of the candidate according to the remote peer. The larger this value is, the more preferable the remote peer considers t...
...e peer considers this candidate to be. priority is initialized to null if it is not specified in the candidate, or if the candidate string can't be parsed propertly. Note: If priority is null, passing the candidate to addIceCandidate() will fail, throwing an OperationError exception. This applies only if the candidate implements the priority property. Usage notes Consider this SDP attribute line (a-line) which describes an ICE candidate: a=candidate:4234997325 1 udp 2043278322 192.168.0.56 44323 typ host The priority is the number after the protocol, so it's the fourth field in the candidate string. In this example, the priority is 2043278322. Example This candidate examines the priority of the candidate and, if it's greater than the priority of a previously-seen candidate, remembers...
....0.56 44323 typ host The priority is the number after the protocol, so it's the fourth field in the candidate string. In this example, the priority is 2043278322. Example This candidate examines the priority of the candidate and, if it's greater than the priority of a previously-seen candidate, remembers the candidate for later use. ...
RTCIceCandidate.relatedAddress - Web APIs
ated address of a relay or reflexive candidate. If the candidate is a host candidate (that is, its ip is in fact the real IP address of the remote peer), relatedAddress is null. The relatedAddress field's value is set when the RTCIceCandidate() constructor is used. You can't specify the value of relatedAddress in the options object, but the address is automatically extracted from the candidate a-line, if it's formatted properly, being taken from its rel-address field. The related address and port (relatedPort) are not used at all by ICE itself; they are provided for analysis and diagnostic purposes only, and their inclusion may be blocked by security systems, so do not rely on them having non-null values. Syntax var relAddress = RTCIceCandidate.relatedAddress; Value A DOMString which con...
...ch contains the candidate's related address. For both peer and server reflexive candidates, the related address (and related port) are the base for that server or peer reflexive candidate. For relay candidates, the related address and port are set to the mapped address selected by the TURN server. For host candidates, relatedAddress is null, meaning the field is not included in the candidate's a-line. ...
...ncluded in the candidate's a-line. Usage notes The related address is included in ICE candidates despite not being used by ICE itself. relatedAddress can be used for diagnostic purposes; by observing the relationships between the various types of candidates and their addresses and related addresses. relatedAddress can also be used by Quality-of-Service (QoS) mechanisms. Here's an SDP attribute line (a-line) describing an ICE candidate discovered by the STUN server: a=candidate:4234997325 1 udp 2043278322 192.168.0.56 6502 typ srflx raddr 192.168.2.77 rport 32768 generation 0 The remote address, relatedAddress, is the dotted quad (for IPv4) or colon-delineated 64-bit address (for IPv6) immediately following the text "raddr", or "192.168.2.77". Example In this example, the candidate's typ...
RTCIceCandidate.relatedPort - Web APIs
icates the port number of reflexive or relay candidates. If the candidate is a host candidate (that is, its ip is in fact the real IP address of the remote peer), relatedPort is null. The relatedPort field's value is set when the RTCIceCandidate() constructor is used. You can't specify the value of relatedPort in the options object, but the address is automatically extracted from the candidate a-line, if it's formatted properly, being taken from its rel-port field. The related address (relatedAddress) and port are not used at all by ICE itself; they are provided for analysis and diagnostic purposes only, and their inclusion may be blocked by security systems, so do not rely on them having non-null values. Syntax var relPort = RTCIceCandidate.relatedPort; Value An unsigned 16-bit value co...
...An unsigned 16-bit value containing the candidate's related port number, if any. For both peer and server reflexive candidates, the related address and port describe the base for that candidate. For relay candidates, the related address and port provide the mapped address selected by the TURN server. For host candidates, relatedPort is null, meaning the field is not included in the candidate's a-line. ...
...tes, relatedPort is null, meaning the field is not included in the candidate's a-line. Usage notes The related address and port are not used by ICE itself, and are only present for diagnostic and Quality-of-Service purposes. They may in fact be omitted for security reasons, but if present can be a useful tool during debugging. See the example, which shows a bit of this. Here's an SDP attribute line (a-line) describing an ICE candidate discovered by the STUN server: a=candidate:4234997325 1 udp 2043278322 192.168.0.56 6502 typ srflx raddr 192.168.2.77 rport 32768 generation 0 The remote port, relatedPort, is the number immediately following the "rport" label on the a-line, or 32768. Example In this example, the candidate's type is checked, and then debugging output is presented, based on...
SVGAltGlyphDefElement - Web APIs
The SVGAltGlyphDefElement interface corresponds to the <altGlyphDef> element. ...
... The SVGAltGlyphDefElement interface corresponds to the <altGlyphDef> element. ...
... Properties This interface doesn't implement any specific properties, but inherits properties from its parent interface, SVGElement. Methods This interface doesn't implement any specific methods, but inherits metho...
SVGAltGlyphItemElement - Web APIs
The SVGAltGlyphItemElement interface corresponds to the <altGlyphItem> element. ...
... The SVGAltGlyphItemElement interface corresponds to the <altGlyphItem> element. ...
... Properties This interface doesn't implement any specific properties, but inherits properties from its parent interface, SVGElement. Methods This interface doesn't implement any specific methods, but inherits meth...
SVGAnimateColorElement - Web APIs
The SVGAnimateColorElement interface corresponds to the <animateColor> element. ...
... The SVGAnimateColorElement interface corresponds to the <animateColor> element. ...
... Methods This interface has no methods but inherits methods from its parent, SVGAnimationElement. Specifications Specification Status Comment Scalab...
SVGExternalResourcesRequired - Web APIs
The SVGExternalResourcesRequired interface defines an interface which applies to all elements where this element or one of its descendants can reference an external resource. ...
... The SVGExternalResourcesRequired interface defines an interface which applies to all elements where this element or one of its descendants can reference an external resource. ...
... Properties SVGExternalResourcesRequired.externalResourcesRequired Corresponds to the externalResourcesRequired attribute of the given element. Note: The SVG DOM defines the attribute externalResourcesR...
SVGFilterPrimitiveStandardAttributes - Web APIs
The SVGFilterPrimitiveStandardAttributes interface defines the set of DOM attributes that are common across the filter primitive interfaces. ...
... The SVGFilterPrimitiveStandardAttributes interface defines the set of DOM attributes that are common across the filter primitive interfaces. ...
... SVGFilterPrimitiveStandardAttributes.y Read only An SVGAnimatedLength corresponding to the y attribute of the given element.
SVGFontElement - Web APIs
The SVGFontElement interface corresponds to the <font> elements. Object-oriented access to the attributes of the <font> element via the SVG DOM is not possible. ...
... The SVGFontElement interface corresponds to the <font> elements. Object-oriented access to the attributes of the <font> element via the SVG DOM is not possible. ...
... Methods This interface has no methods but inherits methods from its parent, SVGElement and implements methods from...
SVGFontFaceElement - Web APIs
The SVGFontFaceElement interface corresponds to the <font-face> elements. Object-oriented access to the attributes of the <font-face> element via the SVG DOM is not possible. ...
... The SVGFontFaceElement interface corresponds to the <font-face> elements. Object-oriented access to the attributes of the <font-face> element via the SVG DOM is not possible. ...
... Methods This interface has no methods but inherits methods from its parent, SVGElement. Specifications Specification Status Comment Scalable Vector Graphics (SV...
SVGFontFaceFormatElement - Web APIs
The SVGFontFaceFormatElement interface corresponds to the <font-face-format> elements. Object-oriented access to the attributes of the <font-face-format> element via the SVG DOM is not possible. ...
... The SVGFontFaceFormatElement interface corresponds to the <font-face-format> elements. Object-oriented access to the attributes of the <font-face-format> element via the SVG DOM is not possible. ...
... Methods This interface has no methods but inherits methods from its parent, SVGElement. Specifications Specification Status Comment Scalable Vector Graphi...
SVGFontFaceNameElement - Web APIs
The SVGFontFaceNameElement interface corresponds to the <font-face-name> elements. Object-oriented access to the attributes of the <font-face-name> element via the SVG DOM is not possible. ...
... The SVGFontFaceNameElement interface corresponds to the <font-face-name> elements. Object-oriented access to the attributes of the <font-face-name> element via the SVG DOM is not possible. ...
... Methods This interface has no methods but inherits methods from its parent, SVGElement. Specifications Specification Status Comment Scalable Vector Graphics...
SVGFontFaceSrcElement - Web APIs
The SVGFontFaceSrcElement interface corresponds to the <font-face-src> elements. Object-oriented access to the attributes of the <font-face-src> element via the SVG DOM is not possible. ...
... The SVGFontFaceSrcElement interface corresponds to the <font-face-src> elements. Object-oriented access to the attributes of the <font-face-src> element via the SVG DOM is not possible. ...
... Methods This interface has no methods but inherits methods from its parent, SVGElement. Specifications Specification Status Comment Scalable Vector Graphics ...
SVGFontFaceUriElement - Web APIs
The SVGFontFaceUriElement interface corresponds to the <font-face-uri> elements. Object-oriented access to the attributes of the <font-face-uri> element via the SVG DOM is not possible. ...
... The SVGFontFaceUriElement interface corresponds to the <font-face-uri> elements. Object-oriented access to the attributes of the <font-face-uri> element via the SVG DOM is not possible. ...
... Methods This interface has no methods but inherits methods from its parent, SVGElement. Specifications Specification Status Comment Scalable Vector Graphics ...
SVGGlyphElement - Web APIs
The SVGGlyphElement interface corresponds to the <glyph> element. Object-oriented access to the attributes of the <glyph> element via the SVG DOM is not possible. ...
... The SVGGlyphElement interface corresponds to the <glyph> element. Object-oriented access to the attributes of the <glyph> element via the SVG DOM is not possible. ...
... Properties This interface doesn't implement any specific properties, but inherits properties from its parent interface, SVGElement. Methods This interface doesn't implement any specific methods, but inherits methods fro...
SVGGlyphRefElement - Web APIs
The SVGGlyphRefElement interface corresponds to the <glyphRef> elements. ...
... The SVGGlyphRefElement interface corresponds to the <glyphRef> elements. ...
... SVGGlyphRefElement.glyphRef A DOMString corresponding to the glyphRef attribute of the given element. SVGGlyphRefElement.format A DOMStr...
SVGHKernElement - Web APIs
The SVGHKernElement interface corresponds to the <hkern> elements. Object-oriented access to the attributes of the <hkern> element via the SVG DOM is not possible. ...
... The SVGHKernElement interface corresponds to the <hkern> elements. Object-oriented access to the attributes of the <hkern> element via the SVG DOM is not possible. ...
... Methods This interface has no methods but inherits methods from its parent, SVGElement. Specifications Specification Status Comment Scalable Vector Graphics (SVG) ...
SVGMeshElement - Web APIs
The SVGMeshElement interface provides access to the properties of <mesh> elements. ...
... The SVGMeshElement interface provides access to the properties of <mesh> elements. ...
... Methods This interface doesn't implement any specific methods, but inherits methods from its pare...
SVGMissingGlyphElement - Web APIs
The SVGMissingGlyphElement interface corresponds to the <missing-glyph> elements. Object-oriented access to the attributes of the <missing-glyph> element via the SVG DOM is not possible. ...
... The SVGMissingGlyphElement interface corresponds to the <missing-glyph> elements. Object-oriented access to the attributes of the <missing-glyph> element via the SVG DOM is not possible. ...
... Methods This interface has no methods but inherits methods from its parent, SVGElement and implements methods from SVGStylable. Specificat...
SVGRect - Web APIs
Web › API › SVGRect
The SVGRect represents a rectangle. Rectangles consist of an x and y coordinate pair identifying a minimum x value, a minimum y value, and a width and height, which are constrained to be non-negative. An SVGRect object can be designated as read only, which means that attempts to modify the object will result in an exception being thrown. ...
...a width and height, which are constrained to be non-negative. An SVGRect object can be designated as read only, which means that attempts to modify the object will result in an exception being thrown. ...
...If the attribute is not specified, the effect is as if a value of 0 were specified. ...
SVGRenderingIntent - Web APIs
The SVGRenderingIntent interface defines the enumerated list of possible values for rendering-intent attributes or descriptors. ...
... The SVGRenderingIntent interface defines the enumerated list of possible values for rendering-intent attributes or descriptors. ...
... Constants Name Value Description RENDERING_INTENT_UNKNOWN 0 The type is not one of predefined types. It is invalid to attempt to define a new value of this type or to attempt to switch an ...
SVGSolidcolorElement - Web APIs
The SVGSolidcolorElement interface corresponds to the <solidcolor> element. ...
... The SVGSolidcolorElement interface corresponds to the <solidcolor> element. ...
... Methods This interface doesn't implement any specific methods, but inherits methods from its parent interface, SVGElement. ...
SVGTRefElement - Web APIs
The SVGTRefElement interface corresponds to the <tref> elements. Object-oriented access to the attributes of the <tref> element via the SVG DOM is not possible. ...
... The SVGTRefElement interface corresponds to the <tref> elements. Object-oriented access to the attributes of the <tref> element via the SVG DOM is not possible. ...
... Methods This interface has no methods but inherits methods from its parent, SVGTextPositioningElement and implements properties ...
SVGURIReference - Web APIs
The SVGURIReference interface is used to reflect the href attribute and the deprecated xlink:href attribute. ...
... The SVGURIReference interface is used to reflect the href attribute and the deprecated xlink:href attribute. ...
...On getting href, an SVGAnimatedString object is returned that reflects the href at...
SVGUnitTypes - Web APIs
The SVGUnitTypes interface defines a commonly used set of constants used for reflecting gradientUnits, patternContentUnits and other similar attributes. ...
... The SVGUnitTypes interface defines a commonly used set of constants used for reflecting gradientUnits, patternContentUnits and other similar attributes. ...
...It is invalid to attempt to define a new value of this type or to attempt to switch an existing value to this type. SVG_UNIT_TYPE_USERSPACEONUSE 1 C...
SVGVKernElement - Web APIs
The SVGVKernElement interface corresponds to the <vkern> elements. Object-oriented access to the attributes of the <vkern> element via the SVG DOM is not possible. ...
... The SVGVKernElement interface corresponds to the <vkern> elements. Object-oriented access to the attributes of the <vkern> element via the SVG DOM is not possible. ...
... Methods This interface has no methods but inherits methods from its parent, SVGElement. Specifications Specification Status Comment Scalable Vector Graphics (SVG) ...
SVGZoomAndPan - Web APIs
The SVGZoomAndPan interface is used to reflect the zoomAndPan attribute, and is mixed in to other interfaces for elements that support this attribute. ...
... The SVGZoomAndPan interface is used to reflect the zoomAndPan attribute, and is mixed in to other interfaces for elements that support this attribute. ...
...It is invalid to attempt to define a new value of this type or to attempt to switch an existing value to this type. SVG_ZOOMANDPAN_DISABLE 1 Corre...
Sensor APIs - Web APIs
for the Permissions API, the <iframe> element's allow attribute and the Feature-Policy directive. Sensor permissions Sensor Permission/Feature Policy Name AbsoluteOrientationSensor 'accelerometer', 'gyroscope', and 'magnetometer' Accelerometer 'accelerometer' AmbientLightSensor 'ambient-light-sensor' Gyroscope 'gyroscope' LinearAccelerationSensor 'accelerometer' Magnetometer 'magnetometer' RelativeOrientationSensor 'accelerometer', and 'gyroscope' Readings Sensor readings are received through the Sensor.onreading callback which is inherited by all sensor types. Reading frequency is decided by you, accomplished with an option passed to a sensor's constructor. The option is a number tha...
...physical orientation in relation to the Earth's reference coordinate system. AccelerometerSecure context Provides the acceleration applied to the device along all three axes. AmbientLightSensorSecure context Returns the current light level or illuminance of the ambient light around the hosting device. GyroscopeSecure context Provides the angular velocity of the device along all three axes. LinearAccelerationSensorSecure context Provides the acceleration applied to the device along all three axes, but without the contribution of gravity. MagnetometerSecure context Provides information about the magnetic field as detected by the device's primary magnetometer sensor. OrientationSensorSecure context The base class for the AbsoluteOrientationSensor. This interface cannot be used directl...
...ent handlers, and methods accessed by interfaces that inherit from it. SensorErrorEventSecure context Provides information about errors thrown by a Sensor or related interface. Specifications Specification Status Comment Generic Sensor API Candidate Recommendation Initial definition. Accelerometer Candidate Recommendation Defines Accelerometer and LinearAccerationSensor. Ambient Light Sensor Candidate Recommendation Gyroscope Candidate Recommendation Initial definition. Magnetometer Candidate Recommendation Orientation Sensor Candidate Recommendation Defines AbsoluteOrientationSensor and RelativeOrientationSensor. ...
StylePropertyMap - Web APIs
The StylePropertyMap interface of the the CSS Typed Object Model API provides a representation of a CSS declaration block that is an alternative to CSSStyleDeclaration. ...
... The StylePropertyMap interface of the the CSS Typed Object Model API provides a representation of a CSS declaration block that is an alternative to CSSStyleDeclaration. ...
... Methods Inherits methods from its parent, StylePropertyMapReadOnly. StylePropertyMap.append() Adds a new CSS declaration to the StylePropertyMap with the given property and value. StylePropertyMap.clear() ...
SyncManager.register() - Web APIs
...
... ...
...first sync event if it is periodic). The default is 0. minPeriod: The minimum time in milliseconds between periodic sync events. The default is 0, meaning events are not periodic. minRequiredNetwork: The network condition under which background synchronization will occur. Valid values are 'network-any', 'network-offline', 'network-online', 'network-non-mobile'. The default value is 'network-online'. ...
URLSearchParams.set() - Web APIs
ple: let url = new URL('https://example.com?foo=1&bar=2'); let params = new URLSearchParams(url.search.slice(1)); //Add a third parameter. params.set('baz', 3); params.toString(); // "foo=1&bar=2&baz=3" Below is a real-life example demonstrating how to create a URL and set some search parameters. You can copy and paste the example in a code environment like Codepen, JSFiddle, or the multi-line JavaScript interpreter in Firefox. line #41: Comment out this line to stop dumping the search parameters to the console (debug). line #43: Dumps the generated object and it's string representation to the console (info). line #44: Tries to automatically open a new window/tab with the generated URL (when uncommented). 'use strict' function genURL(rExp, aText, bDebug=false){ let theURL th...
...heURL.searchParams.set( 'input', '\u2911\u20dc' )// ? ...
...rchParams.set( 'text', aText.join('\n') ) if( bDebug ){ // Display the key/value pairs for(var pair of theURL.searchParams.entries()) { console.debug(pair[0] + ' = \'' + pair[1] + '\''); } console.debug(theURL) } return theURL } var url = genURL( /(^\s*\/\/|\s*[^:]\/\/).*\s*$|\s*\/\*(.|\n)+?\*\/\s*$/gm // single/multi-line comments // /(^\s*\/\/.*|\s*[^:]\/\/.*)/g // single-line comments ,[ "These should work:", "", "// eslint-disable-next-line no-unused-vars", "lockPref( 'keyword.URL',\t\t'https://duckduckgo.com/html/?q=!+' )\t// test", "/*", " * bla bla ", "*/", "", "/* bla bla */", "", "// bla bla ", "", "These shouldn\'t work:", "console.log(\"http://foo.co.uk/\")", "var url = \"http://regexr.com/foo.html?q=bar\"", "alert(\"ht...
VTTCue - Web APIs
Web › API › VTTCue
e media data to which the cue applies. text The raw text of the cue, and rules for its interpretation. Properties This interface also inherits properties from TextTrackCue. VTTCue.region A VTTRegion object describing the video's sub-region that the cue will be drawn onto, or null if none is assigned. VTTCue.vertical Returns an enum representing the cue writing direction. VTTCue.snapToLines Returns true if the VTTCue.line attribute is an integer number of lines or a percentage of the video size. VTTCue.line Returns the line positioning of the cue. This can be the string auto or a number whose interpretation depends on the value of VTTCue.snapToLines. VTTCue.lineAlign Returns an enum representing the alignment of the VTTCue.line. VTTCue.position Returns the indentation of the...
...This can be the string auto or a number representing the percentage of the VTTCue.region, or the video size if VTTCue.region is null. VTTCue.positionAlign Returns an enum representing the alignment of the cue. This is used to determine what the VTTCue.position is anchored to. The default is auto. ...
...e VTTCue.region, or the video size if VTTCue.region is null. VTTCue.positionAlign Returns an enum representing the alignment of the cue. This is used to determine what the VTTCue.position is anchored to. The default is auto. VTTCue.size Returns a double representing the size of the cue, as a percentage of the video size. VTTCue.textAlign Returns an enum representing the alignment of all the lines of text within the cue box. VTTCue.text Returns a DOMString with the contents of the cue. Methods getCueAsHTML() Returns the cue text as a DocumentFragment. 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.addEventListene...
Using textures in WebGL - Web APIs
's a power of 2. Generate mips. gl.generateMipmap(gl.TEXTURE_2D); } else { // No, it's not a power of 2. Turn off mips and set // wrapping to clamp to edge gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE); gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE); gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR); } }; image.src = url; return texture; } function isPowerOf2(value) { return (value & (value - 1)) == 0; } The loadTexture() routine starts by creating a WebGL texture object texture by calling the WebGL createTexture() function. It then uploads a single blue pixel using texImage2D(). This makes the texture immediately usable as a solid blue color even though it may take a few ...
...gn to image.onload will be called once the image has finished downloading. At that point we again call texImage2D() this time using the image as the source for the texture. After that we setup filtering and wrapping for the texture based on whether or not the image we download was a power of 2 in both dimensions or not. WebGL1 can only use non power of 2 textures with filtering set to NEAREST or LINEAR and it can not generate a mipmap for them. Their wrapping mode must also be set to CLAMP_TO_EDGE. On the other hand if the texture is a power of 2 in both dimensions then WebGL can do higher quality filtering, it can use mipmap, and it can set the wrapping mode to REPEAT or MIRRORED_REPEAT. An example of a repeated texture is tiling an image of a few bricks to cover a brick wall. Mipmapping a...
...o REPEAT or MIRRORED_REPEAT. An example of a repeated texture is tiling an image of a few bricks to cover a brick wall. Mipmapping and UV repeating can be disabled with texParameteri(). This will allow non-power-of-two (NPOT) textures at the expense of mipmapping, UV wrapping, UV tiling, and your control over how the device will handle your texture. // gl.NEAREST is also allowed, instead of gl.LINEAR, as neither mipmap. gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR); // Prevents s-coordinate wrapping (repeating). gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE); // Prevents t-coordinate wrapping (repeating). gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE); Again, with these parameters, compatible WebGL devices will automatically a...
WebXR application life cycle - Web APIs
In this guide, we'll get a birds-eye view of what's involved in creating and driving a WebXR application, without diving down to the code level in detail. This serves as preparation for the next few articles in these WebXR guides, which cover starting up and shutting down a WebXR session, geometry, simulating cameras, spatial tracking, and more. Life cycle outline Most applications using WebXR will follow a similar overall design pattern: Check to see if the user's device and browser are both capable of presenting the XR experience you want to provide. Make sure the WebXR API is available; if navigator.xr is undefined, you can assume the user's browser and/or device doesn't support WebXR. If it's not supported, disable any user interface used to activate XR features and abort any...
...experience you want to provide. Make sure the WebXR API is available; if navigator.xr is undefined, you can assume the user's browser and/or device doesn't support WebXR. If it's not supported, disable any user interface used to activate XR features and abort any attempts to enter XR mode. Call navigator.xr.isSessionSupported(), specifying the WebXR experience mode you want to provide: inline, immersive-vr, or immersive-ar, in order to determine whether or not the type of session you wish to provide is available. If the session type you want to use is available, provide the appropriate interface to the user to allow them to activate it. When the user requests the activation of WebXR functionality by engaging with the user interface enabled above, request an XRSession using th...
... type you want to use is available, provide the appropriate interface to the user to allow them to activate it. When the user requests the activation of WebXR functionality by engaging with the user interface enabled above, request an XRSession using the desired mode. This is done by calling navigator.xr.requestSession(), again specifying the string indicating the mode you want to enable: inline, immersive-vr, or immersive-ar. If the promise returned by requestSession() resolves, use the new XRSession to manage the WebXR session for the duration of the WebXR experience. This will involve managing inputs, animations, and rendering. Call the XRSession method requestAnimationFrame() to schedule the first frame render for the XR device. If your scene is complex, you should consider...
Lighting a WebXR setting - Web APIs
pixels the light touches. You can learn more about how to perform lighting in WebGL in the article Lighting in WebGL. Lighting issues for mixed reality content In addition to the usual issues that you need to contend with while lighting a scene, the VR or AR use case adds additional areas of concern when writing your shaders. In this section, we provide some basic mixed reality lighting guidelines to consider as you construct, render, and light your scene. While some of these are also useful in any other 3D setting, most are specific to virtual reality and, in some cases even more so, to augmented reality. Since your scene is intended to represent a setting a person or their avatar can exist within, you should try to achieve some degree of consistency and realism in terms of the position...
...o useful in any other 3D setting, most are specific to virtual reality and, in some cases even more so, to augmented reality. Since your scene is intended to represent a setting a person or their avatar can exist within, you should try to achieve some degree of consistency and realism in terms of the positioning and presentation of your light sources. Obviously, there are exceptions to this guideline, such as when your scene represents an otherworldly or alien setting, or when your goal is to create an unsettling visual effect. Realism in light source placement When possible, you should try to make your virtual light sources correspond to objects that actually exists. If you have a virtual room that needs overhead lighting, have a model of a ceiling lamp at the location of your light source...
...en your goal is to create an unsettling visual effect. Realism in light source placement When possible, you should try to make your virtual light sources correspond to objects that actually exists. If you have a virtual room that needs overhead lighting, have a model of a ceiling lamp at the location of your light source. There are exceptions, such as the ambient lighting that simply adds a baseline amount of lighting to your setting, and the sun, which is a directional light (that is, a light source where every light ray is parallel, coming from somewhere in the sky and ending somewhere within your scene). Try to place light sources in realistic locations for the setting and the mood you're trying to create. A scene intended to feel like a naturally-lit, real-world setting doesn't have stu...
Web Audio API best practices - Web APIs
Loading sounds/files There are four main ways to load sound with the Web Audio API and it can be a little confusing as to which one you should use. When working with files, you are looking at either the grabbing the file from an HTMLMediaElement (i.e. ...
...that mean in practice? A user gesture has been interpreted to mean a user-initiated event, normally a click event. Browser vendors decided that Web Audio contexts should not be allowed to automatically play audio; they should instead be started by a user. This is because autoplaying audio can be really annoying and obtrusive. But how do we handle this? When you create an audio context (either offline or online) it is created with a state, which can be suspended, running, or closed. When working with an AudioContext, if you create the audio context from inside a click event the state should automatically be set to running. Here is a simple example of creating the context from inside a click event: const button = document.querySelector('button'); button.addEventListener('click', function() { ...
...he context and start it, if it is suspended, using the resume() method. const audioCtx = new AudioContext(); const button = document.querySelector('button'); button.addEventListener('click', function() { // check if context is in suspended state (autoplay policy) if (audioCtx.state === 'suspended') { audioCtx.resume(); } }, false); You might instead be working with an OfflineAudioContext, in which case you can resume the suspended audio context with the startRendering() method. User control If your website or application contains sound, you should allow the user control over it, otherwise again, it will become annoying. This can be achieved by play/stop and volume/mute controls. The Using the Web Audio API tutorial goes over how to do this. If you have buttons that...
Example and tutorial: Simple synth keyboard - Web APIs
scroll; overflow-y: hidden; width: 660px; height: 110px; white-space: nowrap; margin: 10px; } .keyboard { width: auto; padding: 0; margin: 0; } .key { cursor: pointer; font: 16px "Open Sans", "Lucida Grande", "Arial", sans-serif; border: 1px solid black; border-radius: 5px; width: 20px; height: 80px; text-align: center; box-shadow: 2px 2px darkgray; display: inline-block; position: relative; margin-right: 3px; user-select: none; -moz-user-select: none; -webkit-user-select: none; -ms-user-select: none; } .key div { position: absolute; bottom: 0; text-align: center; width: 100%; pointer-events: none; } .key div sub { font-size: 10px; pointer-events: none; } .key:hover { background-color: #eef; } .key:active { background-color...
...; user-select: none; -moz-user-select: none; -webkit-user-select: none; -ms-user-select: none; } .key div { position: absolute; bottom: 0; text-align: center; width: 100%; pointer-events: none; } .key div sub { font-size: 10px; pointer-events: none; } .key:hover { background-color: #eef; } .key:active { background-color: #000; color: #fff; } .octave { display: inline-block; padding: 0 6px 0 0; } .settingsBar { padding-top: 8px; font: 14px "Open Sans", "Lucida Grande", "Arial", sans-serif; position: relative; vertical-align: middle; width: 100%; height: 30px; } .left { width: 50%; position: absolute; left: 0; display: table-cell; vertical-align: middle; } .left span, .left input { vertical-align: middle; } .right { width: 50%; ...
... let audioContext = new (window.AudioContext || window.webkitAudioContext)(); let oscList = []; let masterGainNode = null; audioContext is set to reference the global AudioContext object (or webkitAudioContext if necessary). oscList is set up to be ready to contain a list of all currently-playing oscillators. ...
Using IIR filters - Web APIs
Now let's get our response data: iirFilter.getFrequencyResponse(myFrequencyArray, magResponseOutput, phaseResponseOutput); We can use this data to draw a filter frequency plot. We'll do so on a 2d canvas context. //...
...tx = canvasEl.getContext('2d'); const width = canvasContainer.offsetWidth; const height = canvasContainer.offsetHeight; canvasEl.width = width; canvasEl.height = height; // set background fill canvasCtx.fillStyle = 'white'; canvasCtx.fillRect(0, 0, width, height); // set up some spacing based on size const spacing = width/16; const fontSize = Math.floor(spacing/1.5); // draw our axis canvasCtx.lineWidth = 2; canvasCtx.strokeStyle = 'grey'; canvasCtx.beginPath(); canvasCtx.moveTo(spacing, spacing); canvasCtx.lineTo(spacing, height-spacing); canvasCtx.lineTo(width-spacing, height-spacing); canvasCtx.stroke(); // axis is gain by frequency -> make labels canvasCtx.font = fontSize+'px sans-serif'; canvasCtx.fillStyle = 'grey'; canvasCtx.fillText('1', spacing-fontSize, spacing+fontSize); canvas...
...This should have shown you how to use the basics, and helped you to understand what it's useful for and how it works. ...
WorkerGlobalScope - Web APIs
e object, except that only a subset of its property and methods are available to workers. WorkerGlobalScope.console Read only Returns the Console associated with the worker. Properties implemented from elsewhere WindowOrWorkerGlobalScope.caches Read only Returns the CacheStorage object associated with the current context. This object enables functionality such as storing assets for offline use, and generating custom responses to requests. WindowOrWorkerGlobalScope.indexedDB Read only Provides a mechanism for applications to asynchronously access capabilities of indexed databases; returns an IDBFactory object. WindowOrWorkerGlobalScope.isSecureContext Read only Returns a boolean indicating whether the current context is secure (true) or not (false). WindowOrWorkerGlobalScope.
...pe.isSecureContext Read only Returns a boolean indicating whether the current context is secure (true) or not (false). WindowOrWorkerGlobalScope.origin Read only Returns the global object's origin, serialized as a string. (This does not yet appear to be implemented in any browser.) Events error Fired when an error occured. Also available via the WorkerGlobalScope.onerror property. offline Fired when the browser has lost access to the network and the value of navigator.onLine switched to false. Also available via the WorkerGlobalScope.onoffline property. online Fired when the browser has gained access to the network and the value of navigator.onLine switched to true. Also available via the WorkerGlobalScope.ononline property. languagechange Fired at the global/worker scope o...
...ion when called (see bug 1336043). Example You won't access WorkerGlobalScope directly in your code; however, its properties and methods are inherited by more specific global scopes such as DedicatedWorkerGlobalScope and SharedWorkerGlobalScope. For example, you could import another script into the worker and print out the contents of the worker scope's navigator object using the following two lines: importScripts('foo.js'); console.log(navigator); Since the global scope of the worker script is effectively the global scope of the worker you are running (DedicatedWorkerGlobalScope or whatever) and all worker global scopes inherit methods, properties, etc. from WorkerGlobalScope, you can run lines such as those above without specifying a parent object. Specifications Specificat...
WorkerNavigator - Web APIs
The WorkerNavigator interface represents a subset of the Navigator interface allowed to be accessed from a Worker. Such an object is initialized for each worker and is available via the WorkerGlobalScope.navigator property obtained by calling window.self.navigator. Properties The WorkerNavigator interface implements properties from the NavigatorID, NavigatorLanguage, NavigatorOnLine, NavigatorDataStore, and NavigatorConcurrentHardware interfaces. WorkerNavigator.connectionRead only Provides a NetworkInformation object containing information about the network connection of a device. WorkerNavigator.locks Read only Returns a LockManager object which provides methods for requesting a new Lock object and querying for an existing Lock object. WorkerNavigator.permissions Read only R...
....hardwareConcurrencyRead only Returns the number of logical processor cores available. NavigatorLanguage.languageRead only Returns a DOMString representing the language version of the browser. The null value is returned when this is unknown. NavigatorLanguage.languagesRead only Returns an array of DOMStrings representing the languages known to the user, in order of preference. NavigatorOnLine.onLineRead only Returns a Boolean indicating whether the browser is online. NavigatorID.platform Read only Returns a string representing the platform of the browser. Do not rely on this property to return the correct value. NavigatorID.product Read only Always returns 'Gecko', on any browser. This property is kept only for compatibility purposes. NavigatorID.userAgentRead only Return...
...browser. Do not rely on this property to return the correct value. NavigatorID.product Read only Always returns 'Gecko', on any browser. This property is kept only for compatibility purposes. NavigatorID.userAgentRead only Returns the user agent string for the current browser. Methods The WorkerNavigator interface implements methods from the NavigatorID, NavigatorLanguage and NavigatorOnLine interfaces. Specifications Specification Status Comment HTML Living StandardThe definition of 'WorkerNavigator' in that specification. Living Standard ...
XRSession - Web APIs
Web › API › XRSession
ce represents an ongoing XR session, providing methods and properties used to interact with and control the session. To open a WebXR session, use the XRSystem interface's requestSession() method. With XRSession methods, you can poll the viewer's position and orientation (the XRViewerPose), gather information about the user's environment, and present imagery to the user. XRSession supports both inline and immersive virtual and augmented reality modes. Properties In addition to the properties listed below, XRSession inherits properties from its parent interface, EventTarget. environmentBlendMode Read only Returns this session's blend mode which denotes how much of the real-world environment is visible through the XR device and how the device will blend the device imagery with it. ...
... actual squeezing when wearing a haptic glove. Also available through the onsqueezestart event handler property. visibilitychange An XRSessionEvent which is sent to the session when its visibility state as indicated by the visibilityState changes. Also available through the onvisibilitychange event handler property. ...
...ts visibility state as indicated by the visibilityState changes. Also available through the onvisibilitychange event handler property. Example This example establishes a new XRSession in inline mode so that it can be displayed within an HTML element, avoiding the need for a dedicated AR or VR viewing device such as a headset. ...
XRSessionInit - Web APIs
e features may be added in future updates to the WebXR standard. Default features Immersive sessions All immersive (both immersive-vr and immersive-ar) sessions support both the viewer and local reference spaces. Because immersive sessions are required to support the local reference space, any request to open an immersive XRSession is required to obtain explicit or implicit user consent. ...
...ed in future updates to the WebXR standard. Default features Immersive sessions All immersive (both immersive-vr and immersive-ar) sessions support both the viewer and local reference spaces. Because immersive sessions are required to support the local reference space, any request to open an immersive XRSession is required to obtain explicit or implicit user consent. ...
... Inline sessions All inline WebXR sessions support the viewer reference space. Security requirements Each reference space or feature type has minimum safety requirements. ...
ARIA: switch role - Accessibility
f (el.getAttribute("aria-checked") == "true") { el.setAttribute("aria-checked", "false"); } else { el.setAttribute("aria-checked", "true"); } } CSS The purpose of the CSS is to establish a look and feel for the switch that's reminiscent of the power switch paradigm. ...
..."true") { el.setAttribute("aria-checked", "false"); } else { el.setAttribute("aria-checked", "true"); } } CSS The purpose of the CSS is to establish a look and feel for the switch that's reminiscent of the power switch paradigm. ...
... Result ...
Basic form hints - Accessibility
s appropriate for form-related elements, but many form controls are implemented as a dynamic JavaScript widget, using <div>s or <span>s. WAI-ARIA, the Accessible Rich Internet Applications specification from the W3C's Web Accessibility Initiative, provides the aria-labelledby attribute for these cases. The example below shows a radio button group implemented using an unordered list. Note that on line 3, the <ul> element sets the aria-labelledby attribute to rg1_label, the id of the <h3> element on line 1, which is the label for the radio group. <h3 id="rg1_label">Lunch Options</h3> <ul class="radiogroup" id="rg1" role="radiogroup" aria-labelledby="rg1_label"> <li id="r1" tabindex="-1" role="radio" aria-checked="false"> <img role="presentation" src="radio-unchecked.gif" /> Thai </l...
...form controls are required or invalid: The aria-required property can be applied to a form element, to indicate to an AT that it is required to complete the form. The aria-invalid state can be programmatically applied, to indicate to an AT which data fields have incorrect data, so that the user knows they have entered invalid data. The example below shows a simple form with three fields. ...
...ey have entered invalid data. The example below shows a simple form with three fields. On lines 4 and 12, the aria-required attributes are set to true (in addition to the asterisks next to the labels), indicating that the name and email fields are required. The second part of the example, a snippet of JavaScript validates the email format, and sets the aria-invalid attribute of the email field (line 12 of the HTML) according to the result (in addition to changing the presentation of the element). <form> <div> <label for="name">* Name:</label> <input type="text" value="name" id="name" aria-required="true"/> </div> <div> <label for="phone">Phone:</label> <input type="text" value="phone" id="phone" aria-required="false"/> </div> <div> <label for="email">* E-mail:<...
Web accessibility for seizures and physical reactions - Accessibility
uced-motion Support for prefers-reduced-motion in modern browsers is growing. @media screen and (prefers-reduced-motion: reduce) { } @media screen and (prefers-reduced-motion) { } To see a great example of how to use the code prefers-reduced-motion, visit the MDN document, prefers-reduced-motion, or see the example below from the section on New in Chrome 74. button { animation: vibrate 0.3s linear infinite both; } @media (prefers-reduced-motion: reduce) { button { animation: none; } } prefers-color-scheme This can be useful if the ambient light API is not available. Support is emerging. @media (prefers-color-scheme: dark) { /* adust styles for dark mode */ } Window.matchMedia() There is a powerful tool available to developers via Window.matchMedia(). A great resource i...
...Selim R. Benbadis, Director, Comprehensive Epilepsy Program and Clinical Neurophysiology Laboratory at USF and TGH in Tampa, ...
...Selim R. Benbadis, Director, Comprehensive Epilepsy Program and Clinical Neurophysiology Laboratory at USF and TGH in Tampa, Florida for their great, great assistance and discussions on this topic. We are a...
-moz-orient - CSS: Cascading Style Sheets
The -moz-orient CSS property specifies the orientation of the element to which it's applied. Syntax The -moz-orient property is specified as one of the keyword values chosen from the list below. Values inline The element is rendered in the same direction as the axis of the text: horizontally for horizontal writing modes, vertically for vertical writing modes. block The element is rendered orthogonally to the axis of the text: vertically for horizontal writing modes, horizontal for vertical writing modes. horizontal The element is rendered horizontally. ...
...irection as the axis of the text: horizontally for horizontal writing modes, vertically for vertical writing modes. block The element is rendered orthogonally to the axis of the text: vertically for horizontal writing modes, horizontal for vertical writing modes. horizontal The element is rendered horizontally. vertical The element is rendered vertically. ...
...ly for horizontal writing modes, horizontal for vertical writing modes. horizontal The element is rendered horizontally. vertical The element is rendered vertically. Formal definition Initial valueinlineApplies toany element; it has an effect on progress and meter, but not on <input type="range"> or other elementsInheritednoComputed valueas specifiedAnimation typediscrete Formal syntax inline | block | horizontal | vertical Examples HTML <p> The following progress meter is horizontal (the default): </p> <progress max="100" value="75"></progress> <p> The following progress meter is vertical: </p> <progress class="vert" max="100" value="75"></progress> CSS .vert { -moz-orient: vertical; width: 16px; height: 150px; } Result Specifications Not part of any standard. ...
::placeholder - CSS: Cascading Style Sheets
Note: In most browsers, the appearance of placeholder text is a translucent or light gray color by default. ...
...ncing low vision conditions will be able to read it while also making sure there is enough of a difference between the placeholder text and input text color that users do not mistake the placeholder for inputed data. Color contrast ratio is determined by comparing the luminosity of the placeholder text and the input background color values. ...
... is determined by comparing the luminosity of the placeholder text and the input background color values. In order to meet current Web Content Accessibility Guidelines (WCAG), a ratio of 4.5:1 is required for text content and 3:1 for larger text such as headings. Large text is defined as 18.66px and bold or larger, or 24px or larger. WebAIM: Color Contrast Checker MDN Understanding WCAG, Guideline 1.4 explanations Understanding Success Criterion 1.4.3 | W3C Understanding WCAG 2.0 Usability Placeholder text with sufficient color contrast may be interpreted as entered input. Placeholder text will also disappear when a person enters content into an <input> element. Both of these circumstances can interfere with successful form completion, especially for people with cognitive concerns. An...
::selection - CSS: Cascading Style Sheets
The ::selection CSS pseudo-element applies styles to the part of a document that has been highlighted by the user (such as clicking and dragging the mouse across text). ::selection { background-color: cyan; } Allowable properties Only certain CSS properties can be used with ::selection: color background-color cursor caret-color outline and its longhands text-decoration and its associated properties text-emphasis-color text-shadow In particular, background-image is ignored. Syntax /* Legacy Firefox syntax (version 61 and below) */ ::-moz-selection ::selection Examples HTML This text has special styles when you highlight it. <p>Also try selecting text in this paragraph.</p> CSS ::-moz-selection { color: gold; background-color: red; } p::-moz-selection { color...
...nderstanding of the functionality. If overridden, it is important to ensure that the contrast ratio between the text and background colors of the selection is high enough that people experiencing low vision conditions can read it. Color contrast ratio is found by comparing the luminosity of the selected text and the selected text background colors. ...
...o is found by comparing the luminosity of the selected text and the selected text background colors. To meet current Web Content Accessibility Guidelines (WCAG), text content must have a contrast ratio of 4.5:1, or 3:1 for larger text such as headings. (WCAG defines large text as between 18.66px and 24px and bold, or 24px or larger.) WebAIM: Color Contrast Checker MDN Understanding WCAG, Guideline 1.4 explanations Understanding Success Criterion 1.4.3 | W3C Understanding WCAG 2.0 Specifications Specification Status Comment CSS Pseudo-Elements Level 4The definition of '::selection' in that specification. Working Draft Initial definition. Note: ::selection was in drafts of CSS Selectors Level 3, but it was removed in the Candidate Recommendation ...
font-weight - CSS: Cascading Style Sheets
for non-variable fonts. CSS Fonts Level 4 extends the syntax to accept any number between 1 and 1000, inclusive, and introduces Variable fonts, which can make use of this much finer-grained range of font weights. Common weight name mapping The numerical values 100 to 900 roughly correspond to the following common weight names: Value Common weight name 100 Thin (Hairline) 200 Extra Light (Ultra Light) 300 Light 400 Normal 500 Medium 600 Semi Bold (Demi Bold) 700 Bold 800 Extra Bold (Ultra Bold) 900 Black (Heavy) Variable fonts Most fonts have a particular weight which corresponds to one of the numbers in Common weight name mapping. However some fonts, called va...
...an support a range of weights with more or less fine granularity, and this can give the designer a much closer degree of control over the chosen weight. For TrueType or OpenType variable fonts, the "wght" variation is used to implement varying weights. ...
...ee of control over the chosen weight. For TrueType or OpenType variable fonts, the "wght" variation is used to implement varying weights. Accessibility concerns People experiencing low vision conditions may have difficulty reading text set with a font-weight value of 100 (Thin/Hairline) or 200 (Extra Light), especially if the font has a low contrast color ratio. ...
Using multi-column layouts - CSS: Cascading Style Sheets
Therefore, to make maximum use of a large screen, authors should have limited-width columns of text placed side by side, just as newspapers do. ...
...Therefore, to make maximum use of a large screen, authors should have limited-width columns of text placed side by side, just as newspapers do. ...
...Therefore, to make maximum use of a large screen, authors should have limited-width columns of text placed side by side, just as newspapers do. ...
Backwards Compatibility of Flexbox - CSS: Cascading Style Sheets
which can save you many hours of puzzling. If you want to include very old browsers with flexbox support then you can include the vendor prefixes in your CSS in addition to the unprefixed version. This is becoming less and less of a requirement today as support is widespread. .wrapper { display: -webkit-box; display: -webkit-flex; display: -ms-flexbox; display: flex; } Autoprefixer Online is a useful way to see which prefixes are recommended, depending on how many versions you wish to go back with browser support. You can also check Can I Use for information about when prefixes were removed in browsers to make your decision. Useful fallback techniques Given that flexbox usage is initiated with value of the display property, when needing to support very old browsers which do not ...
...te floating or clearance of flex item, and do not take it out-of-flow." - 3. Flex Containers In the following live example, I have floated two blocks and then set display: flex on the container. The items are now flex items, which means they stretch to equal height. Any float behaviour does not apply. You can test the fallback behaviour by removing display: flex from the wrapper. display: inline-block Once an inline-block item becomes a flex item, it is blockified and so behavior of display: inline-block like preserving white space between items no longer applies. Remove display: flex to see the fallback behavior. You'll see white space added between the items, which is what happens when using display: inine-block as it prefers white space like other inline items. display: table- ...
... a flex item, it is blockified first, and so anonymous box creation will not happen. For example, two contiguous flex items with display: table-cell will become two separate display: block flex items, instead of being wrapped into a single anonymous table." - 4. Flex Items The vertical-align property The live example below demonstrates use of the vertical-align property along with display: inline-block. Both display: table-cell and display: inline-block allow for the use of this property. Use of vertical-align enables vertical alignment prior to flexbox. The property is ignored by flexbox and so you can use it in conjunction with display: table-cell or display: inline-block as a fallback and then safely use box alignment properties in flexbox instead. Feature Queries and flexbox You c...
Ordering Flex Items - CSS: Cascading Style Sheets
when using Flexbox. We will also consider the implications of reordering items from an accessibility point of view. Reverse the display of the items the flex-direction property can take one of four values: row column row-reverse column-reverse The first two values keep the items in the same order that they appear in the document source order and display them sequentially from the start line. The second two values reverse the items by switching the start and end lines. Remember that the start line relates to writing modes. The row-related examples above demonstrate how row and row-reverse work in a left-to-right language such as English. If you are working in a right-to-left language like Arabic then row would start on the right, row-reverse on the left. This can seem li...
...ul that the items are only visually displayed in reverse order. The specification says the following on this matter: "Note: The reordering capabilities of flex layout intentionally affect only the visual rendering, leaving speech order and navigation based on the source order. This allows authors to manipulate the visual presentation while leaving the source order intact for non-CSS UAs and for linear models such as speech and sequential navigation." - Ordering and Orientation If your items were links or some other element that the user could tab to, then the tabbing order would be the order that these items appear in the document source -- not your visual order. If you are using a reverse value, or otherwise reordering your items, you should consider whether you actually need to change t...
... item 5: order: 1 These items would be displayed on the page in the following order: Source item 3: order: 1 Source item 5: order: 1 Source item 1: order: 2 Source item 2: order: 3 Source item 4: order: 3 You can play around with the values in this live example below and see how that changes the order. Also, try changing flex-direction to row-reverse and see what happens -- the start line is switched so the ordering begins from the opposite side. Flex items have a default order value of 0, therefore items with an integer value greater than 0 will be displayed after any items that have not been given an explicit order value. You can also use negative values with order, which can be quite useful. If you want to make one item display first, and leave the order of all other items ...
CSS Fonts - CSS: Cascading Style Sheets
Web › CSS › CSS Fonts
Basic example The following example shows a simple use of basic font properties to style a paragraph of text. ...
...formation. ...
... OpenType font features guide Font features or variants refer to different glyphs or character styles contained within an OpenType font. These include things like ligatures (special glyphs that combine characters like 'fi' or 'ffl'), kerning (adjustments to the spacing between specific letterform pairings), fractions, numeral styles, and a number of others. These are all refe...
CSS Grid Layout and Accessibility - CSS: Cascading Style Sheets
uld create an accessibility issue through our use of grids? Re-ordering content in CSS Grid Layout We've already seen in these guides that grid gives us power to re-order the content of our page in various ways. We can use the order property, which will change how items auto-place. We can use grid-auto-flow: dense which will take items visually out of DOM order. We can also position items using line-based placement of grid template areas, without considering their location in the source. The specification includes a section that covers Reordering and Accessibility. In the introduction to that section are details of what the specification expects browsers to do when the content is visually reordered using Grid Layout. Grid layout gives authors great powers of rearrangement over the documen...
...ll not change how the items are ordered if the content is being read out by a screen reader, or other text to speech user agent. In addition, the reordering will not change tab order. This means that someone navigating using the keyboard could be tabbing through links on your site and suddenly find themselves jumping from the top to the bottom of the document due to a reordered item being next in line. The specification warns authors (the CSSWG term for web developers) not to do this reordering. Authors must use order and the grid-placement properties only for visual, not logical, reordering of content. Style sheets that use these features to perform logical reordering are non-conforming. What does this mean for designing with grid layout in practice? Visual not logical re-ordering Any ...
...in practice? Visual not logical re-ordering Any time you reorder things with grid layout - or with flexbox - you only perform visual reordering. The underlying source is what controls things like text to speech, and the tab order of the document. You can see how this works with a very simple example. In this example I have used grid to lay out a set of boxes that contain links. I have used the line-based placement properties to position box 1 on the second row of the grid. Visually it now appears as the fourth item in the list. However, if I tab from link to link the tab order still begins with box 1, as it comes first in the source. * {box-sizing: border-box;} .wrapper { border: 2px solid #f76707; border-radius: 5px; background-color: #fff4e6; } .wrapper > div { border...
Using CSS transforms - CSS: Cascading Style Sheets
These transformations include rotation, skewing, scaling, and translation both in the plane and in the 3D space. ...
...px; } /* Define the container div, the cube div, and a generic face */ .container { width: 200px; height: 200px; margin: 75px 0 0 75px; border: none; } .cube { width: 100%; height: 100%; backface-visibility: visible; perspective-origin: 150% 150%; transform-style: preserve-3d; } .face { display: block; position: absolute; width: 100px; height: 100px; border: none; line-height: 100px; font-family: sans-serif; font-size: 60px; color: white; text-align: center; } /* Define each face based on direction */ .front { background: rgba(0, 0, 0, 0.3); transform: translateZ(50px); } .back { background: rgba(0, 255, 0, 1); color: black; transform: rotateY(180deg) translateZ(50px); } .right { background: rgba(196, 0, 0, 0.7); transform: rotateY(90de...
...ive-origin: 200% -200%; } /* Define the container div, the cube div, and a generic face */ .container { width: 100px; height: 100px; margin: 24px; border: none; } .cube { width: 100%; height: 100%; backface-visibility: visible; perspective: 300px; transform-style: preserve-3d; } .face { display: block; position: absolute; width: 100px; height: 100px; border: none; line-height: 100px; font-family: sans-serif; font-size: 60px; color: white; text-align: center; } /* Define each face based on direction */ .front { background: rgba(0, 0, 0, 0.3); transform: translateZ(50px); } .back { background: rgba(0, 255, 0, 1); color: black; transform: rotateY(180deg) translateZ(50px); } .right { background: rgba(196, 0, 0, 0.7); transform: rotateY(90deg)...
Privacy and the :visited selector - CSS: Cascading Style Sheets
is different from the link whose presence in history is being tested, the element will be rendered as if the link were unvisited, as well. Limits to visited link styles You can style visited links, but there are limits to which styles you can use. ...
...b-properties) column-rule-color outline-color The color parts of the fill and stroke attributes In addition, even for the above styles, you won't be able to change the transparency between unvisited and visited links, as you otherwise would be able to using rgba(), hsla(), or the transparent keyword. Here is an example of how to use styles with the aforementioned restrictions: :link { outline: 1px dotted blue; background-color: white; /* The default value of background-color is `transparent`. You need to specify a different value, otherwise changes on :visited won't apply. ...
...s, as you otherwise would be able to using rgba(), hsla(), or the transparent keyword. Here is an example of how to use styles with the aforementioned restrictions: :link { outline: 1px dotted blue; background-color: white; /* The default value of background-color is `transparent`. You need to specify a different value, otherwise changes on :visited won't apply. */ } :visited { outline-color: orange; /* Visited links have an orange outline */ background-color: green; /* Visited links have a green background */ color: yellow; /* Visited links have yellow colored text */ } Impact on web developers Overall, these restrictions shouldn't affect web developers too significantly. They may, however, require the following changes to existing sites: Using backgro...
border-bottom-style - CSS: Cascading Style Sheets
The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Note: The specification doesn't define how borders of different styles connect in the corners. ...
...al values */ border-bottom-style: inherit; border-bottom-style: initial; border-bottom-style: unset; The border-bottom-style property is specified as a single keyword chosen from those available for the border-style property. Formal definition Initial valuenoneApplies toall elements. ...
...r-bottom-style: inherit; border-bottom-style: initial; border-bottom-style: unset; The border-bottom-style property is specified as a single keyword chosen from those available for the border-style property. Formal definition Initial valuenoneApplies toall elements. ...
border-bottom-width - CSS: Cascading Style Sheets
.com/mdn/interactive-examples and send us a pull request. Syntax /* Keyword values */ border-bottom-width: thin; border-bottom-width: medium; border-bottom-width: thick; /* <length> values */ border-bottom-width: 10em; border-bottom-width: 3vmax; border-bottom-width: 6px; /* Global keywords */ border-bottom-width: inherit; border-bottom-width: initial; border-bottom-width: unset; Values <line-width> Defines the width of the border, either as an explicit nonnegative <length> or a keyword. If it's a keyword, it must be one of the following values: thin A thin border medium A medium border thick A thick border Note: Because the specification doesn't define the exact thickness de...
...ing one of them is implementation-specific. Nevertheless, they always follow the pattern thin <= medium <= thick, and the values are constant within a single document. Formal definition Initial valuemediumApplies toall elements. ...
... implementation-specific. Nevertheless, they always follow the pattern thin <= medium <= thick, and the values are constant within a single document. Formal definition Initial valuemediumApplies toall elements. ...
border-left-style - CSS: Cascading Style Sheets
The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Note: The specification doesn't define how borders of different styles connect in the corners. ...
... /* Global values */ border-left-style: inherit; border-left-style: initial; border-left-style: unset; The border-left-style property is specified as a single keyword chosen from those available for the border-style property. Formal definition Initial valuenoneApplies toall elements. ...
...*/ border-left-style: inherit; border-left-style: initial; border-left-style: unset; The border-left-style property is specified as a single keyword chosen from those available for the border-style property. Formal definition Initial valuenoneApplies toall elements. ...
border-left-width - CSS: Cascading Style Sheets
one https://github.com/mdn/interactive-examples and send us a pull request. Syntax /* Keyword values */ border-left-width: thin; border-left-width: medium; border-left-width: thick; /* <length> values */ border-left-width: 10em; border-left-width: 3vmax; border-left-width: 6px; /* Global keywords */ border-left-width: inherit; border-left-width: initial; border-left-width: unset; Values <line-width> Defines the width of the border, either as an explicit nonnegative <length> or a keyword. If it's a keyword, it must be one of the following values: thin A thin border medium A medium border thick A thick border Note: Because the specification doesn't define the exact thickness de...
...using one of them is implementation-specific. Nevertheless, they always follow the pattern thin <= medium <= thick, and the values are constant within a single document. Formal definition Initial valuemediumApplies toall elements. ...
...is implementation-specific. Nevertheless, they always follow the pattern thin <= medium <= thick, and the values are constant within a single document. Formal definition Initial valuemediumApplies toall elements. ...
border-right-style - CSS: Cascading Style Sheets
The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Note: The specification doesn't define how borders of different styles connect in the corners. ...
...Global values */ border-right-style: inherit; border-right-style: initial; border-right-style: unset; The border-right-style property is specified as a single keyword chosen from those available for the border-style property. Formal definition Initial valuenoneApplies toall elements. ...
...order-right-style: inherit; border-right-style: initial; border-right-style: unset; The border-right-style property is specified as a single keyword chosen from those available for the border-style property. Formal definition Initial valuenoneApplies toall elements. ...
border-right-width - CSS: Cascading Style Sheets
://github.com/mdn/interactive-examples and send us a pull request. Syntax /* Keyword values */ border-right-width: thin; border-right-width: medium; border-right-width: thick; /* <length> values */ border-right-width: 10em; border-right-width: 3vmax; border-right-width: 6px; /* Global keywords */ border-right-width: inherit; border-right-width: initial; border-right-width: unset; Values <line-width> Defines the width of the border, either as an explicit nonnegative <length> or a keyword. If it's a keyword, it must be one of the following values: thin A thin border medium A medium border thick A thick border Note: Because the specification doesn't define the exact thickness de...
...sing one of them is implementation-specific. Nevertheless, they always follow the pattern thin <= medium <= thick, and the values are constant within a single document. Formal definition Initial valuemediumApplies toall elements. ...
...s implementation-specific. Nevertheless, they always follow the pattern thin <= medium <= thick, and the values are constant within a single document. Formal definition Initial valuemediumApplies toall elements. ...
border-top-style - CSS: Cascading Style Sheets
The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. The specification doesn't define how borders of different styles connect in the corners. ...
...et; /* Global values */ border-top-style: inherit; border-top-style: initial; border-top-style: unset; The border-top-style property is specified as a single keyword chosen from those available for the border-style property. Formal definition Initial valuenoneApplies toall elements. ...
...ues */ border-top-style: inherit; border-top-style: initial; border-top-style: unset; The border-top-style property is specified as a single keyword chosen from those available for the border-style property. Formal definition Initial valuenoneApplies toall elements. ...
border-top-width - CSS: Cascading Style Sheets
please clone https://github.com/mdn/interactive-examples and send us a pull request. Syntax /* Keyword values */ border-top-width: thin; border-top-width: medium; border-top-width: thick; /* <length> values */ border-top-width: 10em; border-top-width: 3vmax; border-top-width: 6px; /* Global keywords */ border-top-width: inherit; border-top-width: initial; border-top-width: unset; Values <line-width> Defines the width of the border, either as an explicit nonnegative <length> or a keyword. If it's a keyword, it must be one of the following values: thin A thin border medium A medium border thick A thick border Note: Because the specification doesn't define the exact thickness de...
... using one of them is implementation-specific. Nevertheless, they always follow the pattern thin <= medium <= thick, and the values are constant within a single document. Formal definition Initial valuemediumApplies toall elements. ...
... is implementation-specific. Nevertheless, they always follow the pattern thin <= medium <= thick, and the values are constant within a single document. Formal definition Initial valuemediumApplies toall elements. ...
flex-direction - CSS: Cascading Style Sheets
nd row-reverse are affected by the directionality of the flex container. If its dir attribute is ltr, row represents the horizontal axis oriented from the left to the right, and row-reverse from the right to the left; if the dir attribute is rtl, row represents the axis oriented from the right to the left, and row-reverse from the left to the right. ...
...the horizontal axis oriented from the left to the right, and row-reverse from the right to the left; if the dir attribute is rtl, row represents the axis oriented from the right to the left, and row-reverse from the left to the right. Syntax /* The direction text is laid out in a line */ flex-direction: row; /* Like <row>, but reversed */ flex-direction: row-reverse; /* The direction in which lines of text are stacked */ flex-direction: column; /* Like <column>, but reversed */ flex-direction: column-reverse; /* Global values */ flex-direction: inherit; flex-direction: initial; flex-direction: unset; Values The following values are accepted: row The flex container's main-axis is defined to be the same as the text direction. The main-start and main-end points are the same as the co...
...on of content and DOM order. This will adversely affect users experiencing low vision navigating with the aid of assistive technology such as a screen reader. If the visual (CSS) order is important, then screen reader users will not have access to the correct reading order. ...
font-style - CSS: Cascading Style Sheets
chosen font family, the one that most closely matches the specified angle is chosen. If no oblique faces are available, the browser will synthesize an oblique version of the font by slanting a normal face by the specified amount. Valid values are degree values of -90deg to 90deg inclusive. If an angle is not specified, an angle of 14 degrees is used. Positive values are slanted to the end of the line, while negative values are slanted towards the beginning. In general, for a requested angle of 14 degrees or greater, larger angles are prefered; otherwise, smaller angles are preferred (see the spec's font matching section for the precise algorithm). Variable fonts Variable fonts can offer a fine control over the degree to which an oblique face is slanted. You can select this using the <an...
...) { let slant = `oblique ${slantInput.value}deg`; slantLabel.textContent = `font-style: ${slant};`; sampleText.style.fontStyle = slant; } slantInput.addEventListener('input', update); update(); Accessibility concerns Large sections of text set with a font-style value of italic may be difficult for people with cognitive concerns such as Dyslexia to read. ...
...ventListener('input', update); update(); Accessibility concerns Large sections of text set with a font-style value of italic may be difficult for people with cognitive concerns such as Dyslexia to read. MDN Understanding WCAG, Guideline 1.4 explanations W3C Understanding WCAG 2.1 Formal definition Initial valuenormalApplies toall elements. ...
font-variant-numeric - CSS: Cascading Style Sheets
responds to the OpenType values ordn. slashed-zero This keyword forces the use of a 0 with a slash; this is useful when a clear distinction between O and 0 is needed. It corresponds to the OpenType values zero. <numeric-figure-values> These values control the figures used for numbers. Two values are possible: lining-nums activating the set of figures where numbers are all lying on the baseline. It corresponds to the OpenType values lnum. oldstyle-nums activating the set of figures where some numbers, like 3, 4, 7, 9 have descenders. It corresponds to the OpenType values onum. <numeric-spacing-values> These values controls the sizing of figures used for numbers. Two values are possible: proportional-nums activating the set of figures where numbers are not all of the same siz...
...se values controls the glyphs used to display fractions. Two values are possible: diagonal-fractions activating the set of figures where the numerator and denominator are made smaller and separated by a slash. It corresponds to the OpenType values frac. stacked-fractions activating the set of figures where the numerator and denominator are made smaller, stacked and separated by a horizontal line. ...
...minator are made smaller and separated by a slash. It corresponds to the OpenType values frac. stacked-fractions activating the set of figures where the numerator and denominator are made smaller, stacked and separated by a horizontal line. It corresponds to the OpenType values afrc. Formal definition Initial valuenormalApplies toall elements. ...
margin-trim - CSS: Cascading Style Sheets
ed by this box, block-axis margins adjacent to the box's edges are truncated to zero. It also truncates any margins collapsed with such a margin. all Trims the margins of in-flow boxes and floats whose margins coincide with the container's content edge. Formal definition Initial valuenoneApplies toBlock containers and multi-column containers. ...
... content edge. Formal definition Initial valuenoneApplies toBlock containers and multi-column containers. ...
...Instead...
margin - CSS: Cascading Style Sheets
Web › CSS › margin
n all four sides of an element. It is a shorthand for margin-top, margin-right, margin-bottom, and margin-left. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. The top and bottom margins have no effect on non-replaced inline elements, such as <span> or <code>. Note: Margins create extra space around an element. In contrast, padding creates extra space within an element. Syntax /* Apply to all four sides */ margin: 1em; margin: -3px; /* vertical | horizontal */ margin: 5% auto; /* top | horizontal | bottom */ margin: 1em auto 2em; /* top | right | bottom | left */ margin: 2px 1em 0 auto; /* Global values */ m...
...gins. See Mastering margin collapsing for more information. Specifications Specification Status Comment CSS Basic Box ModelThe definition of 'margin' in that specification. Working Draft No significant change. CSS Level 2 (Revision 1)The definition of 'margin' in that specification. Recommendation Removes the effect of top and bottom margins on inline elements. CSS Level 1The definition of 'margin' in that specification. Recommendation Initial definition. Initial valueas each of the properties of the shorthand:margin-bottom: 0margin-left: 0margin-right: 0margin-top: 0Applies toall elements, except elements with table display types other than table-caption, table and inline-table. It also applies to ::first-letter and ::fi...
...ments. CSS Level 1The definition of 'margin' in that specification. Recommendation Initial definition. Initial valueas each of the properties of the shorthand:margin-bottom: 0margin-left: 0margin-right: 0margin-top: 0Applies toall elements, except elements with table display types other than table-caption, table and inline-table. ...
mix-blend-mode - CSS: Cascading Style Sheets
ix-blend-mode values <div class="grid"> <div class="col"> <div class="note">Blending in isolation (no blending with the background)</div> <div class="row isolate"> <div class="cell"> normal <div class="container normal"> <div class="group"> <div class="item firefox"></div> <svg viewBox="0 0 150 150"> <defs> <linearGradient id="red"> <stop offset="0" stop-color="hsl(0,100%,50%)" /> <stop offset="100%" stop-color="hsl(0,0%,100%)" /> </linearGradient> <linearGradient id="green"> <stop offset="0" stop-color="hsl(120,100%,50%)" /> <stop offset="100%" stop-color="hsl(120,0%,100%)" /> </l...
... <stop offset="0" stop-color="hsl(0,100%,50%)" /> <stop offset="100%" stop-color="hsl(0,0%,100%)" /> </linearGradient> <linearGradient id="green"> <stop offset="0" stop-color="hsl(120,100%,50%)" /> <stop offset="100%" stop-color="hsl(120,0%,100%)" /> </linearGradient> <linearGradient id="blue"> <stop offset="0" stop-color="hsl(240,100%,50%)" /> <stop offset="100%" stop-color="hsl(240,0%,100%)" /> </linearGradient> </defs> <ellipse class="item R" cx="75" cy="75" rx="25" ry="70"></ellipse> <ellipse class="item G" cx="75" cy="75" rx="25" ry="70"></ellipse> <el...
...ex: 1 auto; flex-direction: column; height: auto; } .cell { margin: .5em; padding: .5em; background-color: #FFF; overflow: hidden; text-align: center; } .note { background: #fff3d4; padding: 1em; margin: .5em .5em 0; font: .8em sans-serif; text-align: left; white-space: nowrap; } .note + .row .cell { margin-top: 0; } .container { position: relative; background: linear-gradient(to right, #000 0%, transparent 50%, #FFF 100%), linear-gradient(to bottom, #FF0 0%, #F0F 50%, #0FF 100%); width: 150px; height: 150px; margin: 0 auto; } .R { transform-origin: center; transform: rotate(-30deg); fill: url(#red); } .G { transform-origin: center; transform: rotate(90deg); fill: url(#green); } .B { transform-origin: center; transform:...
overscroll-behavior-block - CSS: Cascading Style Sheets
nside the element this value is set on (e.g. "bounce" effects or refreshes), but no scroll chaining occurs to neighbouring scrolling areas, e.g. underlying elements will not scroll. none No scroll chaining occurs to neighbouring scrolling areas, and default scroll overflow behavior is prevented. Formal definition Initial valueautoApplies tonon-replaced block-level elements and non-replaced inline-block elementsInheritednoComputed valueas specifiedAnimation typediscrete Formal syntax contain | none | auto Examples Preventing block overscrolling In this demo we have two block-level boxes, one inside the other. The outer box has a large height set on it so the page will scroll vertically. The inner box has a small width (and height) set on it so it sits comforably inside the viewport, b...
...oll-behavior-block: contain on the inner box. ...
...ground-color: white; background-image: repeating-linear-gradient(to bottom, rgba(0,0,0,0) 0px, rgba(0,0,0,0) 19px, rgba(0,0,0,0.5) 20px); } main > div { height: 300px; width: 400px; overflow: auto; position: relative; top: 50px; left: 50px; overscroll-behavior-block: contain; } div > div { height: 1500px; width: 100%; background-color: yellow; background-image: repeating-linear-gradient(to bottom, rgba(0,0,0,0) 0px, rgba(0,0,0,0) 19px, rgba(0,0,0,0.5) 20px); } p { padding: 10px; background-color: rgba(255,0,0,0.5); margin: 0; width: 340px; position: relative; top: 10px; left: 10px; } Result Specifications Specification Status Comment CSS Overscroll Behavior Module Level 1The definition of 'overscroll-behavior-block' in t...
shape-image-threshold - CSS: Cascading Style Sheets
The same gradient is also used as the image from which the shape is derived for establishing the float area, using th...
...The same gradient is also used as the image from which the shape is derived for establishing the float area, using the shape-outside property. The 20% opacity threshold for treating gradient pixels as...
...The same gradient is also used as the image from which the shape is derived for establishing the float area, using the shape-outside property. ...
text-transform - CSS: Cascading Style Sheets
rowsers in the way the first letter was calculated (Firefox considered - and _ as letters, but other browsers did not. Both Webkit and Gecko incorrectly considered letter-based symbols like (a) to be real letters. Internet Explorer 9 was the closest to the CSS 2 definition, but with some weird cases.) By precisely defining the correct behavior, CSS Text Level 3 cleans this mess up. The capitalize line in the browser compatibility table contains the version the different engines started to support this now precisely-defined behavior. uppercase Is a keyword that converts all characters to uppercase. lowercase Is a keyword that converts all characters to lowercase. none Is a keyword that prevents the case of all characters from being changed. full-width Is a keyword that forces the writ...
...ed for <ruby> annotation text, the keyword converts all small Kana characters to the equivalent full-size Kana, to compensate for legibility issues at the small font sizes typically used in ruby. Accessibility concerns Large sections of text set with a text-transform value of uppercase may be difficult for people with cognitive concerns such as Dyslexia to read. ...
...ll font sizes typically used in ruby. Accessibility concerns Large sections of text set with a text-transform value of uppercase may be difficult for people with cognitive concerns such as Dyslexia to read. MDN Understanding WCAG, Guideline 1.4 explanations W3C Understanding WCAG 2.1 Formal definition Initial valuenoneApplies toall elements. ...
matrix3d() - CSS: Cascading Style Sheets
The matrix3d() CSS function defines a 3D transformation as a 4x4 homogeneous matrix. Its result is a <transform-function> data type. Syntax The matrix3d() function is specified with 16 values. They are described in the column-major order. matrix3d(a1, b1, c1, d1, a2, b2, c2, d2, a3, b3, c3, d3, a4, b4, c4, d4) Values a1 b1 c1 d1 a2 b2 c2 d2 a3 b3 c3 d3 Are <number>s describing the linear transformation. a4 b4 c4 d4 Are <number>s describing the translation to apply. Note: Until Firefox 16, Gecko accepted a <length> value for a4, b4 and c4. Cartesian coordinates on R2 Homogeneous coordinates on RP2 Cartesian coordinates on R3 Homogeneous coordinates on RP3 This transformation applies to the 3D space and can't be represented on the plane. A generic ...
...o accepted a <length> value for a4, b4 and c4. Cartesian coordinates on R2 Homogeneous coordinates on RP2 Cartesian coordinates on R3 Homogeneous coordinates on RP3 This transformation applies to the 3D space and can't be represented on the plane. A generic 3D affine transformation can't be represented using a Cartesian-coordinate matrix, as translations are not linear transformations. 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. HTML <section id="example-element" tabindex="0"> <div class="face front">1</div> <div class="face back">2</div> <div class="face right">3</div> ...
... The matrix below describes the following transformations: Translates every X point by -50px Translates every Y point by -100px Translates every Z point by 0 Scales down by 10% */ transform: matrix3d( 1,0,0,0, 0,1,0,0, 0,0,1,0, ...
widows - CSS: Cascading Style Sheets
Web › CSS › widows
The value must be positive. ...
...The value must be positive. ...
...The value must be positive. ...
word-break - CSS: Cascading Style Sheets
The word-break CSS property sets whether line breaks appear wherever the text would otherwise overflow its content box. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Syntax /* Keyword values */ word-break: normal; word-break: break-all; word-break: keep-all; word-break: break-word; /* deprecated */ /* Global values */ word-break: inherit; word-break: initial; word-break: unset; The word-break property is specified as a single keyword chosen from the list of values below. Values normal Use the default line break rule. break-all To prevent overflow, word breaks should be inserted between any two character...
... break-word Has the same effect as word-break: normal and overflow-wrap: anywhere, regardless of the actual value of the overflow-wrap property. Note: In contrast to word-break: break-word and overflow-wrap: break-word (see overflow-wrap), word-break: break-all will create a break at the exact place where text would otherwise overflow its container (even if putting an entire word on its own line would negate the need for a break). Formal definition Initial valuenormalApplies toall elementsInheritedyesComputed valueas specifiedAnimation typediscrete Formal syntax normal | break-all | keep-all | break-word Examples HTML <p>1. <code>word-break: normal</code></p> <p class="normal narrow">This is a long and Honorificabilitudinitatibus califragilisticexpialidocious Taumatawhakatangiha...
...?????</p> <p>4. <code>word-break: break-word</code></p> <p class="breakWord narrow">This is a long and Honorificabilitudinitatibus califragilisticexpialidocious Taumatawhakatangihangakoauauotamateaturipukakapikimaungahoronukupokaiwhenuakitanatahu ???????????????????????????????????</p> CSS .narrow { padding: 10px; border: 1px solid; width: 500px; margin: 0 auto; font-size: 20px; line-height: 1.5; letter-spacing: 1px; } .normal { word-break: normal; } .breakAll { word-break: break-all; } .keepAll { word-break: keep-all; } .breakWord { word-break: break-word; } Specifications Specification Status Comment CSS Text Module Level 3The definition of 'word-break' in that specification. Working Draft Initial definition ...
Adding captions and subtitles to HTML5 video - Developer guides
cified format, in this case the Web Video Text Tracks (WebVTT) format. The WebVTT specification is still being worked on, but major parts of it are stable so we can use it today. Video providers (such as the Blender Foundation) provide captions and subtitles in a text format with their videos, but they're usually in the SubRip Text (SRT) format. These can be easily converted to WebVTT using an online converter such as srt2vtt. Modifications to the HTML and CSS This section summarises the modifications made to the previous article's code in order to facilitate the addition of subtitles to the video. If you are not interested in this, and just want to get straight into the JavaScript and more relevant CSS, skip to the Subtitle implementation section. In this example we are using a differen...
...bVTT is the ability to style the individual subtitles (something called text cues) via CSS Extensions. The ::cue pseudo-element is the key to targetting individual text track cues for styling, as it matches any defined cue. ...
... called text cues) via CSS Extensions. The ::cue pseudo-element is the key to targetting individual text track cues for styling, as it matches any defined cue. ...
Audio and Video Delivery - Developer guides
s.getUserMedia page. Mediastream Recording New standards are being rolled out to allow your browser to grab media from your mic or camera using getUserMedia and record it instantly using the new MediaRecorder API. You take the stream you receive from getUserMedia, pass it to a MediaRecorder object, take the resulting output and feed it to your audio or video source*. ...
...If this is HTMLMediaElement.NETWORK_NO_SOURCE, you know that all the sources fa...
...If this is HTMLMediaElement.NETWORK_NO_SOURCE, you know that all the sources failed to load. If at that point you add anoth...
HTML5 Parser - Developer guides
Web › Guide › HTML › HTML5 › HTML5 Parser
er, based on HTML5. The HTML parser is one of the most complicated and sensitive pieces of a browser. It controls how your HTML source code is turned into web pages and, as such, changes to it are rare. The new parser is faster, complies with the HTML5 standard, and enables a lot of new functionality as well. The new parser introduces these major improvements: You can now use SVG and MathML inline in HTML5 pages, without XML namespace syntax. Parsing is now done in a separate thread from Firefox's main UI thread, improving overall browser responsiveness. Calls to innerHTML are a lot faster. Dozens of long-standing parser related bugs are now fixed. The HTML5 specification provides a more detailed description than previous HTML standards of how to turn a stream of bytes into a DOM tree...
...IE already fails to parse documents with a missing </title> tag, so if you test with IE, you probably don't have that problem. If you forget to close a comment, the page will most likely fail to be parsed. However, unclosed comments often already break in existing browsers for one reason or another, so it's unlikely that you have this issue in sites that are tested in multiple browsers. In an inline script, in order to use the literal strings <script, </script>, and <!--, you should prevent them from being parsed literally by expressing them as \u003cscript,\u003c/script>, and \u003c!--. The older practice of escaping the string </script> by surrounding it with comment markers, while supported by HTML5, is problematic in cases where the closing comment marker is omitted (see preceding point...
... is problematic in cases where the closing comment marker is omitted (see preceding point). You can avoid such problems by using the character code for the initial '<' instead. (It is valid to use an escape character, e.g., <\/script>, but this strategy does not work for <script and <!--, because \s and \! are not valid JavaScript escapes; the character code strategy is more general-purpose.) Inline SVG and MathML support As a completely new parsing feature, HTML5 introduced support for inline SVG and MathML in text/html. This means that you can now use SVG and MathML inline in text/html similarly to what has previously been possible in application/xhtml+xml. <svg>...</svg> is assigned to the SVG namespace in the DOM. <math>...</math> is assigned to the MathML namespace in the DOM. for...
HTML attribute: multiple - HTML: Hypertext Markup Language
have a different appearance if the multiple attribute is set. For the file input type, the native messaging the browser provides differs. In Firefox, the file input reads "No files selected" when the attribute is present and "No file selected" when not, when no files are selected. Most browsers displaying a scrolling list box for a <select> control with the multiple attribute set versus a single line dropdown when the attribute is ommitted. The email input displays the same, but will match the :invalid pseudo-class if more than one comma-separated email address is included if the attribute is not present. When multiple is set on the email input type, the user can inlclude zero (if not also required), one or more comma-separated email addresses. <input type="email" multiple name="emails" id...
...ents a control for selecting a single <option> from the list of options. <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. Examples email input <label for="emails">Who do you want to email?</label> <input type="email" multiple name="emails" id="emails" list="drawfemails" required size="64"> <datalist id="drawfemails"> <option value="grumpy@woodworkers.com">Grumpy</option> <option value="happy@woodworkers.com">Happy</option> <option value="sleepy@woodworkers.com">Sleepy</option> <option value="ba...
...ple attribute on the <select> element represents a control for selecting zero or more options from the list of options. Otherwise, the <select> element represents a control for selecting a single <option> from the list of options. The control generally has a different appearance based on the presence of the multiple attribute, with most browsers displaying a scrolling list box instead of a single line dropdown when the attribute is present. <form method="get" action="#"> <p> <label for="dwarfs">Select the woodsmen you like:</label> <select multiple name="drawfs" id="drawfs"> <option>grumpy@woodworkers.com</option> <option>happy@woodworkers.com</option> <option>sleepy@woodworkers.com</option> <option>bashful@woodworkers.com</option> <option>sneezy@woodworkers.com</option...
<button>: The Button element - HTML: Hypertext Markup Language
Web › HTML › Element › button
h noting that leaving the button text visually apparent can aid people who may not be familiar with the icon's meaning or understand the button's purpose. This is especially relevant for people who are not technologically sophisticated, or who may have different cultural interpretations for the icon the button uses. What is an accessible name? | The Paciello Group MDN Understanding WCAG, Guideline 4.1 explanations Understanding Success Criterion 4.1.2 | W3C Understanding WCAG 2.0 Size and Proximity Size Interactive elements such as buttons should provide an area large enough that it is easy to activate them. This helps a variety of people, including people with motor control issues and people using non-precise forms of input such as a stylus or fingers. A minimum interactive size of 4...
...ridden, it is important to ensure that the state change when focus is moved to the button is high enough that people experiencing low vision conditions will be able to perceive it. Color contrast ratio is determined by comparing the luminosity of the button text and background color values compared to the background the button is placed on. ...
...mparing the luminosity of the button text and background color values compared to the background the button is placed on. In order to meet current Web Content Accessibility Guidelines (WCAG), a ratio of 4.5:1 is required for text content and 3:1 for large text. (Large text is defined as 18.66px and bold or larger, or 24px or larger.) WebAIM: Color Contrast Checker MDN Understanding WCAG, Guideline 1.4 explanations Understanding Success Criterion 1.4.3 | W3C Understanding WCAG 2.0 Clicking and focus Whether clicking on a <button> causes it to (by default) become focused varies by browser and OS. The results for <input> of type="button" and type="submit" are the same. Does clicking on a <button> give it focus? Desktop Browsers Windows 8.1 OS X 10.X Firefox ...
<fieldset>: The Field Set element - HTML: Hypertext Markup Language
Web › HTML › Element › fieldset
> to be part of, even if it is not inside the form. name The name associated with the group. Note: The caption for the fieldset is given by the first <legend> element nested inside it. Styling with CSS There are several special styling considerations for <fieldset>. Its display value is block by default, and it establishes a block formatting context. If the <fieldset> is styled with an inline-level display value, it will behave as inline-block, otherwise it will behave as block. By default there is a 2px groove border surrounding the contents, and a small amount of default padding. The element has min-inline-size: min-content by default. If a <legend> is present, it is placed over the block-start border. The <legend> shrink-wraps, and also establishes a formatting context. The displa...
...lock, otherwise it will behave as block. By default there is a 2px groove border surrounding the contents, and a small amount of default padding. The element has min-inline-size: min-content by default. If a <legend> is present, it is placed over the block-start border. The <legend> shrink-wraps, and also establishes a formatting context. The display value is blockified. (For example, display: inline behaves as block.) There will be an anonymous box holding the contents of the <fieldset>, which inherits certain properties from the <fieldset>. ...
...gend> is present, it is placed over the block-start border. The <legend> shrink-wraps, and also establishes a formatting context. The display value is blockified. (For example, display: inline behaves as block.) There will be an anonymous box holding the contents of the <fieldset>, which inherits certain properties from the <fieldset>. If the <fieldset> is styled with display: grid or display: inline-grid, then the anonymous box will be a grid formatting context. If the <fieldset> is styled with display: flex or display: inline-flex, then the anonymous box will be a flex formatting context. Otherwise, it establishes a block formatting context. You can feel free to style the <fieldset> and <legend> in any way you want to suit your page design. Examples Simple fieldset This example shows a ...
<input type="email"> - HTML: Hypertext Markup Language
Web › HTML › Element › input › email
xplanatory text nearby. See the section Pattern validation for details and an example. placeholder The placeholder attribute is a string that provides a brief hint to the user as to what kind of information is expected in the field. It should be a word or short phrase that demonstrates the expected type of data, rather than an explanatory message. The text must not include carriage returns or line feeds. If the control's content has one directionality (LTR or RTL) but needs to present the placeholder in the opposite directionality, you can use Unicode bidirectional algorithm formatting characters to override directionality within the placeholder; see Overriding BiDi using Unicode control characters in The Unicode Bidirectional Text Algorithm for those characters. Note: Avoid using the p...
...e validation of e-mail addresses in HTML. See W3C bug 15489 for details. Pattern validation If you need the entered e-mail address to be restricted further than just "any string that looks like an e-mail address," you can use the pattern attribute to specify a regular expression the value must match for it to be valid. If the multiple attribute is specified, each individual item in the comma-delineated list of values must match the regular expression. For example, let's say you're building a page for employees of Best Startup Ever, Inc. which will let them contact their IT department for help. In our simplified form, the user needs to enter their e-mail address and a message describing the problem they need help with. We want to ensure that not only does the user provide a valid e-mail add...
...-mail address, but for security purposes, we require that the address be an internal corporate e-mail address. Since inputs of type email validate against both the standard e-mail address validation and the specified pattern, you can implement this easily. ...
<input type="password"> - HTML: Hypertext Markup Language
Web › HTML › Element › input › password
This character will vary depending on the user agent and OS. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...r the password. If the user hasn't entered anything yet, this value is an empty string (""). If the required property is specified, then the password edit box must contain a value other than an empty string to be valid. If the pattern attribute is specified, the content of a password control is only considered valid if the value passes validation; see Validation for more information. Note: The line feed (U+000A) and carriage return (U+000D) characters are not permitted in a password value. When setting the value of a password control, line feed and carriage return characters are stripped out of the value. Additional attributes In addition to the attributes that operate on all <input> elements regardless of their type, password field inputs support the following attributes: Attr...
...tuation characters, and so forth. See the section Validation for details and an example. placeholder The placeholder attribute is a string that provides a brief hint to the user as to what kind of information is expected in the field. It should be a word or short phrase that demonstrates the expected type of data, rather than an explanatory message. The text must not include carriage returns or line feeds. If the control's content has one directionality (LTR or RTL) but needs to present the placeholder in the opposite directionality, you can use Unicode bidirectional algorithm formatting characters to override directionality within the placeholder; see Overriding BiDi using Unicode control characters in The Unicode Bidirectional Text Algorithm for those characters. Note: Avoid using the p...
<input type="radio"> - HTML: Hypertext Markup Language
Web › HTML › Element › input › radio
he <label> element's for attribute to associate the labels with the radio buttons. You can try out this example here: Data representation of a radio group When the above form is submitted with a radio button selected, the form's data includes an entry in the form contact=value. For example, if the user clicks on the "Phone" radio button then submits the form, the form's data will include the line contact=phone. If you omit the value attribute in the HTML, the submitted form data assigns the value on to the group. In this scenario, if the user clicked on the "Phone" option and submitted the form, the resulting form data would be contact=on, which isn't helpful. So don't forget to set your value attributes! Note: If no radio button is selected when the form is submitted, the radio group ...
... </div> </fieldset> </form> There's not much new to note here except for the addition of <fieldset> and <legend> elements, which help to group the functionality nicely and in a semantic way. ...
...volved is a bit more significant: html { font-family: sans-serif; } div:first-of-type { display: flex; align-items: flex-start; margin-bottom: 5px; } label { margin-right: 15px; line-height: 32px; } input { -webkit-appearance: none; -moz-appearance: none; appearance: none; border-radius: 50%; width: 16px; height: 16px; border: 2px solid #999; transition: 0.2s all linear; margin-right: 5px; position: relative; top: 4px; } input:checked { border: 6px solid black; } button, legend { color: white; background-color: black; padding: 5px 10px; border-radius: 0; border: 0; font-size: 14px; } button:hover, button:focus { color: #999; } button:active { background-color: white; color: black; outline: 1px solid black; } Most notable here ...
<input type="tel"> - HTML: Hypertext Markup Language
Web › HTML › Element › input › tel
ther explanatory text nearby. See Pattern validation below for details and an example. placeholder The placeholder attribute is a string that provides a brief hint to the user as to what kind of information is expected in the field. It should be a word or short phrase that demonstrates the expected type of data, rather than an explanatory message. The text must not include carriage returns or line feeds. If the control's content has one directionality (LTR or RTL) but needs to present the placeholder in the opposite directionality, you can use Unicode bidirectional algorithm formatting characters to override directionality within the placeholder; see Overriding BiDi using Unicode control characters in The Unicode Bidirectional Text Algorithm for those characters. Note: Avoid using the p...
...placeholder, and aria-label to suit the format of telephone numbers in that country/territory. ...
... === "UK") { inputElems[2].parentNode.style.display = "none"; inputElems[0].placeholder = "Area code"; inputElems[0].pattern = "[0-9]{3,6}"; inputElems[1].placeholder = "Local number"; inputElems[1].pattern = "[0-9]{4,8}"; inputElems[1].setAttribute("aria-label","Local number"); } else if(selectElem.value === "Germany") { inputElems[2].parentNode.style.display = "inline"; inputElems[0].placeholder = "Area code"; inputElems[0].pattern = "[0-9]{3,5}"; 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 num...
<input type="text"> - HTML: Hypertext Markup Language
Web › HTML › Element › input › text
The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Value A DOMString representing the text contained in the text field. Events change and input Supported Common Attributes autocomplete, list, maxlength, minlength, pattern, placeholder, readonly, required and size IDL attributes list, value Methods select(), setRangeText() and setSelectionRange(). ...
...explanatory text nearby. See Specifying a pattern for further details and an example. placeholder The placeholder attribute is a string that provides a brief hint to the user as to what kind of information is expected in the field. It should be a word or short phrase that demonstrates the expected type of data, rather than an explanatory message. The text must not include carriage returns or line feeds. If the control's content has one directionality (LTR or RTL) but needs to present the placeholder in the opposite directionality, you can use Unicode bidirectional algorithm formatting characters to override directionality within the placeholder; see Overriding BiDi using Unicode control characters in The Unicode Bidirectional Text Algorithm for those characters. Note: Avoid using the p...
...eyboard. Note: This has been standardized as the global attribute enterkeyhint, but is not yet widely implemented. To see the status of the change being implemented in Firefox, see bug 1490661. Permitted values are: go, done, next, search, and send. The browser decides, using this hint, what label to put on the enter key. Using text inputs <input> elements of type text create basic, single-line inputs. You should use them anywhere you want the user to enter a single-line value and there isn't a more specific input type available for collecting that value (for example, if it's a date, URL, email, or search term, you've got better options available). Basic example <form> <div> <label for="uname">Choose a username: </label> <input type="text" id="uname" name="name"> </div> ...
<tbody>: The Table Body element - HTML: Hypertext Markup Language
Web › HTML › Element › tbody
onetary values. If align is not set to char, this attribute is ignored. charoff This attribute is used to indicate the number of characters to offset the column data from the alignment characters specified by the char attribute. valign This attribute specifies the vertical alignment of the text within each row of cells of the table header. Possible values for this attribute are: baseline, which will put the text as close to the bottom of the cell as it is possible, but align it on the baseline of the characters instead of the bottom of them. If characters are all of the size, this has the same effect as bottom. bottom, which will put the text as close to the bottom of the cell as it is possible; middle, which will center the text in the cell; and top, which will put the tex...
...sics</td> </tr> </tbody> </table> CSS The CSS to style our table is shown next. table { border: 2px solid #555; border-collapse: collapse; font: 16px "Lucida Grande", "Helvetica", "Arial", sans-serif; } First, the table's overall style attributes are set, configuring the thickness, style, and color of the table's exterior borders and using border-collapse to ensure that the border lines are shared among adjacent cells rather than each having its own borders with space in between. font is used to establish an initial font for the table. th, td { border: 1px solid #bbb; padding: 2px 8px 0; text-align: left; } Then the style is set for the majority of the cells in the table, including all data cells but also those styles shared between our <td> and <th> cells. The cells ar...
...ent cells rather than each having its own borders with space in between. font is used to establish an initial font for the table. th, td { border: 1px solid #bbb; padding: 2px 8px 0; text-align: left; } Then the style is set for the majority of the cells in the table, including all data cells but also those styles shared between our <td> and <th> cells. The cells are given a light gray outline which is a single pixel thick, padding is adjusted, and all cells are left-aligned using text-align thead > tr > th { background-color: #cce; font-size: 18px; border-bottom: 2px solid #999; } Finally, header cells contained within the <thead> block are given additional styling. They use a darker background-color, a larger font size, and a thicker, darker bottom border than the other cell ...
<title>: The Document Title element - HTML: Hypertext Markup Language
Web › HTML › Element › title
for search engine optimization (SEO). In general, a longer, descriptive title performs better than short or generic titles. The content of the title is one of the components used by search engine algorithms to decide the order in which to list pages in search results. Also, the title is the initial "hook" by which you grab the attention of readers glancing at the search results page. A few guidelines and tips for composing good titles: Avoid one- or two-word titles. Use a descriptive phrase, or a term-definition pairing for glossary or reference-style pages. Search engines typically display about the first 55-60 characters of a page title. Text beyond that may be lost, so try not to have titles longer than that. If you must use a longer title, make sure the important parts come earlier a...
...cerns It is important to provide a title value that describes the page's purpose. A common navigation technique for users of assistive technology is to read the page title and infer the content the page contains. This is because navigating into a page to determine its content can be a time consuming and potentially confusing process. ...
...navigating into a page to determine its content can be a time consuming and potentially confusing process. Example <title>Menu - Blue House Chinese Food - FoodYum: Online takeout today!</title> To help the user, update the page title value to reflect significant page state changes (such as form validation problems). Example <title>2 errors - Your order - Blue House Chinese Food - FoodYum: Online takeout today!</title> MDN Understanding WCAG, Guideline 2.4 explanations Understanding Success Criterion 2.4.2 | W3C Understanding WCAG 2.0 Specifications Specification Status Comment HTML Living StandardThe definition of '<title>' in that specification. Living Standard HTML5The definition of '<title>' in that specification. Recommendation ...
<wbr> - HTML: Hypertext Markup Language
Web › HTML › Element › wbr
The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Content categories Flow content, phrasing content. Permitted content Empty Tag omission It is an empty element; it must have a start tag, but must not have an end tag. ...
... Permitted ARIA roles Any DOM interface HTMLElement Attributes This element only includes the global attributes. Notes On UTF-8 encoded pages, <wbr> behaves like the U+200B ZERO-WIDTH SPACE code point. In particular, it behaves like a Unicode bidi BN code point, meaning it has no effect on bidi-ordering: <div dir=rtl>123,<wbr>456</div> displays, when not broken on two lines, 123,456 and not 456,123. For the same reason, the <wbr> element does not introduce a hyphen at the line break point. To make a hyphen appear only at the end of a line, use the soft hyphen character entity (&shy;) instead. This element was first implemented in Internet Explorer 5.5 and was officially defined in HTML5. Example The Yahoo Style Guide recommends breaking a URL before punctuation...
...br> element does not introduce a hyphen at the line break point. To make a hyphen appear only at the end of a line, use the soft hyphen character entity (&shy;) instead. This element was first implemented in Internet Explorer 5.5 and was officially defined in HTML5. Example The Yahoo Style Guide recommends breaking a URL before punctuation, to avoid leaving a punctuation mark at the end of the line, which the reader might mistake for the end of the URL. <p>http://this<wbr>.is<wbr>.a<wbr>.really<wbr>.long<wbr>.example<wbr>.com/With<wbr>/deeper<wbr>/level<wbr>/pages<wbr>/deeper<wbr>/level<wbr>/pages<wbr>/deeper<wbr>/level<wbr>/pages<wbr>/deeper<wbr>/level<wbr>/pages<wbr>/deeper<wbr>/level<wbr>/pages</p> Specifications Specification Status Comment HTML Living ...
title - HTML: Hypertext Markup Language
github.com/mdn/interactive-examples and send us a pull request. Some typical uses: Labeling <iframe> elements for assistive technology Providing a programmatically associated label for an <input> element as a fallback for a real <label> Labeling controls in data tables Additional semantics are attached to the title attributes of the <link>, <abbr>, <input>, and <menuitem> elements. ...
...ll request. Some typical uses: Labeling <iframe> elements for assistive technology Providing a programmatically associated label for an <input> element as a fallback for a real <label> Labeling controls in data tables Additional semantics are attached to the title attributes of the <link>, <abbr>, <input>, and <menuitem> elements. Multiline titles The title attribute may contain several lines. ...
...ypical uses: Labeling <iframe> elements for assistive technology Providing a programmatically associated label for an <input> element as a fallback for a real <label> Labeling controls in data tables Additional semantics are attached to the title attributes of the <link>, <abbr>, <input>, and <menuitem> elements. Multiline titles The title attribute may contain several lines. Each U+000A LINE FEED (LF) character represents a line break. Some caution must be taken, as this means the following renders across two lines: HTML <p>Newlines in <code>title</code> should be taken into account, like <abbr title="This is a multiline title">example</abbr>.</p> Result Title attribute inheritance If an element has no title attribute, then it inherits it from its parent node, which in turn ma...
Content-Disposition - HTTP
In a multipart/form-data body, the HTTP Content-Disposition general header is a header that can be used on the subpart of a multipart body to give information about the field it applies to. The subpart is delimited by the boundary defined in the Content-Type header. Used on the body itself, Content-Disposition has no effect. ...
...TP forms and POST requests. Only the value form-data, as well as the optional directive name and filename, can be used in the HTTP context. ...
...der name no Syntax As a response header for the main body The first parameter in the HTTP context is either inline (default value, indicating it can be displayed inside the Web page, or as the Web page) or attachment (indicating it should be downloaded; most browsers presenting a 'Save as' dialog, prefilled with the value of the filename parameters if present). Content-Disposition: inline Content-Disposition: attachment Content-Disposition: attachment; filename="filename.jpg" As a header for a multipart body The first parameter in the HTTP context is always form-data. Additional parameters are case-insensitive and have arguments that use quoted-string syntax after the '=' sign. Multiple parameters are separated by a semi-colon (';'). Content-Disposition: form-data Content-Dispo...
Protocol upgrade mechanism - HTTP
Socket-Extension header in a request is permitted; the result is the same as if you included all of the listed extensions in one such header. Sec-WebSocket-Extensions: extensions extensions A comma-separated list of extensions to request (or agree to support). These should be selected from the IANA WebSocket Extension Name Registry. Extensions which take parameters do so by using semicolon delineation. For example: Sec-WebSocket-Extensions: superspeed, colormode; depth=16 Sec-WebSocket-Key Provides information to the server which is needed in order to confirm that the client is entitled to request an upgrade to WebSocket. This header can be used when insecure (HTTP) clients wish to upgrade, in order to offer some degree of protection against abuse. The value of the key is computed us...
...ec-WebSocket-Protocol The Sec-WebSocket-Protocol header specifies one or more WebSocket protocols that you wish to use, in order of preference. The first one that is supported by the server will be selected and returned by the server in a Sec-WebSocket-Protocol header included in the response. You can use this more than once in the header, as well; the result is the same as if you used a comma-delineated list of subprotocol identifiers in a single header. Sec-WebSocket-Protocol: subprotocols subprotocols A comma-separated list of subprotocol names, in the order of preference. The subprotocols may be selected from the IANA WebSocket Subprotocol Name Registry or may be a custom name jointly understood by the client and the server. Sec-WebSocket-Version Request header Specifies the WebS...
... WebSocket protocol, it will respond with an error (such as 426 Upgrade Required) that includes in its headers a Sec-WebSocket-Version header with a comma-separated list of the supported protocol versions. If the server does support the requested protocol version, no Sec-WebSocket-Version header is included in the response. Sec-WebSocket-Version: supportedVersions supportedVersions A comma-delineated list of the WebSocket protocol versions supported by the server. Response-only headers The response from the server may include these. Sec-WebSocket-Accept Included in the response message from the server during the opening handshake process when the server is willing to initiate a WebSocket connection. It will appear no more than once in the response headers. Sec-WebSocket-Accept: hash...
HTTP Public Key Pinning (HPKP) - HTTP
s necessary to deliver the HPKP header depend on the web server you use. Note: These examples use a max-age of two months and include all subdomains. It is advised to verify that this setup will work for your server. HPKP has the potential to lock out users for a long time if used incorrectly! The use of backup certificates and/or pinning the CA certificate is recommended. Apache Adding a line similar to the following to your webserver's config will enable HPKP on your Apache. This requires mod_headers enabled. Header always set Public-Key-Pins "pin-sha256=\"base64+primary==\"; pin-sha256=\"base64+backup==\"; max-age=5184000; includeSubDomains" Nginx Adding the following line and inserting the appropriate pin-sha256="..." values will enable HPKP on your nginx. This requires the ngx_...
...mary==\"; pin-sha256=\"base64+backup==\"; max-age=5184000; includeSubDomains" Nginx Adding the following line and inserting the appropriate pin-sha256="..." values will enable HPKP on your nginx. This requires the ngx_http_headers_module. add_header Public-Key-Pins 'pin-sha256="base64+primary=="; pin-sha256="base64+backup=="; max-age=5184000; includeSubDomains' always; Lighttpd The following line with your relevant key information (pin-sha256="..." fields) will enable HPKP on lighttpd. setenv.add-response-header = ( "Public-Key-Pins" => "pin-sha256=\"base64+primary==\"; pin-sha256=\"base64+backup==\"; max-age=5184000; includeSubDomains") Note: This requires the mod_setenv server.module loaded which can be included by the following if not already loaded. server.modules += ( "mod_setenv...
...rmation (pin-sha256="..." fields) will enable HPKP on lighttpd. setenv.add-response-header = ( "Public-Key-Pins" => "pin-sha256=\"base64+primary==\"; pin-sha256=\"base64+backup==\"; max-age=5184000; includeSubDomains") Note: This requires the mod_setenv server.module loaded which can be included by the following if not already loaded. server.modules += ( "mod_setenv" ) IIS Add the following line to the Web.config file to send the Public-Key-Pins header: <system.webServer> ... <httpProtocol> <customHeaders> <add name="Public-Key-Pins" value="pin-sha256=&quot;base64+primary==&quot;; pin-sha256=&quot;base64+backup==&quot;; max-age=5184000; includeSubDomains" /> </customHeaders> </httpProtocol> ... </system.webServer> Specifications Specification Title...
CSS Houdini
SS Typed OM is a CSS Object Model with types and methods, exposing values as JavaScript objects making for more intuitive CSS manipulation than previous string based HTMLElement.style manipulations. Every element and style sheet rule has a style map which is accessible via its StylePropertyMap. A feature of CSS Houdini is the Worklet. With worklets, you can create modular CSS, requiring a single line of JavaScript to import configureable components: no pre-processors, post-processors or JavaScript frameworks needed. <script> CSS.paintWorklet.addModule('csscomponent.js'); </script> This added module contains registerPaint() functions, which register completely configurable worklets. The CSS paint() function parameters include the name of the worklet, along with optional parameters. The w...
... meaningfully typed JavaScript representations and back can incur a significant performance overhead. The CSS Typed OM exposes CSS values as typed JavaScript objects to allow their performant manipulation. CSS Typed OM reference CSS Typed OM guide CSS Layout API Designed to improve the extensibility of CSS, this API enables developers to write their own layout algorithms, like masonry or line snapping. It is not yet natively available. No guide or reference has currently been written for this API. CSS Painting API Developed to improve the extensibility of CSS -- allows developers to write JavaScript functions that can draw directly into an element's background, border, or content via the paint() CSS function. CSS Painting API reference CSS Painting API guide Work...
... currently been written for this API. CSS Painting API Developed to improve the extensibility of CSS -- allows developers to write JavaScript functions that can draw directly into an element's background, border, or content via the paint() CSS function. CSS Painting API reference CSS Painting API guide Worklets An API for running scripts in various stages of the rendering pipeline independent of the main JavaScript execution environment. Worklets are conceptually similar to Web Workers, and are called by and extend the rendering engine. Worklets reference Other topics Related topics which may be of interest, since they can be used in tandem with Houdini APIs in interesting ways. Composite Scrolling and Animation ...
Warning: unreachable code after return statement - JavaScript
n expression directly after. When an expression exists after a valid return statement, a warning is given to indicate that the code after the return statement is unreachable, meaning it can never be run. ...
...ollowing line, or to stop execution and return. The warning indicates that there is ambiguity in the way the return statement is written. ...
...ot 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 never reached } Valid cases function f() { var x = 3; x += 4; x -= 3; return x; // OK: return after all other statements } function f() { return 3 + 4 // OK: semicolon-less return with expression on the same line } ...
Error - JavaScript
rties Error.prototype.message Error message. Error.prototype.name Error name. Error.prototype.description A non-standard Microsoft property for the error description. Similar to message. Error.prototype.number A non-standard Microsoft property for an error number. Error.prototype.fileName A non-standard Mozilla property for the path to the file that raised this error. Error.prototype.lineNumber A non-standard Mozilla property for the line number in the file that raised this error. Error.prototype.columnNumber A non-standard Mozilla property for the column number in the line that raised this error. Error.prototype.stack A non-standard Mozilla property for a stack trace. Instance methods Error.prototype.toString() Returns a string representing the specified object. Overri...
... try { throw new CustomError('baz', 'bazMessage') } catch(e) { console.error(e.name) //CustomError console.error(e.foo) //baz console.error(e.message) //bazMessage console.error(e.stack) //stacktrace } ES5 Custom Error Object All browsers include the CustomError constructor in the stack trace when using a prototypal declaration. ...
...e) { console.error(e.name) //CustomError console.error(e.foo) //baz console.error(e.message) //bazMessage console.error(e.stack) //stacktrace } ES5 Custom Error Object All browsers include the CustomError constructor in the stack trace when using a prototypal declaration. ...
RangeError() constructor - JavaScript
The RangeError() constructor creates an error when a value is not in the set or range of allowed values. Syntax new RangeError([message[, fileName[, lineNumber]]]) Parameters message Optional Human-readable description of the error. ...
... The RangeError() constructor creates an error when a value is not in the set or range of allowed values. Syntax new RangeError([message[, fileName[, lineNumber]]]) Parameters message Optional Human-readable description of the error. ...
... The RangeError() constructor creates an error when a value is not in the set or range of allowed values. Syntax new RangeError([message[, fileName[, lineNumber]]]) Parameters message Optional Human-readable description of the error. ...
ReferenceError() constructor - JavaScript
The ReferenceError object represents an error when a non-existent variable is referenced. Syntax new ReferenceError([message[, fileName[, lineNumber]]]) Parameters message Optional Optional. Human-readable description of the error. fileName Optional Optional. The name of the file containing the code that caused the exception. lineNumber Optional Optional. The line number of the code that caused the exception. ...
... the code that caused the exception. ...
... ...
ReferenceError - JavaScript
stance properties ReferenceError.prototype.message Error message. Although ECMA-262 specifies that ReferenceError should provide its own message property, in SpiderMonkey, it inherits Error.prototype.message. ReferenceError.prototype.name Error name. Inherited from Error. ReferenceError.prototype.fileName Path to file that raised this error. Inherited from Error. ReferenceError.prototype.lineNumber Line number in file that raised this error. Inherited from Error. ReferenceError.prototype.columnNumber Column number in line that raised this error. Inherited from Error. ReferenceError.prototype.stack Stack trace. Inherited from Error. Examples Catching a ReferenceError try { let a = undefinedVariable } catch (e) { console.log(e instanceof ReferenceError) // true console.l...
... Stack trace. Inherited from Error. ...
... ...
RegExp.prototype.sticky - JavaScript
s starting with the ^ assertion and using the sticky flag to match when they shouldn't. The bug was introduced some time after Firefox 3.6 (which had the sticky flag but not the bug) and fixed in 2015. ...
...using the sticky flag to match when they shouldn't. The bug was introduced some time after Firefox 3.6 (which had the sticky flag but not the bug) and fixed in 2015. Perhaps because of the bug, the ES2015 specification specifically calls out the fact that: When the y flag is used with a pattern, ^ always matches only at the beginning of the input, or (if multiline is true) at the beginning of a line. ...
...ith a pattern, ^ always matches only at the beginning of the input, or (if multiline is true) at the beginning of a line. Examples of correct behavior: var regex = /^foo/y; regex.lastIndex = 2; regex.test('..foo'); // false - index 2 is not the beginning of the string var regex2 = /^foo/my; regex2.lastIndex = 2; regex2.test('..foo'); // false - index 2 is not the beginning of the string or line regex2.lastIndex = 2; regex2.test('.\nfoo'); // true - index 2 is the beginning of a line Specifications Specification ECMAScript (ECMA-262)The definition of 'RegExp.prototype.sticky' in that specification. ...
String.prototype.charAt() - JavaScript
; console.log("The character at index 1 is '" + anyString.charAt(1) + "'"); console.log("The character at index 2 is '" + anyString.charAt(2) + "'"); console.log("The character at index 3 is '" + anyString.charAt(3) + "'"); console.log("The character at index 4 is '" + anyString.charAt(4) + "'"); console.log("The character at index 999 is '" + anyString.charAt(999) + "'"); These lines display the following: The character at index 0 is 'B' The character at index 0 is 'B' The character at index 1 is 'r' The character at index 2 is 'a' The character at index 3 is 'v' The character at index 4 is 'e' The character at index 999 is '' Getting whole characters The following provides a means of ensuring that going through a string loop always provides a whole characte...
...following provides a means of ensuring that going through a string loop always provides a whole character, even if the string contains characters that are not in the Basic Multi-lingual Plane. ...
...structured assignment, the following is a more succinct and somewhat more flexible alternative in that it does increment for an incrementing variable automatically (if the character warrants it in being a surrogate pair). ...
SyntaxError - JavaScript
or object. Instance properties SyntaxError.prototype.message Error message. Although ECMA-262 specifies that SyntaxError should provide its own message property, in SpiderMonkey, it inherits Error.prototype.message. SyntaxError.prototype.name Error name. Inherited from Error. SyntaxError.prototype.fileName Path to file that raised this error. Inherited from Error. SyntaxError.prototype.lineNumber Line number in file that raised this error. Inherited from Error. SyntaxError.prototype.columnNumber Column number in line that raised this error. Inherited from Error. SyntaxError.prototype.stack Stack trace. Inherited from Error. Examples Catching a SyntaxError try { eval('hoo bar'); } catch (e) { console.error(e instanceof SyntaxError); console.error(e.message); console.
...from Error. SyntaxError.prototype.columnNumber Column number in line that raised this error. Inherited from Error. SyntaxError.prototype.stack Stack trace. Inherited from Error. ...
... ...
TypeError - JavaScript
ew TypeError object. Instance properties TypeError.prototype.message Error message. Although ECMA-262 specifies that TypeError should provide its own message property, in SpiderMonkey, it inherits Error.prototype.message. TypeError.prototype.name Error name. Inherited from Error. TypeError.prototype.fileName Path to file that raised this error. Inherited from Error. TypeError.prototype.lineNumber Line number in file that raised this error. Inherited from Error. TypeError.prototype.columnNumber Column number in line that raised this error. Inherited from Error. TypeError.prototype.stack Stack trace. Inherited from Error. Examples Catching a TypeError try { null.f() } catch (e) { console.log(e instanceof TypeError) // true console.log(e.message) // "null ...
...s error. Inherited from Error. TypeError.prototype.stack Stack trace. Inherited from Error. ...
... ...
URIError() constructor - JavaScript
The URIError() constructor creates an error when a global URI handling function was used in a wrong way. Syntax new URIError([message[, fileName[, lineNumber]]]) Parameters message Optional Optional. Human-readable description of the error. fileName Optional Optional. The name of the file containing the code that caused the exception. lineNumber Optional Optional. The line number of the code that caused the exception. ...
...eNumber Optional Optional. The line number of the code that caused the exception. ...
... ...
URIError - JavaScript
es a new URIError object. Instance properties URIError.prototype.message Error message. Although ECMA-262 specifies that URIError should provide its own message property, in SpiderMonkey, it inherits Error.prototype.message. URIError.prototype.name Error name. Inherited from Error. URIError.prototype.fileName Path to file that raised this error. Inherited from Error. URIError.prototype.lineNumber Line number in file that raised this error. Inherited from Error. URIError.prototype.columnNumber Column number in line that raised this error. Inherited from Error. URIError.prototype.stack Stack trace. Inherited from Error. Examples Catching an URIError try { decodeURIComponent('%') } catch (e) { console.log(e instanceof URIError) // true console.log(e.message) ...
...Inherited from Error. URIError.prototype.stack Stack trace. Inherited from Error. ...
... ...
Trailing commas - JavaScript
This makes version-control diffs cleaner and editing code might be less troublesome. JavaScript has allowed trailing commas in array literals since the beginning, and later added them to object literals (ECMAScript 5) and most recently (ECMAScript 2017) to function parameters. ...
...mma var o = { p: 42, q: true, }; var {p, q,} = o; Again, when using a rest element, a SyntaxError will be thrown: var [a, ...b,] = [1, 2, 3]; // SyntaxError: rest element may not have a trailing comma Trailing commas in JSON Trailing commas in objects were only introduced in ECMAScript 5. ...
...]; // SyntaxError: rest element may not have a trailing comma Trailing commas in JSON Trailing commas in objects were only introduced in ECMAScript 5. As JSON is based on JavaScript's syntax prior to ES5, trailing commas are not allowed in JSON. ...
Web audio codec guide - Web media technologies
oding (AAC) codec is defined as part of the MPEG-4 (H.264) standard; specifically, as part of MPEG-4 Part 3 and MPEG-2 Part 7. Designed to be able to provide more compression with higher audio fidelity than MP3, AAC has become a popular choice, and is the standard format for audio in many types of media, including Blu-Ray discs and HDTV, as well as being the format used for songs purchased from online vendors including iTunes. AAC has a number of profiles that define methods of compressing audio for specific use cases, including everything from high quality surround sound to low-fidelity audio for speech-only use. As a patent-encumbered format, AAC support is somewhat less predictable. For example, Firefox only supports AAC if support is provided by the operating system or an external librar...
...The audio is encoded using Pulse Code Modulation (PCM) with either u-law or A-law encoding. The primary benefit to u-law encoding is that the byte 0x00 never appears in the encoded audio, which may be beneficial in certain applications or networking environments. u-law is primarily used in North America and Japan, with A-law being predominant elsewhere. The drawbacks to G.71...
...ing web apps that use audio as a component of the app, such as games, you will need more control over the encoding process and more options surrounding the format used while encoding the audio. A few popular options: FFmpeg Arguably the best-known and most widely regarded open source codec packages available, FFmpeg supports the majority of the most popular audio formats and provides command-line tools and libraries for encoding, decoding, and performing format conversions of both audio and video. Binaries are available for macOS, Linux, and Windows. Handbrake A highly popular open source front-end to FFmpeg which adds a graphical user interface that makes it much easier to control the wide variety of options FFmpeg offers while encoding audio and/or video. Binaries are available for ma...
Image file type and format guide - Web media technologies
lgorithms Licensing Covered by the Microsoft Open Specification Promise; while Microsoft holds patents against BMP, they have published a promise not to assert its patent rights as long as specific conditions are met. This is not the same as a license, however. BMP is included under the Windows Metafile Format (.wmf). GIF (Graphics Interchange Format) In 1987, the CompuServe online service provider introduced the GIF (Graphics Interchange Format) image file format to provide a compressed graphics format that all members of their service would be able to use. GIF uses the Lempel-Ziv-Welch (LZW) algorithm to losslessly compress 8-bit indexed color graphics. GIF was one of the first two graphics formats supported by HTML, along with XBM. Each pixel in a GIF is represented by ...
...ssless, optionally indexed color like GIF Licensing (C)2003 W3C(R) (MIT, ERCIM, Keio), All Rights Reserved. W3C liability, trademark, document use and software licensing rules apply. No known royalty-bearing patents. SVG (Scalable Vector Graphics) SVG is an XML-based vector graphics format that specifies the contents of an image as a set of drawing commands that create shapes, lines, apply colors, filters, and so forth. SVG files are ideal for diagrams, icons, and other images which can be accurately drawn at any size. As such, SVG is popular for user interface elements in modern Web design. SVG files are text files containing source code that, when interpreted, draws the desired image. For instance, this example defines an drawing area with initial size 100 by 100 units, ...
...rs, filters, and so forth. SVG files are ideal for diagrams, icons, and other images which can be accurately drawn at any size. As such, SVG is popular for user interface elements in modern Web design. SVG files are text files containing source code that, when interpreted, draws the desired image. For instance, this example defines an drawing area with initial size 100 by 100 units, containing a line drawn diagonally through the box: <svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg"> <line x1="0" y1="80" x2="100" y2="20" stroke="black" /> </svg> SVG can be used in web content in two ways: You can directly write the <svg> element within the HTML, containing SVG elements to draw the image. You can display an SVG image anywhere you can use any of the other image types, includ...
Animation performance and frame rate - Web Performance
to the work the browser is doing to render your site, and how you can apply that insight to diagnose and fix performance problems. If you want to play along, the demo website is here. It looks like this: It has two controls: a button to start/stop the animation, and a radio group to choose to animate using margin, or to animate using transform. There are a number of elements, and we've added a linear-gradient background and a box-shadow to each element, because they are both relatively expensive effects to paint. There's also a video version of this walkthrough: Animating using margin Leaving the "Use margin" option set, start the animation, open the Performance tool, and make a recording. You'll only need to record a few seconds. Open up the first recording. Exactly what you'll see d...
...n Leaving the "Use margin" option set, start the animation, open the Performance tool, and make a recording. You'll only need to record a few seconds. Open up the first recording. Exactly what you'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. Waterfall overview This is showing a compressed view of the Waterfall. The predominance of green is telling us that we're spending a lot of time painting. Frame rate This is showing frame rate. Average frame rate here is 46.67fps, well below the target of 60fps. Worse, though, is that the frame rate is very jagged, with lots of dips into the twenties and teens. It's unlikely you'...
...is: Waterfall overview Compared with the version that uses margin, we're seeing a lot less green and a lot more pink, which could be either layout or style recalculation. Frame rate Compared with the version that uses margin, this is looking pretty good. We're averaging nearly 60fps, and apart from one dip near the start, we're getting a consistently high frame rate. Waterfall The timeline view shows the reason for the improved frame rate. Compared with the version that uses margin, we're not spending any time time in layout or (more importantly in this case) in paint: In this case, using transform significantly improved the site's performance, and the performance tools were able to show how and why it did. ...
How to make PWAs installable - Progressive web apps (PWAs)
The installed web app can then be launched by users just as if it were any native app. This article explains how to achieve this using the web app's manifest. These technologies allow the app to be launched directly from the device's home screen, rather than the user having to open the browser and then navigate to the site by using a bookmark or typing the URL. ...
...ser interface that would otherwise be present, creating an even more seamless and native-like feel. Requirements To make the web site installable, it needs the following things in place: A web manifest, with the correct fields filled in The web site to be served from a secure (HTTPS) domain An icon to represent the app on the device A service worker registered, to allow the app to work offline (this is required only by Chrome for Android currently) Currently, only the Chromium-based browsers such as Chrome, Edge, and Samsung Internet require the service worker. If developing your app using Firefox, be aware that you will need a service worker to be compatible with Chromium-based browsers. The manifest file The key element is a web manifest file, which lists all the information ab...
..., and a background color to use in loading or splash screens. This information is needed for the browser to present the web app properly during the installation process, as well as within the device's app-launching interface, such as the home screen of a mobile device. The js13kpwa.webmanifest file of the js13kPWA web app is included in the <head> block of the index.html file using the following line of code: <link rel="manifest" href="js13kpwa.webmanifest"> There are a few common kinds of manifest file that have been used in the past: manifest.webapp was popular in Firefox OS app manifests, and many use manifest.json for web manifests as the contents are organized in a JSON structure. However, the .webmanifest file format is explicitly mentioned in the W3C manifest specification, so that'...
How to make PWAs re-engageable using Notifications and Push - Progressive web apps (PWAs)
Allowing the user to install the web app on their home screen is even better. But instead of relying only on user actions, we can do more, using push messages and notifications to automatically re-engage and deliver new content whenever it is available. Two APIs, one goal The Push API and Notifications API are two separate APIs, but they work well together when you want to provide engaging functionality in your app. ...
...on Identification), which offers an extra layer of security for your app. You can examine the Service Workers Cookbook examples, try to set up a push messaging server using Firebase, or build your own server (using Node.js for example). As mentioned before, to be able to receive push messages, you have to have a service worker, the basics of which are already explained in the Making PWAs work offline with Service workers article. Inside the service worker, a push service subscription mechanism is created. registration.pushManager.getSubscription() .then( /* ... */ ); Once the user is subscribed, they can receive push notifications from the server. From the server-side, the whole process has to be encrypted with public and private keys for security reasons -- allowing everyone to send push ...
... Previous Overview: Progressive Next ...
The building blocks of responsive design - Progressive web apps (PWAs)
hild(3) { width: 100%; clear: left; } x-card:nth-child(3) img { width: 20%; } } So here we're altering the widths of the columns and removing the float of the third column (and adding clearing to guard against any float funny business). We've also altered the width of the images inside the third container (no longer a column -- this is the gallery) so that now you get five per line (it was previously three per line). Narrow screen/mobile layout We then have a narrow screen layout, designed to fit the bill for a mobile app/open Web app experience. This is created in multiple parts. First of all, as expected, there is a media query in our main CSS, which is quite weighty, so we'll go through it in parts: @media all and (max-width: 480px) { x-card:nth-child(1), x-card:n...
...e variations. We then add a rule that positions the second button in any card a button's width higher up the card. When you click on an image in the gallery it brings up options to delete or cancel deletion of the card, and you don't want two buttons on top of one another. x-card:nth-child(3) img { width: 50%; } This rule simply changes the width of the gallery images so now there are two per line. nav { width: 100%; position: absolute; z-index: 1000; display: -webkit-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: ...
...s 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). Next up, the font-size of the buttons is set to 6.8vw. Why? Because the top-margin of the x-cards was set to 17vw earlier on. All buttons in the app have been set to have a line-height of 2.5, in the default CSS at the top of the stylesheet (check if you don't believe me.) And 6.8 x 2.5 = 17. Last, we have used flex: 1; to make the buttons always take up the same proportion of space on the line. Let's have a look at the mobile layout, in the below image. But there are more tricks up our sleeves for this mobile app layout! As mentioned above, we used Mozilla Brick, a co...
alphabetic - SVG: Scalable Vector Graphics
The value is an offset in the font coordinate system. ...
...The value is an offset in the font coordinate system. ...
...The value is an offset in the font coordinate system. ...
calcMode - SVG: Scalable Vector Graphics
The calcMode attribute specifies the interpolation mode for the animation. The default mode is linear, however if the attribute does not support linear interpolation (e.g. for strings), the calcMode attribute is ignored and discrete interpolation is used. Four elements are using this attribute: <animate>, <animateColor>, <animateMotion>, and <animateTransform> Usage notes Value discrete | linear | paced | spline Default value linear Animatable No discrete This specifies that the animation function will jump from one value to the next without any interpolation. linear Simple linear interpolation between values is used to calculate the animation function. Except for <animateMotion>, this is the default value. paced Defines interpolation to p...
...crete This specifies that the animation function will jump from one value to the next without any interpolation. linear Simple linear interpolation between values is used to calculate the animation function. Except for <animateMotion>, this is the default value. paced Defines interpolation to produce an even pace of change across the animation. This is only supported for values that define a linear numeric range, and for which some notion of "distance" between points can be calculated (e.g. position, width, height, etc.). If paced is specified, any keyTimes or keySplines will be ignored. For <animateMotion>, this is the default value. ...
...default value. paced Defines interpolation to produce an even pace of change across the animation. This is only supported for values that define a linear numeric range, and for which some notion of "distance" between points can be calculated (e.g. position, width, height, etc.). If paced is specified, any keyTimes or keySplines will be ignored. For <animateMotion>, this is the default value. spline Interpolates from one value in the values list to the next according to a time function defined by a cubic Bezier spline. The points of the spline are defined in the keyTimes attribute, and the control points for each interval are defined in the keySplines attribute. Specifications Specification Status Comment SVG Animations Level 2The definition of 'calcMode' in t...
color-interpolation-filters - SVG: Scalable Vector Graphics
n-filters attribute specifies the color space for imaging operations performed via filter effects. Notes: This property just has an affect on filter operations. Therefore, it has no effect on filter primitives like <feOffset>, <feImage>, <feTile> or <feFlood>. color-interpolation-filters has a different initial value than color-interpolation. color-interpolation-filters has an initial value of linearRGB, whereas color-interpolation has an initial value of sRGB. Thus, in the default case, filter effects operations occur in the linearRGB color space, whereas all other color interpolations occur by default in the sRGB color space. It has no affect on filter functions, which operate in the sRGB color space. Note: As a presentation attribute, color-interpolation can be used as a CSS property.
...lement but it only has an effect on the following eighteen elements: <feSpotLight>, <feBlend>, <feColorMatrix>, <feComponentTransfer>, <feComposite>, <feConvolveMatrix>, <feDiffuseLighting>, <feDisplacementMap>, <feDropShadow>, <feFlood>, <feGaussianBlur>, <feImage>, <feMerge>, <feMorphology>, <feOffset>, <feSpecularLighting>, <feTile>, <feTurbulence> Usage notes Value auto | sRGB | linearRGB Default value linearRGB Animatable Yes auto Indicates that the user agent can choose either the sRGB or linearRGB spaces for color interpolation. This option indicates that the author doesn't require that color interpolation occur in a particular color space. sRGB Indicates that color interpolation should occur in the sRGB color space. linearRGB Indicate...
... Specifications Specification Status Comment Filter Effects Module Level 1The definition of 'color-interpolation' in that specification. ...
gradientTransform - SVG: Scalable Vector Graphics
rget coordinate system (i.e., userSpaceOnUse or objectBoundingBox). This allows for things such as skewing the gradient. This additional transformation matrix is post-multiplied to (i.e., inserted to the right of) any previously defined transformations, including the implicit transformation necessary to convert from object bounding box units to user space. ...
...n from the gradient coordinate system onto the target coordinate system. Specifications Specification Status Comment CSS Transforms Level 1The definition of 'surfaceScale for <feSpecularLighting>' in that specification. Working Draft Defines the <transformation-list> value. Scalable Vector Graphics (SVG) 2The definition of 'gradientTransformation for <linearGradient>' in that specification. Candidate Recommendation No change Scalable Vector Graphics (SVG) 2The definition of 'gradientTransformation for <radialGradient>' in that specification. Candidate Recommendation No change Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'gradientTransformation for <linearGradient>' in that specification. Reco...
... Candidate Recommendation No change Scalable Vector Graphics (SVG) 2The definition of 'gradientTransformation for <radialGradient>' in that specification. Candidate Recommendation No change Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'gradientTransformation for <linearGradient>' in that specification. Recommendation Initial definition for <linearGradient> Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'gradientTransformation for <radialGradient>' in that specification. Recommendation Initial definition for <radialGradient> ...
marker-mid - SVG: Scalable Vector Graphics
whead or polymarker that will be drawn at all interior vertices of the given shape. The marker is rendered on every vertex other than the first and last vertices of the path data. Note: As a presentation attribute, marker-mid can be used as a CSS property. ...
...e drawn at all interior vertices of the given shape. The marker is rendered on every vertex other than the first and last vertices of the path data. Note: As a presentation attribute, marker-mid can be used as a CSS property. ...
...effect only on the following seven elements: <circle>, <ellipse>, <line>, <path>, <polygon>, <polyline>, and <rect> html, body, svg { height: 100%; } <svg viewBox="0 0 120 120" xmlns="http://www.w3.org/2000/svg"> <defs> <marker id="circle" markerWidth="8" markerHeight="8" refX="4" refY="4"> <circle cx="4" cy="4" r="4" stroke="none" fill="#f00"/> </marker> </defs> <polyline fill="none" stroke="black" points="20,100 40,60 70,80 100,20" marker-mid="url(#circle)"/> </svg> Usage notes Value none | <marker-ref> Default value none Animatable Yes none Indicates that no marker symbol shall be drawn at the given vertices. <marker-ref> This value is a reference to a <marker> element, which will be drawn at the given ...
onclick - SVG: Scalable Vector Graphics
Web › SVG › Attribute › onclick
The onclick attribute specifies some script to run when the element is clicked. ...
... The onclick attribute specifies some script to run when the element is clicked. ...
... The onclick attribute specifies some script to run when the element is clicked. ...
opacity - SVG: Scalable Vector Graphics
Web › SVG › Attribute › opacity
at is, the degree to which the background behind the element is overlaid. Note: As a presentation attribute, opacity can be used as a CSS property. See the css opacity property for more information. ...
... behind the element is overlaid. Note: As a presentation attribute, opacity can be used as a CSS property. See the css opacity property for more information. ...
...nt but it has effect only on the following elements: <a>, <audio>, <canvas>, <circle>, <ellipse>, <foreignObject>, <g>, <iframe>, <image>, <line>, <marker>, <path>, <polygon>, <polyline>, <rect>, <svg>, <switch>, <symbol>, <text>, <textPath>, <tspan>, <use>, <unknown>, and <video> html, body, svg { height: 100%; } <svg viewBox="0 0 200 100" xmlns="http://www.w3.org/2000/svg"> <defs> <linearGradient id="gradient" x1="0%" y1="0%" x2="0" y2="100%"> <stop offset="0%" style="stop-color:skyblue;" /> <stop offset="100%" style="stop-color:seagreen;" /> </linearGradient> </defs> <rect x="0" y="0" width="100%" height="100%" fill="url(#gradient)" /> <circle cx="50" cy="50" r="40" fill="black" /> <circle cx="150" cy="50" r="40" fill="black" opacity="0.3" /> </svg> ...
pathLength - SVG: Scalable Vector Graphics
ength). This can affect the actual rendered lengths of paths; including text paths, animation paths, and various stroke operations. Basically, all computations that require the length of the path. stroke-dasharray, for example, will assume the start of the path being 0 and the end point the value defined in the pathLength attribute. Seven elements are using this attribute: <circle>, <ellipse>, <line>, <path>, <polygon>, <polyline>, and <rect> html,body,svg { height:100% } <svg viewBox="0 0 100 60" xmlns="http://www.w3.org/2000/svg"> <style> path { fill: none; stroke: black; stroke-width: 2; stroke-dasharray: 10; } </style> <!-- No pathLength, the real length of the path is used. In that case, 100 user units --> <path d="M 0,10 h100"/> <!-- compute everyt...
...</svg> circle For <circle>, pathLength lets authors specify a total length for the circle, in user units. Value <number> Default value none Animatable Yes ellipse For <ellipse>, pathLength lets authors specify a total length for the ellipse, in user units. Value <number> Default value none Animatable Yes line For <line>, pathLength lets authors specify a total length for the line, in user units. Value <number> Default value none Animatable Yes path For <path>, pathLength lets authors specify a total length for the path, in user units. Value <number> Default value none Animatable Yes polygon For <polygon>, pathLe...
... Yes path For <path>, pathLength lets authors specify a total length for the path, in user units. Value <number> Default value none Animatable Yes polygon For <polygon>, pathLength lets authors specify a total length for the shape, in user units. Value <number> Default value none Animatable Yes polyline For <polyline>, pathLength lets authors specify a total length for the shape, in user units. Value <number> Default value none Animatable Yes rect For <rect>, pathLength lets authors specify a total length for the rectangle, in user units. Value <number> Default value none Animatable Yes Specification ...
shape-rendering - SVG: Scalable Vector Graphics
The shape-rendering attribute provides hints to the renderer about what tradeoffs to make when rendering shapes like paths, circles, or rectangles. Note: As a presentation attribute, shape-rendering can be used as a CSS property. ...
... shape-rendering attribute provides hints to the renderer about what tradeoffs to make when rendering shapes like paths, circles, or rectangles. Note: As a presentation attribute, shape-rendering can be used as a CSS property. ...
...all emphasize rendering speed over geometric precision and crisp edges. This option will sometimes cause the user agent to turn off shape anti-aliasing. crispEdges This value indicates that the user agent shall attempt to emphasize the contrast between clean edges of artwork over rendering speed and geometric precision. To achieve crisp edges, the user agent might turn off anti-aliasing for all lines and curves or possibly just for straight lines which are close to vertical or horizontal. Also, the user agent might adjust line positions and line widths to align edges with device pixels. geometricPrecision Indicates that the user agent shall emphasize geometric precision over speed and crisp edges. Specifications Specification Status Comment Scalable Vector Gr...
text-decoration - SVG: Scalable Vector Graphics
The fill and stroke of the text decoration are given by the fill and stroke of the text at the point where the text decoration is declared. The paint order of the text decoration, i.e. the fill and stroke, is determined by the value of the paint-order attribute at the point where the text decoration is declared. Note: As a presentation attribute, text-decoration can be used as a CSS property. See the css text-decoration property for more information. ...
...can be used as a CSS property. See the css text-decoration property for more information. As a presentation attribute, it can be applied to any element but it has effect only on the following five elements: <altGlyph>, <text>, <textPath>, <tref>, and <tspan> html, body, svg { height: 100%; } <svg viewBox="0 0 250 50" xmlns="http://www.w3.org/2000/svg"> <text y="20" text-decoration="underline">Underlined text</text> <text x="0" y="40" text-decoration="line-through">Struck-through text</text> </svg> Usage notes Value <'text-decoration-line'> || <'text-decoration-style'> || <'text-decoration-color'> Default value See individual properties Animatable Yes For a description of the values, please refer to the CSS text-decoration property. S...
... See individual properties Animatable Yes For a description of the values, please refer to the CSS text-decoration property. Specifications Specification Status Comment CSS Text Decoration Module Level 3The definition of 'text-decoration' in that specification. Candidate Recommendation Defines the property as a shorthand for text-decoration-line, text-decoration-style, and text-decoration-color. Scalable Vector Graphics (SVG) 2The definition of 'text-decoration' in that specification. Candidate Recommendation Mainly refers to the definition in CSS Text Decoration 3 turning the property into a shorthand for text-decoration-line and text-decoration-style. Scalable Vector Graphics (SVG) 1.1 (Second Edition)The defini...
visibility - SVG: Scalable Vector Graphics
attribute set to hidden still might receive events. Note: As a presentation attribute, visibility can be used as a CSS property. See the css visibility property for more information. ...
...ight receive events. Note: As a presentation attribute, visibility can be used as a CSS property. See the css visibility property for more information. ...
...ton id="nav-toggle-button" > <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" class="button-icon"> <path d="M16.59 8.59L12 13.17 7.41 8.59 6 10l6 6 6-6z" /> <path d="M12 8l-6 6 1.41 1.41L12 10.83l4.59 4.58L18 14z" class="invisible" /> <path d="M0 0h24v24H0z" fill="none" /> </svg> <span> click me </span> </button> CSS svg { display: inline !important; } span { vertical-align: 50%; } button { line-height: 1em; } .invisible { visibility: hidden; } JavaScript document.querySelector("button").addEventListener("click", function (evt) { this.querySelector("svg > path:nth-of-type(1)").classList.toggle("invisible"); this.querySelector("svg > path:nth-of-type(2)").classList.toggle("invisible"); }); Specifications S...
<a> - SVG: Scalable Vector Graphics
Web › SVG › Element › a
does not provide a default visual style for links, it's considered best practice to add some */ @namespace svg url(http://www.w3.org/2000/svg); /* Necessary to select only SVG <a> elements, and not also HTML's. See warning below */ svg|a:link, svg|a:visited { cursor: pointer; } svg|a text, text svg|a { fill: blue; /* Even for text, SVG uses fill over color */ text-decoration: underline; } svg|a:hover, svg|a:active { outline: dotted 1px blue; } Since this element shares its tag name with HTML's <a> element, selecting a with CSS or querySelector may apply to the wrong kind of element. Try the @namespace rule to distinguish the two. Attributes download Instructs browsers to download a URL instead of navigating to it, so the user will be prompted to save it as a loc...
...iredExtensions, systemLanguage Event Attributes Global event attributes, Document element event attributes, Graphical event attributes Presentation Attributes Most notably: clip-path, clip-rule, color, color-interpolation, color-rendering, cursor, display, 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, transform, vector-effect, visibility XLink Attributes Most notably: xlink:title ARIA Attributes aria-activedescendant, aria-atomic, aria-autocomplete, aria-busy, aria-checked, aria-colcount, aria-colindex, aria-colspan, aria-controls, aria-current, aria-describedby, aria-details, aria-disabled, aria-dropeffect, aria-errorme...
...scendant, aria-atomic, aria-autocomplete, aria-busy, aria-checked, aria-colcount, aria-colindex, aria-colspan, aria-controls, aria-current, aria-describedby, aria-details, aria-disabled, aria-dropeffect, aria-errormessage, aria-expanded, aria-flowto, aria-grabbed, aria-haspopup, aria-hidden, aria-invalid, aria-keyshortcuts, aria-label, aria-labelledby, aria-level, aria-live, aria-modal, aria-multiline, aria-multiselectable, aria-orientation, aria-owns, aria-placeholder, aria-posinset, aria-pressed, aria-readonly, aria-relevant, aria-required, aria-roledescription, aria-rowcount, aria-rowindex, aria-rowspan, aria-selected, aria-setsize, aria-sort, aria-valuemax, aria-valuemin, aria-valuenow, aria-valuetext, role Usage notes CategoriesContainer elementPermitted contentAny number of the follow...
<defs> - SVG: Scalable Vector Graphics
Web › SVG › Element › defs
these objects inside of a <defs> element promotes understandability of the SVG content and is beneficial to the overall accessibility of the document. ...
...ody,svg { height:100% } <svg viewBox="0 0 10 10" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> <!-- Some graphical objects to use --> <defs> <circle id="myCircle" cx="0" cy="0" r="5" /> <linearGradient id="myGradient" gradientTransform="rotate(90)"> <stop offset="20%" stop-color="gold" /> <stop offset="90%" stop-color="red" /> </linearGradient> </defs> <!-- using my graphical objects --> <use x="5" y="5" xlink:href="#myCircle" fill="url('#myGradient')" /> </svg> Attributes Global attributes Core Attributes Most notably: id lang Styling Attributes class, style Event Attributes Global event attributes, Document element event attributes, Graphical event attributes Presentation Attributes Most notably: clip...
...yling Attributes class, style Event Attributes Global event attributes, Document element event attributes, Graphical event attributes Presentation Attributes Most notably: clip-path, clip-rule, color, color-interpolation, color-rendering, cursor, display, 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, transform, vector-effect, visibility Usage notes CategoriesContainer element, Structural elementPermitted contentAny number of the following elements, in any order:Animation elementsDescriptive elementsShape elementsStructural elementsGradient elements<a>, <altGlyphDef>, <clipPath>, <color-profile>, <cursor>, <filter>, <font...
<polygon> - SVG: Scalable Vector Graphics
Web › SVG › Element › polygon
html,body,svg { height:100% } <svg viewBox="0 0 200 100" xmlns="http://www.w3.org/2000/svg"> <!-- Example of a polygon with the default fill --> <polygon points="0,100 50,25 50,75 100,0" /> <!-- Example of the same polygon shape with stroke and no fill --> <polygon points="100,100 150,25 150,75 200,0" fill="none" stroke="black" /> </svg> Attributes points This attribute defines the list of points (pairs of x,y absolute coordinates) required to draw the polygon. ...
...sing Attributes Most notably: requiredExtensions, systemLanguage Event Attributes Global event attributes, Graphical event attributes Presentation Attributes Most notably: clip-path, clip-rule, color, color-interpolation, color-rendering, cursor, display, 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, transform, vector-effect, visibility ARIA Attributes aria-activedescendant, aria-atomic, aria-autocomplete, aria-busy, aria-checked, aria-colcount, aria-colindex, aria-colspan, aria-controls, aria-current, aria-describedby, aria-details, aria-disabled, aria-dropeffect, aria-errormessage, aria-expanded, aria-flowto, aria-grabb...
...scendant, aria-atomic, aria-autocomplete, aria-busy, aria-checked, aria-colcount, aria-colindex, aria-colspan, aria-controls, aria-current, aria-describedby, aria-details, aria-disabled, aria-dropeffect, aria-errormessage, aria-expanded, aria-flowto, aria-grabbed, aria-haspopup, aria-hidden, aria-invalid, aria-keyshortcuts, aria-label, aria-labelledby, aria-level, aria-live, aria-modal, aria-multiline, aria-multiselectable, aria-orientation, aria-owns, aria-placeholder, aria-posinset, aria-pressed, aria-readonly, aria-relevant, aria-required, aria-roledescription, aria-rowcount, aria-rowindex, aria-rowspan, aria-selected, aria-setsize, aria-sort, aria-valuemax, aria-valuemin, aria-valuenow, aria-valuetext, role Usage notes CategoriesBasic shape element, Graphics element, Shape elementPermit...
<text> - SVG: Scalable Vector Graphics
Web › SVG › Element › text
* * fill property, the color property is for HTML only */ .Rrrrr { font: italic 40px serif; fill: red; } </style> <text x="20" y="35" class="small">My</text> <text x="40" y="35" class="heavy">cat</text> <text x="55" y="55" class="small">is</text> <text x="65" y="55" class="Rrrrr">Grumpy!</text> </svg> Attributes x The x coordinate of the starting point of the text baseline. Value type: <length>|<percentage> ; Default value: 0; Animatable: yes y The y coordinate of the starting point of the text baseline. Value type: <length>|<percentage> ; Default value: 0; Animatable: yes dx Shifts the text position horizontally from a previous text element. Value type: <length>|<percentage> ; Default value: none; Animatable: yes dy Shifts the text position vertically fro...
...lass, style, font-family, font-size, font-size-adjust, font-stretch, font-style, font-variant, font-weight Conditional Processing Attributes Most notably: requiredExtensions, systemLanguage Event Attributes Global event attributes, Graphical event attributes Presentation Attributes Most notably: clip-path, clip-rule, color, color-interpolation, color-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 Aria Attributes aria-activedescendant, aria-atomic, aria-autocomplete, aria-busy, aria-checked, aria-colcount, aria-colindex, aria-c...
...scendant, aria-atomic, aria-autocomplete, aria-busy, aria-checked, aria-colcount, aria-colindex, aria-colspan, aria-controls, aria-current, aria-describedby, aria-details, aria-disabled, aria-dropeffect, aria-errormessage, aria-expanded, aria-flowto, aria-grabbed, aria-haspopup, aria-hidden, aria-invalid, aria-keyshortcuts, aria-label, aria-labelledby, aria-level, aria-live, aria-modal, aria-multiline, aria-multiselectable, aria-orientation, aria-owns, aria-placeholder, aria-posinset, aria-pressed, aria-readonly, aria-relevant, aria-required, aria-roledescription, aria-rowcount, aria-rowindex, aria-rowspan, aria-selected, aria-setsize, aria-sort, aria-valuemax, aria-valuemin, aria-valuenow, aria-valuetext, role Usage notes CategoriesGraphics element, Text content elementPermitted contentCha...
<tspan> - SVG: Scalable Vector Graphics
Web › SVG › Element › tspan
s needed. html,body,svg { height:100% } <svg viewBox="0 0 240 40" xmlns="http://www.w3.org/2000/svg"> <style> text { font: italic 12px serif; } tspan { font: bold 10px sans-serif; fill: red; } </style> <text x="10" y="30" class="small"> You are <tspan>not</tspan> a banana! </text> </svg> Attributes x The x coordinate of the starting point of the text baseline. Value type: <length>|<percentage> ; Default value: none; Animatable: yes y The y coordinate of the starting point of the text baseline. Value type: <length>|<percentage> ; Default value: none; Animatable: yes dx Shifts the text position horizontally from a previous text element. Value type: <length>|<percentage> ; Default value: none; Animatable: yes dy Shifts the text position vertical...
...: yes Global attributes Core Attributes Most notably: id, tabindex Styling Attributes class, style Conditional Processing Attributes Most notably: requiredExtensions, systemLanguage Event Attributes Global event attributes, Graphical event attributes Presentation Attributes Most notably: clip-path, clip-rule, color, color-interpolation, color-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 Aria Attributes aria-activedescendant, aria-atomic, aria-autocomplete, aria-busy, aria-checked, aria-colcount, aria-colindex, aria-c...
...scendant, aria-atomic, aria-autocomplete, aria-busy, aria-checked, aria-colcount, aria-colindex, aria-colspan, aria-controls, aria-current, aria-describedby, aria-details, aria-disabled, aria-dropeffect, aria-errormessage, aria-expanded, aria-flowto, aria-grabbed, aria-haspopup, aria-hidden, aria-invalid, aria-keyshortcuts, aria-label, aria-labelledby, aria-level, aria-live, aria-modal, aria-multiline, aria-multiselectable, aria-orientation, aria-owns, aria-placeholder, aria-posinset, aria-pressed, aria-readonly, aria-relevant, aria-required, aria-roledescription, aria-rowcount, aria-rowindex, aria-rowspan, aria-selected, aria-setsize, aria-sort, aria-valuemax, aria-valuemin, aria-valuenow, aria-valuetext, role Usage notes CategoriesText content element, Text content child elementPermitted ...
Clipping and masking - SVG: Scalable Vector Graphics
. Color, opacity and such have no effect as long as they don't let parts vanish completely. Masking The effect of masking is most impressively presented with a gradient. If you want an element to fade out, you can achieve this effect quite quickly with masks. ...
... most impressively presented with a gradient. If you want an element to fade out, you can achieve this effect quite quickly with masks. <svg width="200" height="200" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> <defs> <linearGradient id="Gradient"> <stop offset="0" stop-color="black" /> <stop offset="1" stop-color="white" /> </linearGradient> <mask id="Mask"> <rect x="0" y="0" width="200" height="200" fill="url(#Gradient)" /> </mask> </defs> <rect x="0" y="0" width="200" height="200" fill="green" /> <rect x="0" y="0" width="200" height="200" fill="red" mask="url(#Mask)" /> </svg> You see a green-filled rect at the lowest layer and on top a red-filled rect. The latter has the mask attribute pointing t...
...le-color stroke. Using well-known CSS techniques One of the most powerful tools in a web developer's toolbox is display: none. It is therefore little surprise, that it was decided to take this CSS property into SVG as well, together with visibility and clip as defined by CSS 2. For reverting a previously set display: none it is important to know, that the initial value for all SVG elements is inline. << PreviousNext >> ...
Texts - SVG: Scalable Vector Graphics
Web › SVG › Tutorial › Texts
n the introducing example, that the text element can be used to put arbitrary text in SVG documents: <text x="10" y="10">Hello World!</text> The x and y attributes determine, where in the viewport the text will appear. The attribute text-anchor, which can have the values "start", "middle", "end" or "inherit", decides in which direction the text flows from this point. The attribute dominant-baseline decides the vertical alignment. Like with the shape elements text can be colorized with the fill attribute and given a stroke with the stroke attribute. Both may also refer to gradients or patterns, which makes simple coloring text in SVG very powerful compared to CSS 2.1. Setting font properties An essential part of a text is the font in which it is displayed. SVG offers a set of attributes, ...
...of a text element or another tspan element. A typical usecase is to paint one word of a sentence bold red. <text> This is <tspan font-weight="bold" fill="red">bold and red</tspan> </text> Playable code <svg width="350" height="60" xmlns="http://www.w3.org/2000/svg"> <text> This is <tspan font-weight="bold" fill="red">bold and red</tspan> </text> <style><![CDATA[ text{ dominant-baseline: hanging; font: 28px Verdana, Helvetica, Arial, sans-serif; } ]]></style> </svg> The tspan element has the following custom attributes: x Set a new absolute x coordinate for the containing text. This overwrites the default current text position. The attribute may also contain a list of numbers, that are one by one applied to the single characters of the tspan element. dx Start dr...
...w3.org/1999/xlink" xlink:href="#my_path"> A curve. ...
2015 MDN Fellowship Program - Archive of obsolete content
red skills and experience Experience and comfort writing Javascript test scripts. Mentor Information Josh Matthews, Mozilla Platform Group. GitHub: jdm Twitter: @lastontheboat Service Workers Brief Project Description Service workers essentially act as proxy servers that sit between web applications, the browser and (when available) the network. They enable the creation of effective offline experiences and wiill also allow access to push notifications and background sync APIs. Activities and Deliverables Write a demonstration web application (new or existing) to showcase Service Worker functionality. Provide detailed API descriptions. Required skills and experience Experienced Web developer with expertise in JavaScript, CSS, HTML as well as with efficient network interaction (qu...
... Mills, Senior Technology Writer, Mozilla Developer Network. GitHub: ChrisDavidMills Twitter: @chrisdavidmills Why Increase the reach and impact of your expertise Grow your skills beyond coding and managing to educating and communicating Build something used by hundreds of thousands (or more) developers worldwide Directly impact and grow the value of the open web When Application deadline: April 1, 2015 Orientation: Early June (dates TBD) Graduation: August 11-12, 2015 Where Orientation: A Mozilla location (TBD). Core program: Conducted at your normal workspace. The Fine Print Mozilla will provide coaching, direction and training on teaching best practices. Subject to Mozilla's travel reimbursement policies, Mozilla will cover Fellows travel, room, per diem food costs and v...
Loading Content Scripts - Archive of obsolete content
bles you to pass in the text of the script itself as a string literal. This version of the API avoids the need to maintain a separate file for the content script. The contentScriptFile option enables you to pass in the local file URL from which the content script will be loaded. To supply the file "my-content-script.js", located in the /data subdirectory under your add-on's root directory, use a line like: // "data" is supplied by the "self" module var data = require("sdk/self").data; ... contentScriptFile: data.url("my-content-script.js") Both contentScript and contentScriptFile accept an array of strings, so you can load multiple scripts, which can also interact directly with each other in the content process: // "data" is supplied by the "self" module var data = require("sdk/self").dat...
...her in the content process: // "data" is supplied by the "self" module var data = require("sdk/self").data; ... contentScriptFile: [data.url("jquery-1.4.2.min.js"), data.url("my-content-script.js")] Scripts specified using contentScriptFile are loaded before those specified using contentScript. This enables you to load a JavaScript library like jQuery by URL, then pass in a simple script inline that can use jQuery. Unless your content script is extremely simple and consists only of a static string, don't use contentScript: if you do, you may have problems getting your add-on approved on AMO. Instead, keep the script in a separate file and load it using contentScriptFile. This makes your code easier to maintain, secure, debug and review. The contentScriptWhen option specifies when t...
panel - Archive of obsolete content
{ console.log(text); textEntryPanel.hide(); }); The content script "get-text.js" looks like this: // When the user hits return, send the "text-entered" // message to main.js. // The message payload is the contents of the edit box. var textArea = document.getElementById("edit-box"); textArea.addEventListener('keyup', function onkeyup(event) { if (event.keyCode == 13) { // Remove the newline. text = textArea.value.replace(/(\r\n|\n|\r)/gm,""); self.port.emit("text-entered", text); textArea.value = ''; } }, false); // Listen for the "show" event being sent from the // main add-on code. It means that the panel's about // to be shown. // // Set the focus to the text area so the user can // just start typing. self.port.on("show", function onShow() { textArea.focus(); }); ...
...e as the content script above, except that instead of self, we use addon to access the messaging APIs: // When the user hits return, send the "text-entered" // message to main.js. // The message payload is the contents of the edit box. var textArea = document.getElementById("edit-box"); textArea.addEventListener('keyup', function onkeyup(event) { if (event.keyCode == 13) { // Remove the newline. text = textArea.value.replace(/(\r\n|\n|\r)/gm,""); addon.port.emit("text-entered", text); textArea.value = ''; } }, false); // Listen for the "show" event being sent from the // main add-on code. It means that the panel's about // to be shown. // // Set the focus to the text area so the user can // just start typing. addon.port.on("show", function onShow() { textArea.focus(); })...
passwords - Archive of obsolete content
herself with a service. Typically a credential consists of a username and a password. Using this module you can: Search for credentials which have been stored in the Password Manager. You can then use the credentials to access their related service (for example, by logging into a web site). Store credentials in the Password Manager. You can store different sorts of credentials, as outlined in the "Credentials" section below. Remove stored credentials from the Password Manager. Credentials In this API, credentials are represented by objects. You create credential objects to pass into the API, and the API also returns credential objects to you. The sections below explain both the properties you should define on credential objects and the properties you can expect on cred...
...tial objects to pass into the API, and the API also returns credential objects to you. The sections below explain both the properties you should define on credential objects and the properties you can expect on credential objects returned by the API. All credential objects include username and password properties. Different sorts of stored credentials include various additional properties, as outlined in this section. You can use the Passwords API with three sorts of credentials: Add-on credentials HTML form credentials HTTP Authentication credentials Add-on Credential These are associated with your add-on rather than a particular web site. They contain the following properties: username The username. password The password. url For an ...
simple-storage - Archive of obsolete content
t be notified that the session is finished, and will not write your data to the backing store. Accessing storage from the console In the Add-on Debugger, you can access your add-on's simple-storage programmatically from the console using the following: loader.modules['resource://gre/modules/commonjs/sdk/simple-storage.js'].exports.storage Clarification from Mozilla needed: Writing the above line in Add-on Debugger console results in "ReferenceError: loader is not defined". Constructing arrays Be careful to construct array objects conditionally in your code, or you may zero them each time the construction code runs. For example, this add-on tries to store the URLs of pages the user visits: var ss = require("sdk/simple-storage"); ss.storage.pages = []; require("sdk/tabs").on("ready", ...
...e.pages = []; require("sdk/tabs").on("ready", function(tab) { ss.storage.pages.push(tab.url); }); require("sdk/ui/button/action").ActionButton({ id: "read", label: "Read", icon: "./read.png", onClick: function() { console.log(ss.storage.pages); } }); But this isn't going to work, because it empties the array each time the add-on runs (for example, each time Firefox is started). Line 2 needs to be made conditional, so the array is only constructed if it does not already exist: if (!ss.storage.pages) ss.storage.pages = []; Deleting data You can delete properties using the delete operator. Here's an add-on that adds three buttons to write, read, and delete a value: var ss = require("sdk/simple-storage"); require("sdk/ui/button/action").ActionButton({ id: "write", lab...
widget - Archive of obsolete content
on bar. Second, it allows Firefox to treat your interface as a first-class citizen. For example, in the future Firefox may allow the user to drag widgets from the add-on bar to other toolbars. By exposing your interface as a widget, your add-on would automatically inherit such functionality. Creation and content Widgets can contain images or arbitrary web content. You can include this content inline as a string by using the content property, or point to content using a URL with the contentURL property. Upon creation, the widget is automatically added to the add-on bar. You can set the width of a widget, but the height is fixed so as to fit in the add-on bar. If the content is an image, it is automatically scaled to be 16x16 pixels. For example, this widget contains an image, so it looks li...
...() { addon.port.emit("stop"); } } Next, add a script tag to reference "button-script.js", and call its init() function on load: <html> <head> <script src="button-script.js"></script> </head> <body onLoad="init()"> <img src="play.png" id="play-button"> <img src="pause.png" id="pause-button"> <img src="stop.png" id="stop-button"> </body> </html> Finally, remove the line attaching the content script from "main.js": const widgets = require("sdk/widget"); const data = require("sdk/self").data; var player = widgets.Widget({ id: "player", width: 72, label: "Player", contentURL: data.url("buttons.html") }); player.port.emit("init"); player.port.on("play", function() { console.log("playing"); }); player.port.on("pause", function() { console.log("pausin...
lang/functional - Archive of obsolete content
5, 5], had to compute memoizedFn(100); // Returns [2, 2, 5, 5], had to compute memoizedFn(50); // Returns [2, 5, 5] again, but pulled from cache function primeFactorization (x) { // Some tricky stuff } // We can also use a hash function to compute a different // hash value. In this example, we'll fabricate a function // that takes a string of first and last names that // somehow computes the lineage of that name. Our hash // function will just parse the last name, as our naive // implementation assumes that they will share the same lineage let getLineage = memoize(function (name) { // computes lineage return data; }, hasher); // Hashing function takes a string of first and last name // and returns the last name. function hasher (input) { return input.split(" ")[1]; } getLineage("...
... hasher : function An optional function that takes the memoized function's parameter and returns a hash key for storing the result. Returns function : The memoized version of fn. ...
loader/sandbox - Archive of obsolete content
ocumentation on MDN for details). Evaluate code Module provides evaluate function that lets you execute code in the given sandbox: evaluate(scope, 'var a = 5;'); evaluate(scope, 'a + 2;'); //=> 7 More details about evaluated script may be passed via optional arguments that may improve exception reporting: // Evaluate code as if it was loaded from 'http://foo.com/bar.js' and // start from 2nd line. evaluate(scope, 'a ++', 'http://foo.com/bar.js', 2); Version of JavaScript can be also specified via an optional argument: evaluate(scope, 'let b = 2;', 'bar.js', 1, '1.5'); // throws cause `let` is not defined in JS 1.5. Load scripts This module provides a limited API for loading scripts from local URLs. data: URLs are supported. load(scope, 'resource://path/to/my/script.js'); load(scope, ...
...mines the privileges that will be given to the sandbox. This argument can be: a URI string, giving the sandbox the same privileges as a script loaded from that URL a DOM window object, giving the sandbox the same privileges as the DOM window null, to give the sandbox chrome privileges. Returns sandbox : A sandbox in which you can evaluate and load JavaScript. evaluate(sandbox, code, uri, line, version) Evaluate code in sandbox, and return the result. Parameters sandbox : sandbox The sandbox to use. code : string The code to execute. uri : string Evaluate the code as if it were being loaded from the given URI. Optional. line : number Evaluate the code starting at this line. Optional, defaults to 1. version : string Evaluate the code using this version of JavaScript. Default...
jpm - Archive of obsolete content
This is the reference page for jpm. See also jpm tutorial for getting started. jpm usage is: jpm [command] [options] jpm supports the following global options: -h, --help - show a help message and exit -V, --version - print the jpm version number --addon-dir - directory for your source code, defaulting to the current directory Installation jpm is distributed with the node package manager npm. Installing npm There are two ways to get npm. Download and install Node.js from nodejs.org. Node.js includes npm. Or, if you have a package manager like APT, install npm via that. ...
...n your setup, you might need to run this as an administrator: sudo npm install jpm --global Installing jpm locally If you do not wish to, or are unable to, install jpm globally, you may instead install it locally: cd $HOME && npm install jpm To run jpm from a terminal when installed locally, you must add the directory "$HOME/node_modules/.bin/" to your terminal's PATH first. ...
Creating Reusable Modules - Archive of obsolete content
onClick: function() { console.log(md5File(promptForFile())); } }); This works , but index.js is now getting longer and its logic is harder to understand. Let's factor the file picker and hashing code into separate modules. Creating separate modules filepicker.js First create a new file in "lib" called "filepicker.js". Copy the file picker code into this new file, and add the following line at the end: exports.promptForFile = promptForFile; This defines the public interface of the new module. So "filepicker.js" should look like this: var {Cc, Ci} = require("chrome"); function promptForFile() { var window = require("sdk/window/utils").getMostRecentBrowserWindow(); const nsIFilePicker = Ci.nsIFilePicker; var fp = Cc["@mozilla.org/filepicker;1"] .createInstance(...
...rv == nsIFilePicker.returnReplace) { var file = fp.file; // Get the path as string. Note that you usually won't // need to work with the string paths. var path = fp.file.path; // work with returned nsILocalFile... } return path; } exports.promptForFile = promptForFile; md5.js Next, create another file in "lib", called "md5.js". ...
Getting Started (jpm) - Archive of obsolete content
See the instructions for installing jpm. Once you've done that, you'll be looking at a command prompt. ...
...om Firefox 38 onwards. This article describes how to develop using jpm. This tutorial walks through creating a simple add-on using the SDK. Prerequisites To create add-ons for Firefox using the SDK, you'll need: Firefox version 38 or later. If you need to work with earlier versions of Firefox, you'll need to use the old cfx tool. See instructions for getting started with cfx. the command-line jpm tool. See the instructions for installing jpm. Once you've done that, you'll be looking at a command prompt. Install Firefox Developer Version for testing your add-on. Initializing an empty add-on In the command prompt, create a new directory. Navigate to it, type jpm init, and hit enter: mkdir my-addon cd my-addon jpm init You'll then be asked to supply some information about your add...
Logging - Archive of obsolete content
ncluding methods to log error, warning, or informational messages. You don't have to require() anything to get access to the console. It is automatically made available to you. The console.log() method prints an informational message: console.log("Hello World"); Try it out: create a new directory, and navigate to it execute jpm init, accepting all the defaults open "index.js" and add the line above execute jpm run Firefox will start, and the following line will appear in the command window you used to execute jpm run: info: Hello World! console in Content Scripts You can use the console in content scripts as well as in your main add-on code. The following add-on logs the HTML content of every tab the user loads, by calling console.log() inside a content script: require("sdk/ta...
...ou can use the console in content scripts as well as in your main add-on code. The following add-on logs the HTML content of every tab the user loads, by calling console.log() inside a content script: require("sdk/tabs").on("ready", function(tab) { tab.attach({ contentScript: "console.log(document.body.innerHTML);" }); }); console Output If you are running your add-on from the command line (for example, executing jpm run or jpm test) then the console's messages appear in the command shell you used. If you've installed the add-on in Firefox then the messages appear in Firefox's Browser Console. But note that by default, calls to console.log() will not result in any output in the Error Console for any installed add-ons: this includes add-ons installed using the Add-on Builder or us...
Bootstrapped extensions - Archive of obsolete content
Here is an example showing how to use a localized HTML page as an options page: GitHub :: l10n-html-option...
... ...
Canvas code snippets - Archive of obsolete content
ceof Canvas2DContext)) { return new Canvas2DContext(canvas); } this.context = this.ctx = canvas.getContext('2d'); if (!Canvas2DContext.prototype.arc) { Canvas2DContext.setup.call(this, this.ctx); } } Canvas2DContext.setup = function() { var methods = ['arc', 'arcTo', 'beginPath', 'bezierCurveTo', 'clearRect', 'clip', 'closePath', 'drawImage', 'fill', 'fillRect', 'fillText', 'lineTo', 'moveTo', 'quadraticCurveTo', 'rect', 'restore', 'rotate', 'save', 'scale', 'setTransform', 'stroke', 'strokeRect', 'strokeText', 'transform', 'translate']; var getterMethods = ['createPattern', 'drawFocusRing', 'isPointInPath', 'measureText', // drawFocusRing not currently supported // The following might instead be wrapped to be able to chain their child objects 'createIm...
... 'quadraticCurveTo', 'rect', 'restore', 'rotate', 'save', 'scale', 'setTransform', 'stroke', 'strokeRect', 'strokeText', 'transform', 'translate']; var getterMethods = ['createPattern', 'drawFocusRing', 'isPointInPath', 'measureText', // drawFocusRing not currently supported // The following might instead be wrapped to be able to chain their child objects 'createImageData', 'createLinearGradient', 'createRadialGradient', 'getImageData', 'putImageData' ]; var props = ['canvas', 'fillStyle', 'font', 'globalAlpha', 'globalCompositeOperation', 'lineCap', 'lineJoin', 'lineWidth', 'miterLimit', 'shadowOffsetX', 'shadowOffsetY', 'shadowBlur', 'shadowColor', 'strokeStyle', 'textAlign', 'textBaseline']; for (let m of methods) { let method = m; Canvas2DContext...
Label and description - Archive of obsolete content
To cause the text to wrap: Ensure the long-running text is a text node child of <description/> or <label/> (i.e., do not specify the long-running text in the value attribute of these elements). The default style for these XUL elements includes white-space: wrap;. This reduces all whitespace chunks (including newlines) to single spaces. Text is permitted to wrap. <description>I am your father's brother's nephew's cousin's former roommate. What's that make us? Absolutely nothing!</description> With white-space: pre; all whitespace, including newlines, is rendered literally. Text cannot wrap automatically but can still be achieved with <html:br/> if desired. ...
...Text cannot wrap automatically but can still be achieved with <html:br/> if desired. <description style="white-space: pre-wrap;">I am your father's brother's nephew's cousin's former roommate. ...
Miscellaneous - Archive of obsolete content
mozilla1.8/so...pdates.js#1631 bug 338039 tracks improving this situation by providing a simple method to restart the application. Example for Firefox: Services.startup.quit(Services.startup.eForceQuit|Services.startup.eRestart); Mouse and keyboard Detecting mouse wheel events When scrolling the mouse wheel on an element, the DOMMouseScroll event fires. event.detail contains the number of lines to scroll. This event is Mozilla-only; other browsers may support window.onmousewheel. <div id="scrollArea" style="overflow: scroll; height: 6em; width: 10em;"> This is the scrolling area. This is the scrolling area. This is the scrolling area. This is the scrolling area. This is the scrolling area. This is the scrolling area. This is the scrolling area. This is the scrolling ar...
...This is the scrolling area. This is the scrolling area. This is the scrolling area. This is the scrolling area. </div> <script type="text/javascript"> var elm = document.getElementById("scrollArea"); elm.addEventListener("DOMMouseScroll", function scroll(event){ //event.detail is positive for a downward scroll, negative for an upward scroll alert("scrolling " + event.detail + " lines"); }, false); </script> If you do not receive a DOMMouseScroll event while holding any of the modifier keys (Ctrl,Shift,Alt,Meta) you should check the mousewheel.withcontrolkey.action and related preferences. The meaning of the action preference is shown in the following table mousewheel.withXXXkey.action Result 0 Scroll by lines. If set, you will receive DOMMouseScr...
Jetpack Processes - Archive of obsolete content
ript sandbox and returns its global scope. This global scope does not contain privileged APIs, or any non-standard JavaScript objects for that matter, though new globals can be endowed by simply attaching them to the global scope as properties. evalInSandbox(aSandbox, aScript) Evaluates the given script contents in the given sandbox's global scope. At minimum, JavaScript 1.8.1 is used. Individual lines of the form //@line 1 "foo.js" can be used to specify filename and line number information for debugging purposes. gc() Synchronously performs garbage collection. Handles Messages that communicate between the browser and jetpack process may contain only serializable (JSON) data and handles. A handle can be used to provide context for messages. Either the browser or the jetpack implementation ma...
...r(context) When the jetpack process crashes, this message is sent to the parent. If a crash report minidump is available, the context.dumpID property will list the minidump ID of the crash report that was collected. core:exception(error) When an exception occurs in a Jetpack script and is not caught, this message is sent to the parent. The error object contains the following properties: fileName, lineNumber, and message. History See bug 556846 and bug 578821 for details. Sample Code For example code, check out the unit tests. See also nsIJetpackService nsIJetpack ...
Listening to events in Firefox extensions - Archive of obsolete content
completely loaded. load Dispatched after the page--including images--has first finished loading. unload Dispatched when the user has navigated away from the page. pageshow Dispatched when a page is newly displayed. pagehide Dispatched when a page is hidden. Standard behavior for Web pages is: User navigates to a page. ...
...tandard behavior for Web pages is: User navigates to a page. As the page loads, inline scripts run. Once the page is loaded, the onload handler fires. Some pages include a fourth step. If a page uses an unload or beforeunload handler, it fires when the user navigates away from the page. If an unload handler is present, the page will not be cached. When a user navigates to a cached page, inline scripts and the onload handler do not run (steps 2 and 3), since in most cases, the effects of these scripts have been preserved. 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. If you have behavio...
Chapter 6: Firefox extensions and XUL applications - Archive of obsolete content
it in its own window. Using Venkman Read in source code Activate Venkman, and then select Open Windows:quicknote.xul:Files on the top-left of the screen. Double-click on quicknote.js to open it in source-code view (Figure 2). FIXME: Figure 2: Selecting source code Inserting breakpoints Now you'll want to set some breakpoints. Try inserting one within the QuickNote_saveNote function, around line 345 (Figure 3). FIXME: Figure 3: Inserting a breakpoint Start debugger Type in some text into the QuickNote screen, and then select Save Current Tab from the menu. This should halt the program at the spot where you inserted the breakpoint with Venkman, and start the debugger. The Local Variables screen should always display variables and objects during step-by-step execution. With functions t...
...to write tests. Open the about:config screen and edit the extensions.mozlab.mozunit.editor property. Parameters are as shown in Table 1. If you want to use Terapad2, for example, insert the following: C:\app\tpad090\Terapad.exe /jl=%l %f Table 1: Parameters used in MozUnit Parameter Description %f Filename %l Line number %c Column number The author uses Meadow, which is opened using gnuserv. C:\app\Meadow\bin\gnuclientw.exe +%l:%c %f Note that, at least in these tests, you will not be able to edit program files in your editor. And it's probably for the best that you don't use any filenames that have whitespace in them. Usage An RPN calculator We're going to i...
Adding Toolbars and Toolbar Buttons - Archive of obsolete content
ferent systems, and also consider the different button states, but we'll get into that further ahead. The CSS file with your toolbar styles needs to be included in the overlay file, as you would expect, but also in the chrome.manifest file. This is very important because the toolbar customization dialog won't work correctly without this. The way to include the file in the manifest is to add this line: style chrome://global/content/customizeToolbar.xul chrome://xulschoolhello/skin/toolbar.css If you are using XBL bindings (explained way ahead) for your toolbar items, you'll have to include the CSS files for those as well, each in a new line like the one above. We now have code that adds one or more buttons to the toolbar palette. The user can now use the Customize Dialog to add the buttons...
...clicks on the toolbar. This popup is already part of the main window, so it doesn't need to be implemented again. The defaultset attribute lists the ids of the icons you want to include on your toolbar by default. It's a comma-separated list of ids, and it can also include other special values: spacer, separator and spring. spacer represents an empty button space, separator a vertical separation line and spring a flexible empty area that stretches. Finally, the insertbefore attribute places our toolbar above the Bookmarks Toolbar. This is a matter of personal preference, but the Mac OS theme seems to be designed so that the Bookmarks Toolbar is always the last one (it has a lighter color than the rest). It also makes sense from a usability perspective, since bookmarks should be very easy to ...
Appendix A: Add-on Performance - Archive of obsolete content
r add-on. Add-ons can have a noticeable performance impact on Firefox. This is evident when opening a Firefox profile that has many add-ons installed; some profiles can take minutes to load, which is a serious inconvenience for users that gives them a negative view of Firefox. Add-on developers need to make sure that they minimize their add-ons' performance impact, and here are a few simple guidelines that should be followed to achieve that. Startup This is the area where add-ons have the most noticeable impact. Most add-ons use the load event handler in the main overlay to initialize their objects and sometimes read files or even fetch remote data. The problem with the onload event is that it runs before the main window becomes visible, so all handlers need to complete before the user can ...
...The problem with the onload event is that it runs before the main window becomes visible, so all handlers need to complete before the user can see the window. An add-on can normally add a few hundred milliseconds to startup time because of the load handler, and it's not hard to figure out what having several add-ons will do. Luckily, minimizing your startup time is easy, if you follow these guidelines: Do not load or run code before it's needed. Add-ons can have extra features that are only available depending on user preferences. Other add-ons have most of their features depend on a user being logged in to a service. Don't load at startup something you won't need at the time. JavaScript Code Modules. Use them. JSM provide the cleanest way to separate JS into modules that can be loaded on...
Handling Preferences - Archive of obsolete content
eir needs. Since there are some subtleties related to preference management, there are some facilities provided in XUL and Firefox that make this much easier to deal with. The standard way of opening a preferences window is to open the Add-ons Manager, select the add-on, and then click on the Preferences button. In order to have this button enabled in your extension you need to add the following line to install.rdf: <em:optionsURL>chrome://xulschoolhello/content/preferencesWindow.xul</em:optionsURL> If you want to open this window from a different place in the UI, such as a menu item or a button in a toolbar, you need to take into account that the opening behavior of a Preferences window is different depending on the operating system. This is how we do it: openPreferences : function(...
... window or pane using the preference attribute: <textbox preference="xulschoolhello-message-count-pref" type="number" min="0" max="100" /> In this case we use a numeric field to set the message count preference. Changing the value in the control will change the preference (depending on the instant apply rule), and vice versa. You may be able to create a Preferences window without a single line of JS code thanks to the preference element. Finally, groupboxes are a good idea to organize the contents of the window and preference panes. They are heavily stylized in the Firefox Preferences window, so you should include the same CSS file that is included in it (chrome://browser/skin/preferences/preferences.css). This way you don't have to rewrite all the CSS rules defined for Firefox. You s...
Setting up an extension development environment - Archive of obsolete content
ault (stable) and other (unstable) profile(s) created automatically when you run other versions of Firefox earlier. Choose default and uncheck "Don't ask at startup" checkbox. Click "Start Firefox". Now when you start any version of Firefox you may choose any profile you like. Development command flags As of Gecko 2 (Firefox 4), JavaScript files are cached ("fastload"). The -purgecaches command-line flag disables this behavior. Alternatively, you can set the MOZ_PURGE_CACHES environment variable. See this bug for more information. Development preferences There is a set of development preferences that, when enabled, allows you to view more information about application activity, thus making debugging easier. However, these preferences can degrade performance, so you may want to use a separ...
...ox windows Inspect Context Open DOM Inspector at this node from Inspect on context menu. Chrome List navigate and view files in chrome:// (Firefox version, Thunderbird version) Chrome Edit Plus a user file editor (Firefox and Thunderbird) Firebug a variety of development tools (Firefox) Pentadactyl, a general purpose extension with builtin tools for extension development, including a command line with chrome JavaScript evaluation (including property and function argument completion) and the ability to demand-load external JavaScript and CSS files into window chrome. Chromebug combines elements of a JavaScript debugger and DOM (Firefox, "kinda works for Thunderbird") MozRepl explore and modify Firefox and other Mozilla apps while they run (Firefox, Thunderbird version is not working) Ex...
Signing an XPI - Archive of obsolete content
4.6/WINNT5.0_OPT.OBJ/ folder. 2. Extract the contents of the archive file to a local folder. In my case it's C:\Apps\nspr-4.6\ Add path Add the NSS tools bin/ and lib/, and the NSPR lib/ directories to the system path. You can either set this permanently via Control Panel->System Properties->Advanced->Environment Variables->System Variables or do it each time you run the tools from the command-line (preferably using a batch file). Windows contains its own version of some of these files (e.g. certutil.exe) in the system directory (\Windows\system32\) so ensure the new paths are first in the PATH search list. C:\> set PATH=C:\Apps\nss-3.11.4\bin\;C:\Apps\nss-3.11.4\lib\;C:\Apps\nspr-4.6\lib\;%PATH% An easier way is to copy everything from your new directories C:\Apps\nss-3.11.4\ and C:\App...
...lling the new certificate because the key and certificate pair must be together. Hint: When applying for a certificate ensure that the Organisation (O) contains your name and not the Issuer's default text, because this is what is displayed to users. For this guide I applied for a free certificate from Unizeto Certum. After completing the application process where I entered my details into the online application, I received an automated email requesting documentary evidence of my ID in the form of a photo-ID or similar. I have hi-resolution scanned images of my passport and drivers license for these situations so I placed them on my web-server temporarily in a hidden location and emailed Unizeto Certum with the details and location of the files. Within a few hours I received a confirmation em...
Add-ons - Archive of obsolete content
This document has been moved to the Add-ons wiki. How to convert an overlay extension to restartless First off, what kind of add-on are we talking about here? Well, XUL overlays and windows, JSM files, chrome & resource mappings with localization, default preferences, but no XPCOM components of your own. Some of that will have to be replaced and the rest will need to be loaded differently. Inline options Firefox 7 supports a new syntax for defining extensions' preferences for both bootstrapped and traditional extensions. The user interface for the preferences defined with this new syntax appears in the extension's detail view in the Add-on Manager. This functionality originally appeared in Firefox mobile and is now available in Firefox on the desktop as well. Install Manifests An Insta...
...ance of Firefox itself. This article offers some best practices and suggestions that can not only improve the performance and speed of your extension, but also of Firefox itself. Security best practices in extensions This document is intended as a guide for developers to promote best practices in securing your extension. Your goal is to keep your users safe. Some items mentioned are strict guidelines, meaning that if you don't follow them then your add-on will not be approved on Mozilla add-ons. Other items are recommendations. The difference will be clearly flagged. Setting up an extension development environment This article provides suggestions for how to set up your Mozilla application for extension development. These details apply to Firefox, Thunderbird, and SeaMonkey (version 2.0 an...
Adding preferences to an extension - Archive of obsolete content
at Preferences System and the Preferences API. Download the sample You can download a copy of this sample to look over, or to use as the basis for your own extension. Get the code here: Download the sample Update the manifests The install manifest and chrome manifest need to be updated. By and large, the changes are simply changing the ID of the extension. However, we do need to add one new line to the install.rdf file: <em:optionsURL>chrome://stockwatcher2/content/options.xul</em:optionsURL> This line establishes the URL of the XUL file that describes the options dialog. Please note that if you are using code from this tutorial to add to an existing extension, you must uninstall and reinstall your extension to enable the Preferences button for your extension in the Add-ons list. ...
...s two widgets in it. The first is a label describing the textbox. The second is the textbox itself, in which the user enters the symbol. The preference property ties the textbox to the "pref_symbol" <preference> element and to the "extensions.stockwatcher2.symbol" preference. This lets the preference value automatically be updated to reflect the content of the textbox. Alternative method: Inline Options Requires Gecko 7(Firefox 7 / Thunderbird 7 / SeaMonkey 2.4) You could use Inline Options for this preference. You must set em:optionsType to 2 in your install.rdf. Your options.xul file would look like this: <?xml version="1.0" ?> <vbox xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <setting pref="extensions.stockwatcher2.symbol" type="string" title="Stoc...
Monitoring WiFi access points - Archive of obsolete content
monitor;1"].getService(Components.interfaces.nsIWifiMonitor); wifi_service.startWatching(listener); </script> </head> <body> <div id="d"><p></p></div> <div id="c"><p></p></div> </body> </html> The nsIWifiListener object The first thing the code above does is to prototype the listener object that will be receiving notifications of changes to the access point list. This object is described in lines 11 through 40 in the code above. The onChange() method (lines 13 through 27) begins by enabling UniversalXPConnect privileges, then clearing out the div (d) that will receive the updated list of access points. Then the loop in lines 19-22 iterates over the list of access points received in the accessPoints array and adds them to the HTML in the div. Then the c div is updated with the number of t...
...loop in lines 19-22 iterates over the list of access points received in the accessPoints array and adds them to the HTML in the div. Then the c div is updated with the number of times the list has been refreshed. The onError() method simply opens an alert that displays the error code received. Starting to monitor access points To start monitoring the access points, we instantiate the listener (on line 44), then get access to the WiFi monitor interface on line 45. The monitoring is started up on line 47, by calling the WiFi monitoring service's startWatching() method. ...
Source Navigator - Archive of obsolete content
the declaration/definition of a method/function to look up... but on the other hand mxr can only allow you to type in the name for it to generate a long list of occurances. (as I understand. Let me know if this is wrong..) It can generate a class hierarchy quite easily (unfortunately, not for classnames which are defined by macro.) Installing Source Navigator In Ubuntu Execute the following line in a terminal window: sudo apt-get install sourcenav This should install source-navigator. One can check whether the installation is complete by executing: $ which snavigator /usr/bin/snavigator Importing the source Execute the following: snavigator. This triggers a splash screen, followed by a "Source-Navigator Projects" dialog as the following: I've already created a new project bin.proj ...
...lete by executing: $ which snavigator /usr/bin/snavigator Importing the source Execute the following: snavigator. This triggers a splash screen, followed by a "Source-Navigator Projects" dialog as the following: I've already created a new project bin.proj before documenting this. If this is your first time to open source navigator, the big white box on the left of the dialog should contain no lines. Click "New Project". 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. (You can always include more by pressing the "More" button.) In my case, I inputted the followings: Project File: <tt>~/snav-mozilla</tt> Add Directory (where your so...
Autodial for Windows NT - Archive of obsolete content
The problem is with the AOL client, be the bug could probably be fixed by not changing Mozilla to avoid using the AOL client as a dialer even though it installs itself as one. A parallel feature has been requested in bug 130774: if we trigger the autodial connection, we should ask the user if he wants to hang up the connection when we close Mozilla. There also has been some confusion about what online/offline means. In Mozilla, it means try to access the network or not. To some users, it means connected to a network or not. Some people expect an option to toggle online/offline should trigger dialup or disconnect. This is a misunderstanding of this mode. Hanging up a dialup connection should not cause Mozilla to go into offline mode. Making a dialup connection should not cause Mozilla to go int...
... A Pref to Disable Users can bypass the feature altogether by setting the pref network.autodial-helper.enabled to false. Since the feature was implemented close to the release of Netscape 7, the pref was added so that we could include the feature in the 7.0 release with the feature turned off and enable it in specific cases. The feature was turned on in Mozilla 1.1 to get more exposure. ...
Locked config settings - Archive of obsolete content
e put into a mozilla.cfg file in the C:\Program Files\mozilla.org\Mozilla directory. The mozilla.cfg file is an encoded file of javascript commands. The encoding is a simple "byte-shifting" with an offset of 13 (netscape 4 used a similar encoding, but with a of 7 instead). This file also needs to be "called" from C:\Program Files\mozilla.org\Mozilla\defaults\pref\all.js by appending the following line at the end: pref("general.config.filename", "mozilla.cfg"); Note: Newer versions of Mozilla or Firefox store the all.js file in greprefs rather than defaults\pref The moz-byteshift.pl script allows to encode...: moz-byteshift.pl -s 13 <mozilla.cfg.txt >mozilla.cfg ... and to decode mozilla.cfg files: moz-byteshift.pl -s -13 <mozilla.cfg >mozilla.cfg.txt Example of an unencoded file: mozilla...
..., the encoding as such does not provide any real security. Instead make sure that file protections make this file unmodifiable by the unprivileged user. Moreover, some settings (such as mail & news configuration) unfortunately seem to be inaccessible to mozilla.cfg, which means that these cannot be locked. If you have trouble getting the moz-byteshift.pl script to work locally, there is also an online version available. Note: In recent versions of mozilla (tested on Windows and Linux, with 1.5, 1.6 and 1.7b), the mozilla.cfg file needs to be placed in mozilla's root directory, rather than default\pref where all.js resides. If you suspect syntax errors in your config file, you can display the exact error message by enclosing your code in a try-catch block: try { ... } catch(e) { displayError...
Style System Overview - Archive of obsolete content
d be on nsIStyleRuleProcessor). We optimize event state changes (:hover, :active, etc.) using nsIStyleRuleProcessor::HasStateDependentStyle, which is much more accurate. The CSSRuleProcessor implementation does a slightly modified form of selector matching to implement it (includes matching on the middle of selectors to catch p:hover a). Style attribute changes We handle style attribute ("inline style") changes in a different way from other changes to style rules. As for other style changes, we have to "walk" the rule tree and clear all the style data coming from the old inline style nsIStyleRule, since there could be an !important rule that overrides it, which would allow dynamic changes to put the style attribute in multiple places in the rule tree. However, we maintain a hashtable ju...
... nsCSSFrameConstructor::AttributeChanged only re-resolves style on the subtree of the element, just like other attribute changes. ...
Menu - Archive of obsolete content
Archive › Mozilla › Jetpack › UI › Menu
Jetpack's menu API allows features to access and modify the browser's built-in menus. Features can also create new menus and attach them almost anywhere, chrome or content, as popup menus or context menus. Two namespaces are associated with this API: jetpack.menu, which provides access to the browser's menus, and jetpack.Menu, the constructor for making new menus. ...
...ll. label string The label of the menuitem. menu jetpack.Menu If defined, the menuitem expands into a submenu. mnemonic string A character that is used as the item's shortcut key while the menu is open. It should be one of the characters that appears in the item's label. On some platforms this character is underlined in the label. type string Currently only "separator" is supported. If this property is undefined, the item is a normal menuitem. Note that when type == "separator", any other properties (such as label) may be specified. Fancy separators may behave differently on different platforms, however. xulId string The ID of the menuitem's backing X...
jspage - Archive of obsolete content
urn this;},getStyles:function(){var a={};Array.flatten(arguments).each(function(b){a[b]=this.getStyle(b);},this);return a;}});Element.Styles=new Hash({left:"@px",top:"@px",bottom:"@px",right:"@px",width:"@px",height:"@px",maxWidth:"@px",maxHeight:"@px",minWidth:"@px",minHeight:"@px",backgroundColor:"rgb(@, @, @)",backgroundPosition:"@px @px",color:"rgb(@, @, @)",fontSize:"@px",letterSpacing:"@px",lineHeight:"@px",clip:"rect(@px @px @px @px)",margin:"@px @px @px @px",padding:"@px @px @px @px",border:"@px @ rgb(@, @, @) @px @ rgb(@, @, @) @px @ rgb(@, @, @)",borderWidth:"@px @px @px @px",borderStyle:"@ @ @ @",borderColor:"rgb(@, @, @) rgb(@, @, @) rgb(@, @, @) rgb(@, @, @)",zIndex:"@",zoom:"@",fontWeight:"@",textIndent:"@px",opacity:"@"}); Element.ShortStyles={margin:{},padding:{},border:{},bord...
...of a=="string"){var b=a.split(":"); a=Fx.Transitions;a=a[b[0]]||a[b[0].capitalize()];if(b[1]){a=a["ease"+b[1].capitalize()+(b[2]?b[2].capitalize():"")];}}return a;}});Fx.Transition=function(b,a){a=$splat(a); return $extend(b,{easeIn:function(c){return b(c,a);},easeOut:function(c){return 1-b(1-c,a);},easeInOut:function(c){return(c<=0.5)?b(2*c,a)/2:(2-b(2*(1-c),a))/2; }});};Fx.Transitions=new Hash({linear:$arguments(0)});Fx.Transitions.extend=function(a){for(var b in a){Fx.Transitions[b]=new Fx.Transition(a[b]);}};Fx.Transitions.extend({Pow:function(b,a){return Math.pow(b,a[0]||6); },Expo:function(a){return Math.pow(2,8*(a-1));},Circ:function(a){return 1-Math.sin(Math.acos(a));},Sine:function(a){return 1-Math.sin((1-a)*Math.PI/2); },Back:function(b,a){a=a[0]||1.618;return Math.pow(b,2)*((a+1)*b-...
Mozilla Application Framework - Archive of obsolete content
comprehensive, cross-platform UI toolkit with an easy-to-learn XML language for defining UI structure, a schema for localization, and support for both native and cross-platform (using CSS) look and feel to make writing UIs quick and painless. Gecko A performant web content rendering/editing engine with world-leading support for standards that you can drop into your application with a single line of XUL. Necko A wicked-fast, extensible networking library with built-in support for many common protocols and a well-defined plug-in interface for custom protocol handling so you can add the protocols you need. XPCOM A simple, cross-platform component model with multiple language bindings and IDL descriptions so you can plug your custom functionality into the framework and connect it w...
...n is running. XULMaker A GUI builder currently under development that lets you drag-and-drop widgets onto a grid to build your user interface. Bugzilla The Mozilla bug tracking webtool to help you track progress in fixing bugs and implementing features that affect your applications. 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. Tinderbox Our 24/7 build and test webtool that constantly builds, tests, and reports on the Mozilla application suite on multiple platforms so you can see the state of the application at...
Bundles - Archive of obsolete content
The bundle can hold additional resources currently limited to: Application INI settings Application icon Script for the application chrome, not the web content Installing a bundle When Prism opens a webapp bundle it will unpack it into the WebApps/{webapp-id} folder. This folder is located in the Application Data folder of the user's home directory on Windows, in the ~/.webapps directory on Linux and under ~/Library on OS X. Since this folder maybe be located in a directory that requires elevated privileges, the web application should not write data to it. ...
...on Windows, in the ~/.webapps directory on Linux and under ~/Library on OS X. Since this folder maybe be located in a directory that requires elevated privileges, the web application should not write data to it. The application profile directory can be used instead for this purpose. Note: The webapp must have an ID in order to be installed. When Prism is launched with a "-webapp [bundle]" command line, the bundle must first be unpacked before the web application is launched. This can slow the overall launch time and the unpacking is redundant if the bundle has been launched previously. This is why the preferred method of launching is to use the "-webapp [webapp-id]" command line, which looks for the previously installed (unpacked) web application in the Prism WebApps/{webapp-id} folder. The we...
Priority Content - Archive of obsolete content
Code Migrators: Joel Stanley I added the related links from the original article. However, the link about SignTool seems to be broken. ...
...They are dependant on some style instructions that can only be placed in the header of the page. ...
Using cross commit - Archive of obsolete content
Commit message" when doing so tools/cross-commit --moz18 --branch MOZILLA_1_8_0_BRANCH -m "Fix some sort of security bug" layout/base/nsCaret.h Notes Note that you MUST use a -m option with a CVS checkin message. Otherwise cross-commit will end up waiting forever for you to type a CVS checkin message in an editor that it never shows you! (Although it works without specifying -m on the command line if you are using X-enabled emacs on Linux.) Also note that if you don't specify any branches to commit on, cross-commit will commit to the trunk and the MOZILLA_1_8_BRANCH by default. Details cross-commit accepts the following options: all CVS options (those to the left of the specific CVS command) and CVS commit options (those to the right of a commit command), although the -r and -f CVS o...
...pts the following options: all CVS options (those to the left of the specific CVS command) and CVS commit options (those to the right of a commit command), although the -r and -f CVS options need to be specified as --cvs-r and --cvs-f to avoid conflict with the similarly named (but different in meaning) CVS commit options. You can list the files/directories you want it to commit on the command line or leave them out and let it recursively troll the current directory. --verbose=[0|1] makes the script output more text as it runs. This defaults to 1. --trunk makes cross-commit land the patch on HEAD in addition to any other branches specified. This is equivalent to --branch HEAD. --moz18 makes cross-commit land the patch on MOZILLA_1_8_BRANCH in addition to any other branches specified. Thi...
Elements - Archive of obsolete content
hed to an element by using style sheets or by scripting. (See bug 83830 for <table> specifics). ...
...ft" - the handler will match if the shift key is pressed, whether or not the control key is pressed. This will match shift-x or control-shift-x, but no other combinations. keycode - The keycode attribute imposes a filter on key handlers. Its value is a key identifier for a specific keycode, e.g., vk_enter. [Editor's Note: A forthcoming DOM events specification will presumably outline the list of valid keycode strings.] If this attribute is present, then its value must match the keyCode field of the DOM key event object in order for the handler to fire. charcode - The charcode attribute imposes a filter on key handlers. Its value is a single character, e.g., "z". If this attribute is present, then its value must match the charCode field of the DOM key event object in order ...
XML in Mozilla - Archive of obsolete content
g this extensible mechanism. There is also a proprietary API from scripts to the XPointer processor. There is a testcase for XPointers that you can also study. Lastly, there is a pref you might want to try (especially useful with FIXptr) that will select the link target when you traverse it. There is no UI for setting this pref yet, so you will need to manually edit the preferences file. Add this line: pref("layout.selectanchor", true); DOM Load and Save Methods document.load() is a part of an old version of the W3C DOM Level 3 Load & Save module. Mozilla currently implements only the load() method and the document.async property. Outside Supported XML W3C Recommendations Specification or Technology Documentation Mozilla Project XSLT W3C Recomm...
...nting this as an extension), validating parser (bug 196355) and XML Schemas. To fully implement XLink, we need something called a link manager. See some initial design documents. Testing and QA We have a lot of testcases linked to from the browser standards compliance QA page. Most of the core XML test documents on the mercurial repository are located in content/xml/tests. We also have a couple online: the books demo and the IRS table of contents demo. Both of them demonstrate XML, Associating stylesheets with XML, displaying XML with CSS, Namespaces in XML, XHTML, simple XLinks, and manipulation of XML with scripts via DOM. There is an XML component in Bugzilla. We also have the "xhtml" keyword for XHTML bugs (these tend to be scattered across components). How can I help? If you can code, loo...
Building accessible custom components in XUL - Archive of obsolete content
. <code> grid.spreadsheet { border: thin solid; -moz-user-focus: normal; } </code> In HTML documents, Firefox draws a focus rectangle around the currently focused element. In XUL, we will need to handle this ourselves, again with CSS rules. You might initially think of using the CSS border property, but that will add width and height to the focused cell. A better approach is to use the CSS outline property, which does maintains the element's dimensions. (Technically, it draws the border inside the element instead of outside.) <code> grid.spreadsheet description:focus, grid.spreadsheet label:focus { outline: 1px dotted black; outline-offset: -2px; } </code> However, neither of those are our biggest problem. We want this collection of XUL elements to act like a single control, a spreadsh...
...<code> <window id="accjax" title="AccJax Spreadsheet" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" xmlns:x2="http://www.w3.org/TR/xhtml2" xmlns:wairole="http://www.w3.org/2005/01/wai-rdf/GUIRoleTaxonomy#" xmlns:waistat...
Deprecated and defunct markup - Archive of obsolete content
--Neil 03 March 2011 <sidebarheader> Not true, still in use --Neil 03 March 2011 <slider> (clickable tray in <scro...
...or the ancestor <treechildren> element --Neil 03 March 2011 <treecaption> (old/experimental and unsupported XUL tags) <treecolgroup> (former name for <treecols> <treecolpicker> (internal use only; part of XBL for <tree>) <treefoot> (old/experimental and unsupported XUL tags) <treeindentation> (old/experimental and unsupported XUL tags) Was a part of the old <tree> that predated <outliner> that was not converted to <listbox>--Neil 03 March 2011 <treeicon> (old/experimental and unsupported XUL tags) <treerows> (internal use only; part of XBL for <tree>) Attributes @debug="true" provided struts and springs around boxes to facilitate identification of flex issues but does not seem to work now You need a special DEBUG_LAYOUT build --Neil 03 March 2011 References XUL...
Introduction to XUL - Archive of obsolete content
ractical reasons, the locale-specific attributes of a UI description would be most happily developed (and possibly distributed) in separate files, where localization can be performed by altering only a subset of the UI description devoted expressly to localization issues. That is, a separate file of localized strings. Internationalization is discussed more completely in the XUL Coding Style Guidelines document. In brief, Mozilla has settled on XML entities as the mechanism. Entities are a feature of the language and therefore outside the scope of this paper. A XUL file can be made localizeable very easily by substituting entities for any content which may change as the locale changes. The localized text must be defined in a separate DTD or DTD fragment. The whole system is then configured wit...
... change as the locale changes. The localized text must be defined in a separate DTD or DTD fragment. The whole system is then configured with different locale-specific DTDs, and the correct DTD will be chosen for a given XML file at runtime, depending on the current locale settings. Mozilla will make that decision automatically if the localized XML file specifies its DTD using a chrome URL, as outlined in XUL Localizability Issues. Original Document Information Author(s): danm@netscape.com Last Updated Date: January 31, 2005 Copyright Information: Copyright (C) danm@netscape.com ...
Adding Labels and Images - Archive of obsolete content
way to include text in a window is to use the label element. It should be used when you want to place a descriptive label beside a control, such as a button. An example is shown below: Example 1 : Source View <label value="This is some text"/> The value attribute can be used to specify the text that you wish to have displayed. The text will not wrap, so the text will all be displayed on a single line. This syntax is the most common of labels. If the text needs to wrap, you can place the text content inside opening and closing tags as in the following example: Example 2 : <label>This is some longer text that will wrap onto several lines.</label> As with HTML, line breaks and extra whitespace are collapsed into a single space. Later, we'll find out how to constrain the width of elements so tha...
...tton" label="Open"/> In the example above, clicking the label will cause the button to be focused. Description Element For descriptive text not associated with any particular control, you can use the description tag. This element is useful for informative text at the top of a dialog or a group of controls for example. As with the label element, you can either use the value attribute for a single line of text or place text or XHTML content inside opening and closing description tags for longer blocks of text. It is more common to use the attribute syntax for labels, and the text content syntax for descriptions. Example 4 : Source View <description> This longer section of text is displayed. </description> You can set the text via script using the textContent property, as in the following exa...
Anonymous Content - Archive of obsolete content
clare anonymous content that will be added to the scroll bar. All of the elements inside the content tag will be added inside the element that the binding is bound to. Presumably this binding would be bound to a scroll bar, although it doesn't have to be. Any element that has its CSS -moz-binding property set to the URI of the binding will use it. The result of using the above binding is that the line of XUL below will be expanded as follows, assuming that the scrollbar is bound to the XBL above: <scrollbar/> expands to: <scrollbar> <xul:scrollbarbutton type="decrement"/> <xul:slider flex="1"> <xul:thumb/> </xul:slider> <xul:scrollbarbutton type="increment"/> </scrollbar> The elements within the content tag are added to the scroll bar anonymously. Although anonymous conten...
...e In some cases, you may wish to only include specific types of content and not others. Or, you may wish to place different types of content in different places. The includes attribute can be used to allow only certain elements to appear in the content. Its value should be set to a single tag name, or to a list of tags separated by vertical bars (the | symbol). <children includes="button"/> This line will add all buttons that are children of the bound element in place of the children tag. Other elements will not match this tag. You can place multiple children elements in a binding to place different types of content in different places. If an element in the XUL does not match any of the children elements, that element (and any others that don't match) will be used instead of the bound content...
Document Object Model - Archive of obsolete content
r context, the window is the global object, and the same is also true for XUL. Naturally, this global object will be different for each window. Each frame will also have a separate window object. The window is often referred to using the window property, although this is optional. Sometimes, this is done just to clarify the scope of the method you are referring to. For example, the following two lines which open a new window are functionally equivalent: window.open("test.xul","_new"); open("test.xul","_new"); When you declare a function or a variable at the top level of a script, that is outside another function, you are actually declaring a property of the global object. In XUL, each function you declare will be set as a property of the window object. For example, the following code will ...
...rectly inside of it. However, for various reasons, including better performance, you should always put scripts in separate files, except for short fragments which can be put directly in the event handler. function doFind(){ var meter = document.getElementById('progmeter'); meter.hidden = false; } This function first gets a reference to the progress meter using its id, progmeter. The second line of the function body changes the hidden state so that the element is visible again. Finally, let's have an alert box pop up that displays what will be searched for. Of course, we wouldn't want this in the final version but we'll add it to reassure us that something would happen. function doFind(){ var meter=document.getElementById('progmeter'); meter.hidden = false; var searchtext=documen...
Element Positioning - Archive of obsolete content
flexible but will never grow to be larger than 10 ems. You will often want to use ems when specifying sizes with text in them. This unit is useful for textboxes so that the font can change and the textboxes would always be a suitable size, even if the font is very large. Example 6 The description element is constrained to have a maximum width of 50 pixels. The text inside will wrap to the next line, after fifty pixels. Our find files dialog Let's add some of these styles to the find files dialog. We'll make it so that the textbox will resize to fit the entire window. <textbox id="find-text" flex="1" style="min-width: 15em;"/> Here, the text input has been made flexible. This way, it will grow if the user changes the size of the dialog. This is useful if the user wants to enter a lo...
...oxes, it controls the position of the children horizontally. The possible values are similar to those for pack. start This aligns elements along the top edge for horizontal boxes and along the left edge for vertical boxes. center This centers the child elements in the box. end This aligns elements along the bottom edge for horizontal boxes and along the right edge for vertical boxes. baseline This aligns the elements so that the text lines up. This is only useful for horizontal boxes. stretch This value, the default, causes the elements to grow to fit the size of the box, much like a flexible element, but in the opposite direction. As with the pack attribute, the align attribute applies to the box containing the elements to be aligned, not to the elements themselves. For example...
Introduction - Archive of obsolete content
Language) which is a cross-platform language for describing applications' user interfaces. This tutorial will demonstrate creating a simple find file user interface, much like that provided by the Macintosh's Sherlock or the find file dialog in Windows. Note that only the user interface will be created, with only limited functionality. The actual finding of files will not be implemented. A blue line will appear to the left of a paragraph where the find file dialog is being modified. You can follow along by looking for these sections. What is XUL and why was it created? XUL (pronounced "zool" and rhyming with "cool") was created to make development of the Mozilla browser easier and faster. It is an XML language so all features available to XML are also available to XUL. Most applications n...
...application would be packaged into a single file and downloaded and installed by the user. Mozilla applications such as Firefox provide an extension manager which allows packages to be installed without having to write a lot of complex code. What do I need to know to use this tutorial? You should have an understanding of HTML and at least a basic understanding of XML and CSS. Here are some guidelines to keep in mind: XUL elements and attributes should all be entered in lowercase as XML is case-sensitive (unlike HTML). Attribute values in XUL must be placed inside quotes, even if they are numbers. XUL files are usually split into four files, one each for the layout and elements, for style declarations, for entity declarations (used for localization) and for scripts. In addition, you may ...
Localization - Archive of obsolete content
log, we will need a file called findfile.dtd. For non-installed chrome files, you can just put the DTD file in the same directory as the XUL file. Note: You should encode DTD files as UTF-8 for non-ASCII characters. That is, you should save them in UTF-8 format (without BOM). For more information, see Mozilla Language Packs. Once you have created a DTD file for your XUL, you will need to add a line to the XUL file which indicates that you want to use the DTD file. Otherwise, errors will occur as it won't be able to find the entities. To do this, add a line of the following form somewhere near the top of the XUL file: <!DOCTYPE window SYSTEM "chrome://findfile/locale/findfile.dtd"> This line specifies that the URL indicated is to be used as a DTD for the file. In this case, we have declar...
...he DTD file. Otherwise, errors will occur as it won't be able to find the entities. To do this, add a line of the following form somewhere near the top of the XUL file: <!DOCTYPE window SYSTEM "chrome://findfile/locale/findfile.dtd"> This line specifies that the URL indicated is to be used as a DTD for the file. In this case, we have declared that we want to use the findfile.dtd DTD file. This line is typically placed just before the window element. You also need to add the locale to the chrome.manifest file, for example: locale findfile en-US locale/ Declaring Entities The entities are declared using a simple syntax as shown below: <!ENTITY findLabel "Find"> This example creates an entity with the name findLabel and the value "Find". This means that wherever the text "&findLabel;" ...
Simple Menu Bars - Archive of obsolete content
xt to appear on the menu, such as File or Edit. disabled This boolean attribute determines whether the menu is disabled. Although you can, there's rarely a need to disable an entire menu. This attribute can be set to either true or false. Of course, the latter is the default. accesskey This is the key that the user can press to activate the menu item. This letter is typically shown underlined on the menu title. Mozilla will look at the label attribute and add an underline character to the character specified here. For that reason, you should specify a character that exists in the text (although the key will still work if it doesn't). The menu element is normally placed on a menubar, although it does not have to be. However, it will be given a different look. The image here shows ...
... id The unique identifier of the menu item. label The text to appear on the menu item, such as Open or Save. disabled This boolean attribute determines whether the menu item is disabled. This attribute can be set to either true or false where the latter is the default. accesskey This is the key that the user can press to activate the menu item. This letter is typically shown underlined on the menu title. Mozilla will look at the label attribute and add an underline character to the character specified here. For that reason, you should specify a character that exists in the text. acceltext This specifies the shortcut key text to appear next to the menu command text. It does not associate a key action with the menuitem however. We'll look at how to do this later. menusepa...
The Box Model - Archive of obsolete content
inside of a box will orient themselves horizontally or vertically. By combining a series of boxes, spacers and elements with flex and pack attributes, you can control the layout of a window. Although a box is the fundamental part of XUL element layout, it follows a few very simple rules. A box can lay out its children in one of two orientations, either horizontally or vertically. A horizontal box lines up its elements horizontally and a vertical box orients its elements vertically. You can think of a box as one row or one column from an HTML table. Various attributes placed on the child elements in addition to some CSS style properties control the exact position and size of the children. Box elements The basic syntax of a box is as follows: <hbox> <!-- horizontal elements --> </hbox> <vbox>...
.... Added elements will be placed underneath each other in a column. There is also a generic box element which defaults to horizontal orientation, meaning that it is equivalent to the hbox. However, you can use the orient attribute to control the orientation of the box. You can set this attribute to the value horizontal to create a horizontal box and vertical to create a vertical box. Thus, the two lines below are equivalent: <vbox></vbox> <box orient="vertical"></box> The following example shows how to place three buttons vertically. Example 1 : Source View <vbox> <button id="yes" label="Yes"/> <button id="no" label="No"/> <button id="maybe" label="Maybe"/> </vbox> The three buttons here are oriented vertically as was indicated by the box. To change the buttons so that they are ori...
Tree Box Objects - Archive of obsolete content
set to the value of the textbox. You might notice that the tree box object can be retrieved in the same way as other box objects using the boxObject (FIXME: dealLink)property, however we need to call QueryInterface() to cast the box object to the more specific tree box object. The functions of the more general box object are also available to trees. Additional scroll methods include the scrollByLines(), scrollByPages() and ensureRowIsVisible() functions. The scrollByLines() scrolls up or down by a certain number of rows. Use a positive number to go down and a negative number to go up. The scrollByPages() function scrolls by a number of pages and is called automatically when the user presses the page up or page down keys while the tree is focused. A page is equal to the number of visible row...
...ow the mouse is over, since we call it with the event coordinates of a mousemove event. If the coordinate is not over a row, the row value will be set to -1. The column is a column object in Mozilla 1.8 and later. In earlier versions, columns are identified with a string, the id of the column. In later versions, a separate column object exists, which can be queried for column data. The following line is used so that the example above will work in all versions. if (column.value && typeof column.value != "string") { column.value = column.value.id; } If the column is a string, we are running on Mozilla 1.7 or earlier, but for later versions we get the column id from the column object. If you are writing code for multiple versions, you should check for this as above. The last argument to ge...
Tree View Details - Archive of obsolete content
. The view will need to return 0 for the outermost rows and higher values for inner rows. The tree will use this information to determine the hierarchical structure of the rows. In addition to the getLevel method, there is a hasNextSibling function which, given a row, should return true if there is another row afterwards at the same level. This function is used, specifically, to draw the nesting lines along the side of the tree. The getParentIndex method is expected to return the parent row of a given row, that is, the row before it with a lower nesting value. All of these methods must be implemented by the view for children to be handled properly. Containers There are also three functions, isContainer, isContainerEmpty and isContainerOpen that are used to handle a parent item in the tree.
...ow and the second to open a row. Let's examine each block of code, but let's look at the second block for opening a row first. item[2] = true; var label = this.visibleData[idx][0]; var toinsert = this.childData[label]; for (var i = 0; i < toinsert.length; i++) { this.visibleData.splice(idx + i + 1, 0, [toinsert[i], false]); } this.treeBox.rowCountChanged(idx + 1, toinsert.length); The first line makes the row open in the array so that we will know the next time the toggleOpenState function is called that the row will need to be closed instead. Next, we look up the data in the childData map for the row. The result is that 'toinsert' will be set to one of the child arrays, for example ["Silver", "Gold", "Lead"] if the Solids row is the one being opened. Next, we use the array's splice func...
Updating Commands - Archive of obsolete content
You will need to use these extra steps when invoking commands implemented by a controller. ...
...command as an argument and executes that command. This function could then be reused for all commands. In fact, this is common enough that Mozilla includes a library which does just that. If you include the script 'chrome://global/content/globalOverlay.js' in a XUL file, you can call the goDoCommand method which executes the command passed as the argument. The code for this function is only a few lines long so you could include it directly in your code if for some reason you didn't want to include the library. <script src="chrome://global/content/globalOverlay.js"/> <command id="cmd_paste" oncommand="goDoCommand('cmd_paste');"/> <button label="Paste" command="cmd_paste"/> The example above will implement a Paste button. It is attached to the command which will invoke the command on the neces...
XUL Questions and Answers - Archive of obsolete content
ponents.interfaces.mozIJSSubScriptLoader); objScriptLoader.loadSubScript(strURL); See http://www.xulplanet.com/references/...iptLoader.html for more information. Too specific questions or unclear answers How do I remove the file location header included in the default printing setting? See http://www.xulplanet.com/references/...ef_iframe.html, the first user note at the bottom. ...
... outside the browser? This problem can be solved by capturing the focus events and giving the focus to another xul element or capturing and canceling the keypress events. How to display addressbook RDF and MenuList on the same list? Mailing lists are children of directories. As such, you cannot use a template to display them in the same list. The best you can do is a cascading menu along the lines of the move/copy menus, but then of course you lose the ability to easily select from the list. Instead of <menulist id="abPopup"> <menupopup id="abPopup-menupopup" ref="moz-abdirectory://" datasources="rdf:addressdirectory" sortActive="true" sortDirection="ascending" sortResource="http://home.netscape.com/NC-rdf#DirTreeNameSort"> <template> <rule nc:IsWriteable...
XUL element attributes - Archive of obsolete content
. center Extra space is split equally along each side of the child elements, resulting in the children being placed in the center of the box. end Child elements are placed on the right or bottom edge of the box. If the box is larger than the total size of the children, the extra space is placed on the left or top side. baseline This value applies to horizontally oriented boxes only. It causes the child elements to be aligned so that their text labels are lined up. stretch This is the default value. The child elements are stretched to fit the size of the box. For a horizontal box, the children are stretched to be the height of the box. For a vertical box, the children are stre...
...ary key for sorted content. statustext Type: string Used to set the text that appears on the status bar when the user moves the mouse over the element. Mozilla doesn't adjust the status bar automatically however. This attribute serves only as a place to keep the text. In Firefox, this text is automatically placed in the statusbar for menuitems on the menu bar. style Type: CSS inline style CSS style rules to be applied to the element. Syntax is as in the HTML style attribute. It is preferred to put style rules in style sheets. template Type: id For template generated elements, this attribute may optionally be placed on the root node (the element with the datasources attribute) to refer to a template that exists elsewhere in the XUL code. This template attribute shou...
Accessibility/XUL Accessibility Reference - Archive of obsolete content
Element Enabled Usage Comments description <description value="<!-- Text -->" /> <description><!--Label Text--></description> Use for non-label text. ...
...ol/> </listcols> <listhead> <listheader label="Name" /> <listheader label="Sex" /> <listheader label="Color" /> </listhead> <listitem> <label value="<!--Pearl-->" /> <label value="<!--Female-->" /> <label value="<!--Gray-->" /> </listitem> </listbox> I don't seem to be able to find a straightforward way to read the header labels in JAWS. ...
wizardpage - Archive of obsolete content
lement. If this is left out, no text appears. For an editable menuitem element the value of this attribute is copied to the menulist.value property upon user selection of the menuitem. next Type: id Set to the pageid of the next wizardpage after this one. When set, the page with this pageID is displayed when the Next button is pressed. This can be used to create wizards that do not have a linear sequence. If one of the pages has a next attribute, all of the pages should have one, except that last page. pageid Type: id This attribute should be set to a string that identifies the page's identifer in the wizard. This is used with the next attribute. The wizard always starts with the wizardpage that appears first in the wizard child list. Properties next Type: string wiza...
...age's identifer in the wizard. This is used with the next attribute. The wizard always starts with the wizardpage that appears first in the wizard child list. Properties next Type: string wizardpage id Set to the pageid of the next page after this one. When set, the page with this pageID is displayed when the Next button is pressed. This can be used to create wizards that do not have a linear sequence. If one of the pages has a next attribute, all of the pages should have one, except that last page. pageid Type: string wizardpage id This attribute should be set to a string that identifies the page's identifer in the wizard. This is used with the next attribute. The wizard always starts with the wizardpage that appears first in the wizard child list. Inherite...
Getting started with XULRunner - Archive of obsolete content
simply do %ProgramFiles%\xulrunner.exe application.ini or on 64 bit systems %ProgramFiles(x86)%\xulrunner.exe application.ini Note: you can also install your application when you're finished debugging it. See XUL Application Packaging for details. Mac On the Mac, before you can run a XULRunner application with everything intact, you must install it using the --install-app xulrunner commandline flag. Installing the application creates an OS X application bundle: /Library/Frameworks/XUL.framework/xulrunner-bin --install-app /<path>/<to>/myapp.zip Once installed, you can run the application: /Library/Frameworks/XUL.framework/xulrunner-bin "/Applications/Finkle/TestApp.app/Contents/Resources/application.ini" You may run it without installing (but with the menu bar and dock icon mis...
...tu, you can run the application from a terminal. First change into the \myapp folder, then start the application by: xulrunner application.ini You should now see a window that looks something like this. This particular screenshot is from Ubuntu 10. Alternative: Run XUL apps with Firefox With Firefox 3 and later, you can tell the Firefox executable to run a XUL application from the command line. The XUL application will run instead of the Firefox browser that normally starts. This is similar to starting a XUL app using XULRunner. See Using Firefox to run XULRunner applications. This does not work if Firefox itself was installed as a XUL app - you need to use the installed XULRunner directly. Further Reading: There are many things you can do with XULRunner (who would have thought that?
XULRunner Hall of Fame - Archive of obsolete content
Runner application. Surebo Browselorer A new, simple yet highly functional and customizable web browser, based on XULRunner 22. Websecurify Web Application Security Testing Environment. Source Yoono Desktop Win/Mac application to get all your friend updates, update your status and share stuff easily across Facebook, MySpace, Twitter, and more - all at once! Simplify your online social life. Zotero Reference manager with Firefox, Chrome, and Safari integration. Both Firefox extension and XULRunner-based standalone application available. Source Applications based on XULRunner 1.9 or earlier Buzzbird XUL-based desktop twitter client. GitHub BlueGriffon The next-generation Web Editor based on the rendering engine of Firefox. Build instructions ...
...tegrated point-of-sales software-hardware solution with customized XUL Application as the device front-end. English site. Inactive projects These projects appear to be less actively developed, with no updates since 2010. They are all based on XULRunner 1.8 or earlier. Abstract An accounting package with breakthrough level of automation. Latest Release: 0.0.2 November 2010 - Source Clines A clone of Color Lines (game). Latest Release: 1.2 November 2008 - Source CocoaPSYC.app A PSYC IM/Chat client for Mac OS X (Also available as a Firefox extension). Latest Release 0.5 Febuary 2010 - Source DAIM (fr) / DAIM (English) superb tool for image analysis build on top of a professional imagelib. Echofon for Windows A Twitter client. eMusic Remote The eM...
Mozprocess - Archive of obsolete content
otherwise), along with any child processes, on Windows, OS X, and Linux. Mozprocess utilizes and extends subprocess.Popen to these ends. API mozprocess.processhandler:ProcessHandler is the central exposed API for mozprocess. ProcessHandler utilizes a contained subclass of subprocess.Popen, Process, which does the brunt of the process management. ...
...TODO Document improvements over subprocess.Popen.kill ...
Mozilla release FAQ - Archive of obsolete content
contributed to this FAQ. General Questions about the Mozilla Project What is Mozilla? Mozilla is a project to continue Netscape Communicator as an open project. The project is maintained by employees of Netscape (now a division of AOL), Red Hat, some other companies, as well as contributors from the community. On what is Mozilla based? The Mozilla project started near the end of life of the 4.x line of Netscape Communicator. Originally, the plan was just to re-stabilize the code and release 5.0, but it was decided within the community that the more ambitious changes that were planned for later integration were close to being ready. The old layout engine, networking engine, and several of the older modules were gutted, and much later, the sources reached the point where Netscape was comfortab...
...e/stdlib.h:196: previous declaration of `seed48' See section 3.7 Nothing looks much like an error, except something returned error status Your compiler has a switch (probably) that prints everything it's doing (i.e. programs spawned), which might help you find out what arguments it's passing to ld, or whatever, and thus perhaps enlighten you as to the problem. On gcc, try gcc -v (rest of command line). How long will Mozilla take to build? A long time, but this will depend quite a bit on your system. RAM will probably be the bottleneck in most cases, at least until you are well over 128M RAM. Here are a few representative systems (please send your specs in to me) Removed because the tree has changed enough that we'll probably need new times for all the builds. Please send stats to me in the fo...
2006-11-24 - Archive of obsolete content
ating all of his code to compile with vc8 and is having some problems. He is receiving the following error: Error: uncaught exception: [Exception... "Component returned failure code: 0x80570016 (NS_ERROR_XPC_GS_RETURNED_FAILURE) [nsIJSCID.getService]" nsresult: "0x80570016 (NS_ERROR_XPC_GS_RETURNED_FAILURE)" location: "JS frame :: chrome://modzilla/content/js/pkg_zillacom.js :: <TOP_LEVEL> :: line 1202" data: no] He is running XulRunner v1.8.0.4. Luke wants to know if compiling XulRunner with a static CRT is better or worse than compiling with the MSCVR80.DLL dependency. firefox 1.5 build on Windows with GTK2 November 23rd: Vin is trying to build Firefox 1.5.0.3 on Windows XP. The build is working properly with the default toolkit, but when he tries to add ac_add_options --enable-...
... Meetings There were no meetings this week. Summarized By: Vanessa Miranda & Mohammad Tirtashi ...
NPAPI plugin developer guide - Archive of obsolete content
te Attributes Using the embed Element for Plug-in Display Using Custom embed Attributes Plug-in References Plug-in Development Overview Writing Plug-ins Registering Plug-ins MS Windows Unix Mac OS X Drawing a Plug-in Instance Handling Memory Sending and Receiving Streams Working with URLs Getting Version and UI Information Displaying Messages on the Status Line Making Plug-ins Scriptable Building Plug-ins Building, Platforms, and Compilers Building Carbonized Plug-ins for Mac OS X Type Libraries Installing Plug-ins Native Installers XPI Plug-ins Installations Plug-in Installation and the Windows Registry Initialization and Destruction Initialization Instance Creation Instance Destruction Shutdown Initialize an...
...to the Stream Deleting the Stream Example of Sending a Stream URLs Getting URLs Getting the URL and Displaying the Page Posting URLs Posting Data to an HTTP Server Uploading Files to an FTP Server Sending Mail Memory Allocating and freeing memory Mac OS Flushing memory (Mac OS only) Version, UI, and Status Information Displaying a Status Line Message Getting Agent Information Getting the Current Version Finding Out if a Feature Exists Reloading a Plug-in ...
NPN_PostURL - Archive of obsolete content
data to post can be contained either in a local temporary file or a new memory buffer. To post to a temporary file, set the flag file to true, the buffer buf to the path name string for a file, and len to the length of the path string. The file-type URL prefix "file://" is optional. MS Windows and OS X If a file is posted with any protocol other than FTP, the file must be text with Unix-style line breaks ('\n' separators only). To post data from a memory buffer, set the flag file to false, the buffer buf to the data to post, and len to the length of buffer. Possible URL types include HTTP (similar to an HTML form submission), mail (sending mail), news (posting a news article), and FTP (upload a file). Plug-ins can use this function to post form data to CGI scripts using HTTP or upload ...
..., the buffer buf to the data to post, and len to the length of buffer. Possible URL types include HTTP (similar to an HTML form submission), mail (sending mail), news (posting a news article), and FTP (upload a file). Plug-ins can use this function to post form data to CGI scripts using HTTP or upload files to a remote server using FTP. You cannot use NPN_PostURL to specify headers (even a blank line) in a memory buffer. To do this, use NPN_PostURLNotify. For protocols in which the headers must be distinguished from the body, such as HTTP, the buffer or file should contain the headers, followed by a blank line, then the body. If no custom headers are required, simply add a blank line ('\n') to the beginning of the file or buffer. NPN_PostURL is typically asynchronous: it returns immediately a...
NPN_Status - Archive of obsolete content
<< Gecko Plugin API Reference << Browser Side Plug-in API Summary Lets a plug-in display a message on the browser's status line. Syntax #include <npapi.h> void NPN_Status(NPP instance, const char* message); Parameters The function has the following parameters: instance Pointer to the current plug-in instance. message Pointer the buffer that contains the status message string to display. Description You can use this function to make your plug-in display status information in the browser window, in the same place the browser does. ...
...tatus message string to display. Description You can use this function to make your plug-in display status information in the browser window, in the same place the browser does. If your plug-in has a button or other object that acts as a link when clicked, you can call NPN_Status() to display a description or URL when the user moves the cursor over it. The browser always displays the last status line message it receives, regardless of the message source. Your message is always displayed, but you have no control over how long it stays in the status line before another message replaces it. See also NPN_UserAgent() NPP ...
Create Your Own Firefox Background Theme - Archive of obsolete content
k best; highly detailed images will compete with the browser UI. Firefox may reveal more of the lower portion of the image if another toolbar or other UI element is added to the top of the window. The upper right-hand side of the image should have the most important information--as a user increases the width of the browser window, the browser reveals more of the left-hand side of the image. Online Image Editor Resources Pixlr -- Pixlr offers professional and easy-to-use tools for creating and editing images within a browser. Photoshop -- Tweak, rotate and touch up photos with Photoshop(R) Express, a free online photo editor. Creating a Theme Footer Image In older versions of Firefox, or newer versions with certain add-ons installed, the footer image is displayed as the background of...
...-- you're ready to preview your theme! Simply mouse over the image above the Submit Theme button, and see how it looks instantly. Submit your theme -- if everything looks right, click the Submit Theme button, and you're done! You can see all the themes you've authored on your profile page. Tip: to ensure that your theme is approved for the gallery, be sure it complies with the content guidelines and terms of service! Submit Your Theme Now More Tutorials Mozilla Themes Focal Point on Sizing - A tutorial on theming with a focus on sizing, by VanillaOrchids. ...
Updating an extension to support multiple Mozilla applications - Archive of obsolete content
pdate the chrome manifest Remember way back in the first article in this series when we created our chrome manifest, which we haven't touched since? It's time to touch it. As you may (or may not) recall, that file tells the application what XUL code your extension's interface needs to overlay onto. For Firefox, we overlaid onto browser.xul, which describes a Firefox browser window. ...
...rlay onto. For Firefox, we overlaid onto browser.xul, which describes a Firefox browser window. We need to add lines to the manifest for Thunderbird and Sunbird, like this: # Thunderbird overlay chrome://messenger/content/messenger.xul chrome://stockwatcher2/content/stockwatcher2.xul # Sunbird overlay chrome://calendar/content/calendar.xul chrome://stockwatcher2/content/stockwatcher2.xul These lines cause the main Thunderbird message list window and the main window in Sunbird to be the target of the overlays we apply in the stockwatcher2.xul file. With these simple tweaks, this extension will work in all three of these applications, and works exactly the same way in them all. ...
Using IO Timeout And Interrupt On NT - Archive of obsolete content
This technical memo is a cautionary note on using NetScape Portable Runtime's (NSPR) IO timeout and interrupt on Windows NT 3.51 and 4.0. Due to a limitation of the present implementation of NSPR IO on NT, programs must follow the following guideline: If a thread calls an NSPR IO function on a file descriptor and the IO function fails with <tt>PR_IO_TIMEOUT_ERROR</tt> or <tt>PR_PENDING_INTERRUPT_ERROR</tt>, the file descriptor must be closed before the thread exits. In this memo we explain the problem this guideline is trying to work around and discuss its limitations. NSPR IO on NT The IO model of NSPR 2.0 is synchronous and blocking. A thread calling an IO function is blocked until the IO operation finishes, either due to a successful IO completion or an error. If the IO operation...
... not acceptable. A possible solution is to add a <tt>PR_DisableInterrupt()</tt> function to turn off interrupts when accessing such file descriptors. A related known bug is that timeout and interrupt don't work for <tt>PR_Connect()</tt> on NT. This bug is due to a different limitation in our NT implementation. Conclusions As long as we need to support NT 3.51, we need to program under the guideline that after an IO timeout or interrupt error, the thread must make sure the file descriptor is closed before it exits. Programs should also take care in sharing file descriptors and using IO timeout or interrupt on files that need to stay open throughout the process. When we stop supporting NT 3.51, we can look into using NT 4's <tt>CancelIo()</tt> function to cancel outstanding overlapped IO requ...
Using SSH to connect to CVS - Archive of obsolete content
ommands do the same thing. First ssh-agent is called and its output is evaluated in the current environment. This sets environment variables that let cvs know how to find and use the agent. Your private key is then added to ssh-agent using ssh-add at which point you will be prompted for the key's passphrase. Since it's important that you kill the agent when you're finished with it, the last three lines start a child environment that, when exited, will result in the agent's process being killed. The environment you will actually use to build is the child environment. There are a few things to note about the commands for the MS-DOS Command Prompt. First of all they will only work in versions of Windows based on NT (NT/2000/XP). If you're building on Win9x/WinME you'll need to find an alternativ...
...There are a few things to note about the commands for the MS-DOS Command Prompt. First of all they will only work in versions of Windows based on NT (NT/2000/XP). If you're building on Win9x/WinME you'll need to find an alternative solution. If you're typing the commands directly (as opposed to storing them in a batch file that you call), you'll need to replace the occurances of "%%" in the first line with "%". Finally, note that ssh-add needs the environment variable HOME to be set with the cygwin path to your cygwin home directory. MozillaBuild If you're using MozillaBuild, ssh-agent should be started when you run the start-msvc???.bat file. You should be prompted to enter your passphrase. MozillaBuild 1.2 contains a bug that will stop ssh-agent from automatically starting with MSYS. To f...
Summary of Changes - Archive of obsolete content
This section outlines all of the element and practice updates described in this article. For a complete discussion of these items, see the sections in which they are described. ...
...ent and practice updates described in this article. For a complete discussion of these items, see the sections in which they are described. ...
-moz-border-bottom-colors - Archive of obsolete content
s a list of colors for the bottom border. /* Single <color> value */ -moz-border-bottom-colors: #f0f0f0; /* Multiple <color> values */ -moz-border-bottom-colors: #f0f0f0 #a0a0a0 #505050 #000000; /* Global values */ -moz-border-bottom-colors: inherit; -moz-border-bottom-colors: initial; -moz-border-bottom-colors: unset; When an element has a border that is larger than a single CSS pixel, each line of pixels uses the next color specified in this property, from the outside in. This eliminates the need for nested boxes. If the border is wider than the number of specified colors, the remaining part of the border is the innermost color specified. Initial valuenoneApplies toall elementsInheritednoComputed valueas specifiedAnimation typediscrete It does not apply if border-style is dashed or...
... of specified colors, the remaining part of the border is the innermost color specified. Initial valuenoneApplies toall elementsInheritednoComputed valueas specifiedAnimation typediscrete It does not apply if border-style is dashed or dotted. to tables with border-collapse: collapse. Syntax Values Accepts a white-space separated list of color values. <color> Specifies the color of a line of pixels of the bottom border. transparent is valid. See <color> values for possible units. none Default, no colors are drawn or border-color is used, if specified. Formal syntax <color>+ | nonewhere <color> = <rgb()> | <rgba()> | <hsl()> | <hsla()> | <hex-color> | <named-color> | currentcolor | <deprecated-system-color>where <rgb()> = rgb( <percentage>{3} [ / <alpha-value> ]? ) | rgb( <num...
-moz-border-left-colors - Archive of obsolete content
property sets a list of colors for the left border. /* Single <color> value */ -moz-border-left-colors: #f0f0f0; /* Multiple <color> values */ -moz-border-left-colors: #f0f0f0 #a0a0a0 #505050 #000000; /* Global values */ -moz-border-left-colors: inherit; -moz-border-left-colors: initial; -moz-border-left-colors: unset; When an element has a border that is larger than a single CSS pixel, each line of pixels uses the next color specified in this property, from the outside in. This eliminates the need for nested boxes. If the border is wider than the number of specified colors, the remaining part of the border is the innermost color specified. Initial valuenoneApplies toall elementsInheritednoComputed valueas specifiedAnimation typediscrete It does not apply if border-style is dashed or...
... of specified colors, the remaining part of the border is the innermost color specified. Initial valuenoneApplies toall elementsInheritednoComputed valueas specifiedAnimation typediscrete It does not apply if border-style is dashed or dotted. to tables with border-collapse: collapse. Syntax Values Accepts a white-space separated list of color values. <color> Specifies the color of a line of pixels of the left border. transparent is valid. See <color> values for possible units. none Default, no colors are drawn or border-color is used, if specified. Formal syntax <color>+ | nonewhere <color> = <rgb()> | <rgba()> | <hsl()> | <hsla()> | <hex-color> | <named-color> | currentcolor | <deprecated-system-color>where <rgb()> = rgb( <percentage>{3} [ / <alpha-value> ]? ) | rgb( <numbe...
-moz-border-right-colors - Archive of obsolete content
ty sets a list of colors for the right border. /* Single <color> value */ -moz-border-right-colors: #f0f0f0; /* Multiple <color> values */ -moz-border-right-colors: #f0f0f0 #a0a0a0 #505050 #000000; /* Global values */ -moz-border-right-colors: inherit; -moz-border-right-colors: initial; -moz-border-right-colors: unset; When an element has a border that is larger than a single CSS pixel, each line of pixels uses the next color specified in this property, from the outside in. This eliminates the need for nested boxes. If the border is wider than the number of specified colors, the remaining part of the border is the innermost color specified. Initial valuenoneApplies toall elementsInheritednoComputed valueas specifiedAnimation typediscrete It does not apply if border-style is dashed or...
... of specified colors, the remaining part of the border is the innermost color specified. Initial valuenoneApplies toall elementsInheritednoComputed valueas specifiedAnimation typediscrete It does not apply if border-style is dashed or dotted. to tables with border-collapse: collapse. Syntax Values Accepts a white-space separated list of color values. <color> Specifies the color of a line of pixels of the right border. transparent is valid. See <color> values for possible units. none Default, no colors are drawn or border-color is used, if specified. Formal syntax <color>+ | nonewhere <color> = <rgb()> | <rgba()> | <hsl()> | <hsla()> | <hex-color> | <named-color> | currentcolor | <deprecated-system-color>where <rgb()> = rgb( <percentage>{3} [ / <alpha-value> ]? ) | rgb( <numb...
-moz-border-top-colors - Archive of obsolete content
s CSS property sets a list of colors for the top border. /* Single <color> value */ -moz-border-top-colors: #f0f0f0; /* Multiple <color> values */ -moz-border-top-colors: #f0f0f0 #a0a0a0 #505050 #000000; /* Global values */ -moz-border-top-colors: inherit; -moz-border-top-colors: initial; -moz-border-top-colors: unset; When an element has a border that is larger than a single CSS pixel, each line of pixels uses the next color specified in this property, from the outside in. This eliminates the need for nested boxes. If the border is wider than the number of specified colors, the remaining part of the border is the innermost color specified. Initial valuenoneApplies toall elementsInheritednoComputed valueas specifiedAnimation typediscrete It does not apply if border-style is dashed or...
... of specified colors, the remaining part of the border is the innermost color specified. Initial valuenoneApplies toall elementsInheritednoComputed valueas specifiedAnimation typediscrete It does not apply if border-style is dashed or dotted. to tables with border-collapse: collapse. Syntax Values Accepts a white-space separated list of color values. <color> Specifies the color of a line of pixels of the top border. transparent is valid. See <color> values for possible units. none Default, no colors are drawn or border-color is used, if specified. Formal syntax <color>+ | nonewhere <color> = <rgb()> | <rgba()> | <hsl()> | <hsla()> | <hex-color> | <named-color> | currentcolor | <deprecated-system-color>where <rgb()> = rgb( <percentage>{3} [ / <alpha-value> ]? ) | rgb( <number...
-ms-hyphenate-limit-zone - Archive of obsolete content
Negative values are not allowed. ...
... Negative values are not allowed. <length> A floating-point number, followed by a relative units designator, that indicates the width of the hyphenation zone. ...
-ms-wrap-through - Archive of obsolete content
The -ms-wrap-through CSS property is a Microsoft extension that specifies how content should wrap around an exclusion element. Initial valuewrapApplies toblock-level elementsInheritednoComputed valueas specifiedAnimation typediscrete Syntax Values wrap The exclusion element inherits its parent node's wrapping context. Its descendant inline content wraps around exclusions defined outside the element. none The exclusion element does not inherit its parent node's wrapping context. Its descendants are only subject to exclusion shapes defined inside the element. Formal syntax wrap | none Specifications Not part of any specification. Remarks You can use the -ms-wrap-through property to control the effect of exclusions; for instance, to cause one content block to w...
...wrap | none Specifications Not part of any specification. Remarks You can use the -ms-wrap-through property to control the effect of exclusions; for instance, to cause one content block to wrap around an exclusion element and another to intersect the same exclusion element. The wrapping context of a box is a collection of exclusion areas contributed by its associated exclusion boxes. The inline flow content of a box is placed in the area that corresponds to the subtraction of its wrapping context from its own content area. For more information about exclusion elements' impact on content flow, see the Terminology section of the CSS Exclusions Module Level 1 specification. ...
::-ms-check - Archive of obsolete content
er-bottom-color border-bottom-left-radius border-bottom-right-radius border-bottom-style border-bottom-width border-left-color border-left-style border-left-width border-right-color border-right-style border-right-width border-top-color border-top-left-radius border-top-right-radius border-top-style border-top-width box-shadow box-sizing color cursor display (values block, inline-block, none) @font-face font-size font-style font-weight height margin-bottom margin-left margin-right margin-top opacity outline-color outline-style outline-width padding-bottom padding-left padding-right padding-top transform transform-origin visibility width Syntax ::-ms-check Example HTML <form> <label for="redButton">Red</label> <input type="radio" id="redButt...
...*/ color: red; /* This will make the circle red when the button is checked. */ } input[type=checkbox]::-ms-check { border-color: green; /* This will make the box green when the button is checked. ...
display-outside - Archive of obsolete content
The display-outside CSS property specifies the outer display type of the box generated by an element, dictating how the element participates in its parent formatting context. ...
...container; /* Global values */ display-outside: inherit; display-outside: initial; display-outside: unset; Value not found in DB! Syntax One of the keyword values listed below. Values block-level The element generates a block-level box, and participates in a block formatting context. Other formatting contexts, such as flex formatting contexts, may also work with block-level elements. inline-level The element generates an inline-level box, and participates in an inline formatting context. run-in The element generates a run-in box. Run-in elements act like inlines or blocks, depending on the surrounding elements. contents The element lays out its contents using flex layout. none The element generates no boxes, and does not participate in any formatting context. table-row-group...
Introduction - Archive of obsolete content
var element2 = <foo> <bar/> </foo>; Additionally, you can specify all of the normal attributes on elements that you would normally include in an XML document. ...
...lightly different XML document: <foo bar="2">"hi"</foo>. Note, however, that XML elements can only have text as their value. What really happens with the {} notation is that the variables' toString method is called, and the returned value is placed in the element. For instance var a = {foo: 1}; var b = <bar>{a}</bar>; actually produces a document that reads <bar>[object Object]</bar>. Use of inline functions in content Although the brackets are restricted to single statements for evaluation, one might provide an anonymous function to perform some extra processing inline: var a = 'foo'; var b = <bar>{function () {var c = a.toUpperCase(); var d = 5 * 5; return c + d;}()}</bar>; where the above produces: <bar>FOO25</bar>. See E4X for templating for more discussion on this usage. Serializing O...
LiveConnect - Archive of obsolete content
1.9.2 of the platform (see bug 442399), its former API has been restored (see also the specification and this thread) (building on NPAPI?), and as of Java 6 update 12, extensions as well as applets can make use of this restored API. The reimplementation also restores the ability to use try-catch exceptions within JavaScript, and is free of the increasing number of other bugs introduced by the decline of the original LiveConnect (e.g., java.lang.String and arrays not working properly). LiveConnect use by applets is enabled via the use of the "MAYSCRIPT" attribute in applet tags on an HTML page, following which the applet may refer to classes in the netscape.javascript package to access Javascript objects, and scripts may directly call applet methods (using the syntax document.applets.name.met...
... ...
MSX Emulator (jsMSX) - Archive of obsolete content
.0 will release an optimized javascript engine for MSX 1.0. Version 2.0, 3.0 and 4.0 will be compatible with MSX 2.0, 2.0+ and TurboR respectively. ...
... 1.0. Version 2.0, 3.0 and 4.0 will be compatible with MSX 2.0, 2.0+ and TurboR respectively. An uncompress JavaScript function able to read zip and lhz file streams is also necessary to load compressed rom files. ...
XForms Label Element - Archive of obsolete content
Introduction Specifies the label (short description) for the XForms control (see the spec). Every form control other than the output and choices elements must contain a label element. It is valid for a form control to have an empty label element. The label text can be specified in instance data, in a remote document, or as inline text. If more than one source of label text is specified for this element, the order of precedence is: single node binding attributes, linking attributes, inline text. UI behavior accesskey support - if the accesskey attribute is specified on labeled XForms controls or on the label element itself then the label text for the control will contain an indicator as to what the access key is in a standard way. Usually by underlining the accesskey character in the lab...
...ntrol. Single-Node Binding Linking src - URL of a document whose contents will be retrieved by the label element and used to provide label text for the containing form control. Type restrictions The label element can be bound to any simple content. Representations The XForms label element is represented by the text retrieved from instance data, a document or the label element's own inline content. ...
XUL Parser in Python - Archive of obsolete content
rticular widgets, at which elements had which attributes, etc. The script writes out all the attributes and none of the values, but the parser itself is seeing the elements, their attributes, and the values of those attributes, and you just have to ask for them if you want them. For example, you could easily adapt this to: return the id values of all the elements take elements on the command line and only spell them out build new chrome subdirectories (i.e. new "packages") on the fly using search and replace. As I adapt the script in these ways and try to further generalize the actual code as I get time, I will make it available here. In the explanation section below, I try to say a little something about how this script works. It's really just a wrapper around Python's xmllib XML Pars...
...xpfe' >>> res = myXP.parseXUL(CHROME_DIR, 'window', 'id') Where something like the above would write out all the XUL window ids in the build. Something like that, anyway. Results The results from the script are written to a file called res.html. This is another hard-coded thing I have to open up. If you want to test this script you should change the filename "res.html" specified in the fourth line and compare different results files. Note also that I wrote the build number into the header myself, and haven't figured out yet how to get that written automatically. I guess you could get a modify date from the files as you open them. How the script works As I said before, there isn't too much to explain in this script, particularly if you have used Python's xmllib parser before. At the middl...
Archive of obsolete content
Element Events Archived event pages Firefox Developer Tools These are articles related to the Firefox Developer Tools, which are no longer current. Gecko Compatibility Handbook ** Notes ** - The Solution Quick Reference needs more attention. - I'm also looking for a way to organize all that information. - Some inline examples were removed because of technical limitations. They are actually replaced by ''-(EXAMPLE REMOVED)-'' The goal of this handbook is to help you update websites to work with standards-based browsers and properly detect Gecko. Getting the page URL in NPAPI plugin Sometimes, you want to restrict an NPAPI plugin to be loadable onl...
...lly from: http://ejohn.org/blog/hacking-digg-w...ug-and-jquery/ Using IO Timeout And Interrupt On NT This technical memo is a cautionary note on using NetScape Portable Runtime's (NSPR) IO timeout and interrupt on Windows NT 3.51 and 4.0. 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. Web Standards The Web Standards Project Windows Media in Netscape ...
Examples - Game development
alba Retro (Doom-style) first person shooter. Gorescript Another retro style first person shooter. The Wizard A turn-based, dungeon puzzle game. Hextris Tetris-like hexagonal puzzle game. 2048 A sliding number tiles puzzle game. BananaBread A multiplayer, 3D first-person shooter game developed using Emscripten, WebGL, and WebRTC. Monster Madness A WebGL and asm.js-based multiplayer online shooter, developed by Nom Nom Games and Trendy entertainment. Auralux WebGL and asm.js-based strategy game: capture all the suns to win! BrowserQuest A MMORPG created by the Little Workshop and Mozilla. Shoot The Rocks A canvas 2D single-player shooter in the style of Atari's classic Asteroids arcade game from 1979. Star Citadel A new take on Star Castle, Cinematronics' classic 1980 arcad...
...ORPG created by the Little Workshop and Mozilla. Shoot The Rocks A canvas 2D single-player shooter in the style of Atari's classic Asteroids arcade game from 1979. Star Citadel A new take on Star Castle, Cinematronics' classic 1980 arcade game, built with canvas 2D. Classic Platformer Canvas 2D game based on `Visual-ts game engine` - physics based on Matter.js Commercial games Oort Online A MMO exploration, building, and battle game (currently in development.) A Wizard's Lizard Top down Zelda-esque exploration/RPG. QbQbQb A sci-fi themed arcade puzzle game. Bullet Force 3D multiplayer first-person shooter. Elliot Quest 8-bit graphic retro adventure game. RPG MO Isometric MMORPG with similarities to RuneScape Classic and Ultima. Katan.io HTML5 and canvas implem...
GLSL Shaders - Game development
There are two types of shaders: Vertex Shaders and Fragment (Pixel) Shaders. Vertex Shaders transform shape positions into 3D drawing coordinates. Fragment Shaders compute the renderings of a shape's colors and other attributes. GLSL is not as intuitive as JavaScript. GLSL is strongly typed and there is a lot of math involving vectors and matrices. It can get very complicated -- very quickly. In this article we will make a simple code example that renders a cube. ...
...EE.MeshBasicMaterial({color: 0x0095DD}); Then, create the shaderMaterial: var shaderMaterial = new THREE.ShaderMaterial( { vertexShader: document.getElementById( 'vertexShader' ).textContent, fragmentShader: document.getElementById( 'fragmentShader' ).textContent }); This shader material takes the code from the scripts and applies it to the object the material is assigned to. Then, in the line that defines the cube we need to replace the basicMaterial: var cube = new THREE.Mesh(boxGeometry, basicMaterial); ...with the newly created shaderMaterial: var cube = new THREE.Mesh(boxGeometry, shaderMaterial); Three.js compiles and runs the shaders attached to the mesh to which this material is given. In our case the cube will have both vertex and texture shaders applied. That's it -- yo...
Collision detection - Game development
e staying where they are. We have to figure out a way to get rid of the ones we've already hit with the ball. We can do that by adding an extra parameter to indicate whether we want to paint each brick on the screen or not. In the part of the code where we initialize the bricks, let's add a status property to each brick object. ...
...s[c][r]; if(b.status == 1) { if(x > b.x && x < b.x+brickWidth && y > b.y && y < b.y+brickHeight) { dy = -dy; b.status = 0; } } } } } Activating our collision detection The last thing to do is to add a call to the collisionDetection() function to our main draw() function. Add the following line to the draw() function, just below the drawPaddle() call: collisionDetection(); Compare your code The collision detection of the ball is now checked on every frame, with every brick. Now we can destroy bricks! :- Exercise: change the color of the ball when it hits the brick. Next steps We are definitely getting there now; let's move on! In the eighth chapter we will be looking at how t...
Mouse controls - Game development
ompleting this lesson at Gamedev-Canvas-workshop/lesson9.html. The game itself is actually finished, so let's work on polishing it up. We have already added keyboard controls, but we could easily add mouse controls too. Listening for mouse movement Listening for mouse movement is even easier than listening for key presses: all we need is the listener for the mousemove event. ...
...d the following line in the same place as the other event listeners, just below the keyup event: document.addEventListener("mousemove", mouseMoveHandler, false); Anchoring the paddle movement to the mouse movement We can update the paddle position based on the pointer coordinates -- the following handler function will do exactly that. ...
Bounce off the walls - Game development
start implementing collision detection into the game -- first we'll look at the walls. Bouncing off the world boundaries The easiest way to get our ball bouncing off the walls is to tell the framework that we want to treat the boundaries of the <canvas> element as walls and not let the ball move past them. In Phaser this can be easily accomplished using the collideWorldsBound property. ...
...ls and not let the ball move past them. In Phaser this can be easily accomplished using the collideWorldsBound property. Add this line right after the existing game.physics.enable() method call: ball.body.collideWorldBounds = true; Now the ball will stop at the edge of the screen instead of disappearing, but it doesn't bounce. To make this occur we have to set its bounciness. Add the following line below the previous one: ball.body.bounce.set(1); Try reloading index.html again -- now you should see the ball bouncing off all the walls and moving inside the canvas area. Compare your code You can check the finished code for this lesson in the live demo below, and play with it to understand better how it works: Next steps This is starting to look more like a game now, but we can't cont...
Extra lives - Game development
ting ones in your code: var lives = 3; var livesText; var lifeLostText; These respectively will store the number of lives, the text label that displays the number of lives that remain, and a text label that will be shown on screen when the player loses one of their lives. Defining the new text labels Defining the texts look like something we already did in the score lesson. ...
...our game, let's first change the ball's function bound to the onOutOfBounds event. Instead of executing an anonymous function and showing the alert right away : ball.events.onOutOfBounds.add(function(){ alert('Game over!'); location.reload(); }, this); We will assign a new function called ballLeaveScreen; delete the 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 canvas. Add the ballLeaveScreen() function definition at the end of our code: function ballLeaveScreen() { lives--; if(lives) { livesText.setText('Lives: '+lives); lifeLostText.visible = true; ball.reset(game.world.width*0.5, game.world.
Move the ball - Game development
have our blue ball printed on screen, but it's doing nothing -- It would be cool to make it move somehow. This article covers how to do just that. Updating the ball's position on each frame Remember the update() function and its definition? The code inside it is executed on every frame, so it's a perfect place to put the code that will update the ball's position on screen. Add the following new lines of the code inside update(), as shown: function update() { ball.x += 1; ball.y += 1; } The code above adds 1 to the x and y properties representing the the ball coordinates on the canvas, on each frame. Reload index.html and you should see the ball rolling across the screen. Compare your code You can check the finished code for this lesson in the live demo below, and play with it to...
...he ball coordinates on the canvas, on each frame. Reload index.html and you should see the ball rolling across the screen. Compare your code You can check the finished code for this lesson in the live demo below, and play with it to understand better how it works: Next steps The next step is to add some basic collision detection, so our ball can bounce off the walls. This would take several lines of code -- a significantly more complex step than we have seen so far, especially if we want to add paddle and brick collisions too -- but fortunately Phaser allows us to do this much more easily than if we wanted to use pure JavaScript. In any case, before we do all that we will first introduce Phaser's physics engines, and do some setup work. << PreviousNext >> ...
Physics - Game development
th a fourth option, Box2D, being available as a commercial plugin. For simple games like ours, we can use the Arcade Physics engine. We don't need any heavy geometry calculations -- after all it's just a ball bouncing off walls and bricks. First, let's initialize the Arcade Physics engine in our game. Add the physics.startSystem() method at the beginning of the create function (make it the first line inside the function), as shown below: game.physics.startSystem(Phaser.Physics.ARCADE); Next, we need to enable our ball for the physics system -- Phaser object physics is not enabled by default. Add the following line at the bottom of the create() function: game.physics.enable(ball, Phaser.Physics.ARCADE); Next, if we want to move our ball on the screen, we can set velocity on its body. Add...
...ction), as shown below: game.physics.startSystem(Phaser.Physics.ARCADE); Next, we need to enable our ball for the physics system -- Phaser object physics is not enabled by default. Add the following line at the bottom of the create() function: game.physics.enable(ball, Phaser.Physics.ARCADE); Next, if we want to move our ball on the screen, we can set velocity on its body. Add the following line, again at the bottom of create(): ball.body.velocity.set(150, 150); Removing our previous update instructions Remember to remove our old method of adding values to x and y from the update() function: function update() { ball.x += 1; ball.y += 1; } we are now handling this properly, with a physics engine. Final code check The latest code should look like this: var ball; function...
Scaling - Game development
n the edges of the screen, but we can live with that. RESIZE -- creates the canvas with the same size as the available width and height, so you have to place the objects inside your game dynamically; this is more of an advanced mode. USER_SCALE -- allows you to have custom dynamic scaling, calculating the size, scale and ratio on your own; again, this is more of an advanced mode The other two lines of code in the preload() function are responsible for aligning the canvas element horizontally and vertically, so it is always centered on screen regardless of size. Adding a custom canvas background colour We can also add a custom background color to our canvas, so it won't stay black. The stage object has a backgroundColor property for this purpose, which we can set using CSS color definitio...
...unction are responsible for aligning the canvas element horizontally and vertically, so it is always centered on screen regardless of size. Adding a custom canvas background colour We can also add a custom background color to our canvas, so it won't stay black. The stage object has a backgroundColor property for this purpose, which we can set using CSS color definition syntax. Add the following line below the other three you added earlier: game.stage.backgroundColor = '#eee'; Compare your code You can check the finished code for this lesson in the live demo below, and play with it to understand better how it works: Next steps Now we've set up the scaling for our game, let's continue to the third lesson and work out how to load the assets and print them on screen. << PreviousNex...
The score - Game development
you can try to beat your own highscore, or your friend's. In this article we'll add a scoring system to our game. We will use a separate variable for storing the score and Phaser's text() method to print it out onto the screen. New variables Add two new variables right after the previously defined ones: // ... var scoreText; var score = 0; Adding score text to the game display Now add this line at the end of the create() function: scoreText = game.add.text(5, 5, 'Points: 0', { font: '18px Arial', fill: '#0095DD' }); The text() method can take four parameters: The x and y coordinates to draw the text at. The actual text that will be rendered. The font style to render the text with. The last parameter looks very similar to CSS styling. In our case the score text will be blue, si...
... render the text with. The last parameter looks very similar to CSS styling. In our case the score text will be blue, sized at 18 pixels, and use the Arial font. Updating the score when bricks are destroyed We will increase the number of points every time the ball hits a brick and update the scoreText to display the current score. This can be done using the setText() method -- add the two new lines seen below to the ballHitBrick() function: function ballHitBrick(ball, brick) { brick.kill(); score += 10; scoreText.setText('Points: '+score); } That's it for now -- reload your index.html and check that the score updates on every brick hit. Compare your code You can check the finished code for this lesson in the live demo below, and play with it to understand better how it wor...
Visual-js game engine - Game development
orks direct with project files , no need for build . Add->New game object (form dialog for define type of new game object ) Add->Quick code (make your work faster - add usually code blocks) Resources - explorer view for images and audios , you can drag or edit also need to execute node build_resources for creating resources object for engine. Inserting new code will be always at current line selected intro editor . Save on drop menu or better with ctrl+s before testing in browsers. Adding new script explanation : After adding new script and save script if you have extra changes , open starter/run.js and you will found line : SYS.SCRIPT.LOAD("scripts/new_script.js") ctrl+S Use from menu Run->Choose browser for testing . - important safari not working at the moment chrome ,...
... Tutorial - Pencil (Animation path) : How to use Pencil tool to create PATH object . Path object can be saved intro localhost , you can collect object and put it direct source code . File location : starter/templates/paths.js Templetes are made from visual-js core also . See source code : paths.js See the Pen Visual js - Pencil by VisualJS game engine (@zlatnaspirala) on CodePen. Online demo examples at : https://jsfiddle.net/user/zlatnaspirala/fiddles/ Demo slot mashine basic demo at : https://jsfiddle.net/zlatnaspirala/7d0d8v6d/ Help about new 2d part - implementation of matter.js based typescript . I make strong relation with webpack and project . build folder is full vendor nature. Html css and resources come from dependency logic taken from source. To make all de...
ATAG - MDN Web Docs Glossary: Definitions of Web-related terms
ATAG (Authoring Tool Accessibility Guidelines) is a W3C recommendation for building accessible-authoring tools that produce accessible contents. ...
... ATAG (Authoring Tool Accessibility Guidelines) is a W3C recommendation for building accessible-authoring tools that produce accessible contents. ...
Bézier curve - MDN Web Docs Glossary: Definitions of Web-related terms
ed [bezje]) is a mathematically described curve used in computer graphics and animation. In vector images, they are used to model smooth curves that can be scaled indefinitely. The curve is defined by a set of control points with a minimum of two. Web related graphics and animations use Cubic Beziers, which are curves with four control points P0, P1, P2, and P3. To draw the curve, two imaginary lines are drawn, one from P0 to P1 and the other from P1 to P2. The end points of the lines are then steadily moved to the next point. A third imaginary line is drawn with its starting point moving steadily on the first helper line and the end point on the second helper line. On this imaginary line a point is drawn from its starting point moving steadily to its end point. The curve this point describe...
...r line and the end point on the second helper line. On this imaginary line a point is drawn from its starting point moving steadily to its end point. The curve this point describes is the Bezier curve. ...
CRLF - MDN Web Docs Glossary: Definitions of Web-related terms
CR and LF are control characters or bytecode that can be used to mark a line break in a text file. CR = Carriage Return (\r, 0x0D in hexadecimal, 13 in decimal) -- moves the cursor to the beginning of the line without advancing to the next line. LF = Line Feed (\n, 0x0A in hexadecimal, 10 in decimal) -- moves the cursor down to the next line without returning to the beginning of the line. A CR immediately followed by a LF (CRLF, \r\n, or 0x0D0A) moves the cursor down to the next line and then to the beginning of the line. ...
...e cursor to the beginning of the line without advancing to the next line. LF = Line Feed (\n, 0x0A in hexadecimal, 10 in decimal) -- moves the cursor down to the next line without returning to the beginning of the line. A CR immediately followed by a LF (CRLF, \r\n, or 0x0D0A) moves the cursor down to the next line and then to the beginning of the line. ...
Call stack - MDN Web Docs Glossary: Definitions of Web-related terms
[1] Some codes here sayHi(); // [2] Some codes here } function sayHi() { return "Hi!"; } // Invoke the `greeting` function greeting(); // [3] Some codes here The code above would be executed like this: Ignore all functions, until it reaches the greeting() function invocation. Add the greeting() function to the call stack list. Call stack list: - greeting Execute all lines of code inside the greeting() function. Get to the sayHi() function invocation. Add the sayHi() function to the call stack list. Call stack list: - sayHi - greeting Execute all lines of code inside the sayHi() function, until reaches its end. Return execution to the line that invoked sayHi() and continue executing the rest of the greeting() function. Delete the sayHi() funct...
... Delete the greeting() function from the call stack list. Call stack list: EMPTY In summary, then, we start with an empty Call Stack. Whenever we invoke a function, it is automatically added to the Call Stack. ...
Control flow - MDN Web Docs Glossary: Definitions of Web-related terms
For example, imagine a script used to validate user data from a webpage form. The script submits validated data, but if the user, say, leaves a required field empty, the script prompts them to fill it in. ...
...conditionals, loops and functions. Parts of a script may also be set to execute when events occur. For example, the above excerpt might be inside a function that runs when the user clicks the Submit button for the form. The function could also include a loop, which iterates through all of the fields in the form, checking each one in turn. Looking back at the code in the if and else sections, the lines promptUser and submitForm could also be calls to other functions in the script. As you can see, control structures can dictate complex flows of processing even with only a few lines of code. Control flow means that when you read a script, you must not only read from start to finish but also look at program structure and how it affects order of execution. Learn more General knowledge Contro...
Semantics - MDN Web Docs Glossary: Definitions of Web-related terms
Would you need to look at the code to understand what the function did if it was called build('Peach'), or createLiWithContent('Peach')? Semantics in CSS In CSS, consider styling a list with li elements representing different types of fruits. ...
...ds a caption?; should it have a header and a footer in addition to the global site-wide header and footer?; etc. Semantic elements These are some of the roughly 100 semantic elements available: <article> <aside> <details> <figcaption> <figure> <footer> <header> <main> <mark> <nav> <section> <summary> <time> Learn more HTML element reference on MDN Using HTML sections and outlines on MDN The meaning of semantics in computer science on Wikipedia ...
MDN Web Docs Glossary: Definitions of Web-related terms
x Algorithm Alignment container Alignment subject Alpha (alpha channel) ALPN API Apple Safari Application Context Argument ARIA ARPA Arpanet Array ASCII Asynchronous ATAG Attribute B Bandwidth Base64 Baseline beacon Bezier curve BiDi BigInt Blink Block Block (CSS) Block (scripting) Block cipher mode of operation Boolean Boot2Gecko Bootstrap Bounding Box Breadcrumb Brotli Browser Browsing context buffer C Cache ...
...e collection Gecko General header GIF GIJ Git Global object Global scope Global variable Glyph Gonk Google Chrome GPL GPU Graceful degradation Grid Grid Areas Grid Axis Grid Cell Grid Column Grid container Grid Lines Grid Row Grid Tracks Guard Gutters Gzip compression H Hash Head High-level programming language HMAC Hoisting Host Hotlink Houdini HPKP HSTS HTML HTML5 HTTP HTTP header HTTP/2 HTTP/3 H...
Mobile accessibility - Learn web development
fferent options. Once you've selected the option you want, double-click to choose that option. For details on all the options available under the global and local context menus, see Use global and local context menus. Browsing web pages You can use the local context menu while in a web browser to find options to navigate web pages using just the headings, form controls, or links, or navigate line by line, etc. For example, with TalkBack turned on: Open your web browser. Activate the URL bar. Enter a web page that has a bunch of headings on it, such as the front page of bbc.co.uk. To enter the text of the URL: Select the URL bar by swiping left/right till you get to it, and then double-tapping. Hold your finger down on the virtual keyboard until you get the character you wan...
...n't break your UI. Keeping menus accessible Because the screen is so much narrower on mobile devices, it is very common to use media queries and other technologies to make the navigation menu shrink down to a tiny icon at the top of the display -- which can be pressed to reveal the menu only if it's needed -- when the site is viewed on mobile. This is commonly represented by a "three horizontal lines" icon, and the design pattern is consequently known as a "hamburger menu". When implementing such a menu, you need to make sure that the control to reveal it is accessible by appropriate control mechanisms (normally touch for mobile), as discussed in Control mechanisms above, and that the rest of the page is moved out of the way or hidden in some way while the menu is being accessed, to avoid c...
Accessible multimedia - Learn web development
Before moving onto creating our button functionality, let's remove the native controls so they don't get in the way of our custom controls. Add the...
... Before moving onto creating our button functionality, let's remove the native controls so they don't get in the way of our custom controls. Add the following, again at the...
Accessibility - Learn web development
o either work through at least the first two modules of the HTML, CSS, and JavaScript topics, or perhaps even better, work through the relevant parts of the accessibility module as you work through the related technology topics. Note: If you are working on a computer/tablet/other devices where you don't have the ability to create your own files, you can try out most of the code examples in an online coding program such as JSBin or Glitch. Guides What is accessibility? This article starts off the module with a good look at what accessibility is -- this includes what groups of people we need to consider and why, what tools different people use to interact with the web, and how we can make accessibility part of our web development workflow. HTML: A good basis for accessibility A great d...
...t by making sure the correct HTML elements are always used for the correct purpose . This article looks in detail at how HTML can be used to ensure maximum accessibility. CSS and JavaScript accessibility best practices CSS and JavaScript, when used properly, also have the potential to allow for accessible web experiences, but if misused they can significantly harm accessibility. This article outlines some CSS and JavaScript best practices that should be considered to ensure that even complex content is as accessible as possible. WAI-ARIA basics Following on from the previous article, sometimes making complex UI controls that involve unsemantic HTML and dynamic JavaScript-updated content can be difficult. WAI-ARIA is a technology that can help with such problems by adding in further semanti...
Cascade and inheritance - Learn web development
es you the weight of that particular selector, which can then be assessed against other potential matches. The amount of specificity a selector has is measured using four different values (or components), which can be thought of as thousands, hundreds, tens and ones -- four single digits in four columns: Thousands: Score one in this column if the declaration is inside a style attribute, aka inline styles. Such declarations don't have selectors, so their specificity is always simply 1000. Hundreds: Score one in this column for each ID selector contained inside the overall selector. Tens: Score one in this column for each class selector, attribute selector, or pseudo-class contained inside the overall selector. Ones: Score one in this column for each element selector or pseudo-element con...
...erstand why they have the specificity that we have given them. We've not covered selectors in detail yet, but you can find details of each selector on the MDN selectors reference. Selector Thousands Hundreds Tens Ones Total specificity h1 0 0 0 1 0001 h1 + p::first-letter 0 0 0 3 0003 li > a[href*="en-US"] > .inline-warning 0 0 2 2 0022 #identifier 0 1 0 0 0100 No selector, with a rule inside an element's style attribute 1 0 0 0 1000 Before we move on, let's look at an example in action. So what's going on here? First of all, we are only interested in the first seven rules of this example, and as you'll notice, we have included their s...
Debugging CSS - Learn web development
ides. Debugging problems in CSS DevTools can be a great help when solving CSS problems, so when you find yourself in a situation where CSS isn't behaving as you expect, how should you go about solving it? The following steps should help. Take a step back from the problem Any coding problem can be frustrating, especially CSS problems because you often don't get an error message to search for online to help with finding a solution. If you are becoming frustrated, take a step away from the issue for a while -- go for a walk, grab a drink, chat to a co-worker, or work on some other thing for a while. Sometimes the solution magically appears when you stop thinking about the problem, and even if not, working on it when feeling refreshed will be much easier. Do you have valid HTML and CSS? Brow...
... This will often mean taking the problematic code out of your layout to make a small example which only shows that code or feature. To create a reduced test case: If your markup is dynamically generated -- for example via a CMS -- make a static version of the output that shows the problem. A code sharing site like CodePen is useful for hosting reduced test cases, as then they are accessible online and you can easily share them with colleagues. You could start by doing View Source on the page and copying the HTML into CodePen, then grab any relevant CSS and JavaScript and include it too. After that, you can check whether the issue is still evident. If removing the JavaScript does not make the issue go away, don't include the JavaScript. If removing the JavaScript does make the issue go awa...
Images, media, and form elements - Learn web development
m elements, which I will not fully reproduce here. There are a few key basics worth highlighting in this section of the article. Many form controls are added to your page by way of the <input> element -- this defines simple form fields such as text inputs, through to more complex fields added in HTML5 such as color and date pickers. There are some additional elements, such as <textarea> for multiline text input, and also elements used to contain and label parts of forms such as <fieldset> and <legend>. HTML5 also contains attributes that enable web developers to indicate which fields are required, and even the type of content that needs to be entered. If the user enters something unexpected, or leaves a required field blank, the browser can show an error message. Different browsers are incon...
...ussed above into the following "form reset" to provide a consistent base to work from. This includes all the items mentioned in the last three sections: button, input, select, textarea { font-family: inherit; font-size: 100%; box-sizing: border-box; padding: 0; margin: 0; } textarea { overflow: auto; } Note: Normalizing stylesheets are used by many developers to create a set of baseline styles to use on all projects. Typically these do similar things to those described above, making sure that anything different across browsers is set to a consistent default before you do your own work on the CSS. They are not as important as they once were, as browsers are typically more consistent than in the past. However if you want to take a look at one example, check out Normalize.css, whic...
Sizing items in CSS - Learn web development
e and do not change its height and width, either using attributes on the <img> tag or CSS, it will be displayed using that intrinsic size. We have given the image in the example below a border so that you can see the extent of the file. An empty <div> however, has no size of its own. If you add a <div> to your HTML with no content, then give it a border as we did with the image, you will see a line on the page. This is the collapsed border on the element -- there is no content to hold it open. In our example below, that border stretches to the width of the container, because it is a block level element, a behavior that should be starting to become familiar to you. It has no height (or size in the block dimension) because there is no content. In the example above, try adding some text ins...
... top and bottom of the box are the same size as the margin on the left and right. You might expect for example the percentage top and bottom margins to be a percentage of the element's height, and the percentage left and right margins to be a percentage of the element's width. However, this is not the case! When you use margin and padding set in percentages, the value is calculated from the inline size -- therefore the width when working in a horizontal language. In our example, all of the margins and padding are 10% of the width. This means you can have equal-sized margins and padding all around the box. This is a fact worth remembering if you do use percentages in this way. min- and max- sizes In addition to giving things a fixed size, we can ask CSS to give an element a minimum or a m...
Beginner's guide to media queries - Learn web development
e screens of popular phones and tablets were published in order that designs could be created to neatly match those viewports. There are now far too many devices, with a huge variety of sizes, to make that feasible. This means that instead of targetting specific sizes for all designs, a better approach is to change the design at the size where the content starts to break in some way. Perhaps the line lengths become far too long, or a boxed out sidebar gets squashed and hard to read. That's the point at which you want to use a media query to change the design to a better one for the space you have available. This approach means that it doesn't matter what the exact dimensions are of the device being used, every range is catered for. The points at which a media query is introduced are known as ...
... we view the layout in Responsive Design Mode in DevTools we can see that it works pretty well as a straightforward mobile view of the site. Open step 1 in the browser, or view the source. If you want to follow on and implement this example as we go, make a local copy of step1.html on your computer. From this point, start to drag the Responsive Design Mode view wider until you can see that the line lengths are becoming quite long, and we have space for the navigation to display in a horizontal line. This is where we'll add our first media query. We'll use ems, as this will mean that if the user has increased their text size, the breakpoint will happen at a similar line-length but wider viewport, than someone with a smaller text size. Add the below code into the bottom of your step1.html CS...
Practical positioning examples - Learn web development
margin-top: 0; } Note: We are using descendant selectors with .info-box at the start of the chain throughout this example -- this is so that we can insert this feature into a page with other content already on it, without fear of interfering with the styles applied to other parts of the page. Next, we'll style the horizontal tabs -- the list items are all floated left to make them sit in a line together, their list-style-type is set to none to get rid of the bullets, and their width is set to 150px so they will comfortably fit across the info-box. The <a> elements are set to display inline-block so they will sit in a line but still be stylable, and they are styled appropriately for tab buttons, using a variety of other properties. Add the following CSS: .info-box li { float: left; ...
..., and their width is set to 150px so they will comfortably fit across the info-box. The <a> elements are set to display inline-block so they will sit in a line but still be stylable, and they are styled appropriately for tab buttons, using a variety of other properties. Add the following CSS: .info-box li { float: left; list-style-type: none; width: 150px; } .info-box li a { display: inline-block; text-decoration: none; width: 100%; line-height: 3; background-color: red; color: black; text-align: center; } Finally for this section we'll set some styles on the link states. First, we'll set the :focus and :hover states of the tabs to look different when they are focused/hovered, providing users with some visual feedback. Secondly, we'll set a rule that puts the same styli...
Supporting older browsers - Learn web development
then turned into a Grid Layout. Fallback Methods There are a number of layout methods which can be used in a similar way to this float example. You can choose the one that makes the most sense for the layout pattern you need to create. 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. display: inline-block This method can be used to create column layouts, if an item has display: inline-block set but then becomes a flex or grid item, the inline-block behaviour is ignored. display: table The method of creating CSS Tables described in the introduction to these lessons can be used as a fallback. Items that have CSS table layouts set on them will lose this behaviour if they become flex or grid ...
... included some additional useful links at the end of this lesson. However, unless you have a very high number of visitors in older IE versions, you may find it better to focus on creating a fallback that works for all non-supporting browsers. Testing older browsers With the majority of browsers supporting Flexbox and Grid, it can be reasonably hard to test older browsers. One way is to use an online testing tool such as Sauce Labs, as detailed in the Cross browser testing module. You can also download and install Virtual Machines, and run older versions of browsers in a contained environment on your own computer. Having access to older versions of Internet Explorer is particularly useful, and for that purpose, Microsoft has made a range of Virtual Machines available for free download. These...
How CSS works - Learn web development
n't yet support it. Similarly, if a browser encounters a selector that it doesn't understand, it will just ignore the whole rule and move on to the next one. In the example below I have used the British English spelling for color, which makes that property invalid as it is not recognised. So my paragraph has not been colored blue. All of the other CSS have been applied however; only the invalid line is ignored. <p> I want this text to be large, bold and blue.</p> p { font-weight: bold; colour: blue; /* incorrect spelling of the color property */ font-size: 200%; } This behavior is very useful. It means that you can use new CSS as an enhancement, knowing that no error will occur if it is not understood -- the browser will either get the new feature or not. Coupled with the way th...
...fer alternatives for browsers that don't support new CSS. This works particularly well when you want to use a value that is quite new and not supported everywhere. For example, some older browsers do not support calc() as a value. I might give a fallback width for a box in pixels, then go on to give a width with a calc() value of 100% - 50px. Old browsers will use the pixel version, ignoring the line about calc() as they don't understand it. New browsers will interpret the line using pixels, but then override it with the line using calc() as that line appears later in the cascade. .box { width: 500px; width: calc(100% - 50px); } We will look at many more ways to support varying browsers in later lessons. And finally You've nearly finished this module; we only have one more thing to do...
Use CSS to solve common problems - Learn web development
Learn › CSS › Howto
How to use background-clip to control how much of the box your background image covers. How to change the box model completely using box-sizing How to control backgrounds How to control borders How to style an HTML table How to add shadows to boxes Uncommon and advanced techniques CSS a...
... How to use background-clip to control how much of the box your background image covers. How to change the box model completely using box-sizing How to control backgrounds How to control borders How to style an HTML table How to add shadows to boxes Uncommon and advanced techniques CSS allows some advanced...
What do common web layouts contain? - Learn web development
change depending on the screen size) and sites whose layouts vary between pages. For now, it's best to keep your layout consistent throughout your site. Active learning There is no active learning available yet. Deeper dive Let's study some more concrete examples taken from well-known websites. One-column layout Invision application. A typical one-column layout providing all the information linearly on one page. Quite straightforward. Just remember, many people will still browse your site from desktops, so make your content usable/readable there as well. Two-column layout. Abduzeedo, a simple blog layout. Blogs usually have two columns, a fat one for the main content and a thin one for stuff on the side (like widgets, secondary navigation levels, and ads). In this...
...ee-column layout... ...but it's not. B1 and B2 float around the main content. Remember that word "float"--it will ring a bell when you start learning about CSS. Why would you think it's a three-column layout? Because the image on the top-right is L-shaped, because B1 looks like a column supporting the shifted main content, and because the "M" and "I" of the MICA logo create a vertical line of force. This is a good example of a classic layout supporting some design creativity. Simple layouts are easier to implement, but allow yourself room to express your creativity in this area. A much trickier layout The Opera de Paris. Basically a two-column layout, but you'll notice many tweaks here and there that visually break up the layout. Especially, the header overlaps the im...
How do you host your website on Google App Engine? - Learn web development
app.yaml file is a configuration file that tells App Engine how to map URLs to your static files. You don't need to edit it. Publishing your application Now that we've got our project made and sample app files collected together, let's publish our app. Open Google Cloud Shell. Drag and drop the sample-app folder into the left pane of the code editor. Run the following in the command line to select your project: gcloud config set project gaesamplesite Then run the following command to go to your app's directory: cd sample-app You are now ready to deploy your application, i.e. upload your app to App Engine: gcloud app deploy Enter a number to choose the region where you want your application located. Enter Y to confirm. Now navigate your browser to your-project-id.
...For example, for the project ID gaesamplesite, go to gaesamplesite.appspot.com. ...
What software do I need to build a website? - Learn web development
o view websites. As a result, you usually only need to acquire software for transferring files to your web server. Active Learning There is no active learning available yet. Dig deeper Creating and editing webpages To create and edit a website, you need a text editor. Text editors create and modify unformatted text files. Other formats, like RTF, let you to add formatting, like bold or underline. Those formats are not suitable for writing web pages. You should put some thought into which text editor you use, since you'll be working with it extensively while you're building the website. All desktop operating systems come with a basic text editor. These editors are all straightforward, but lack special features for webpage coding. If you want something a bit fancier, there are plenty of ...
...You can buy space on a server from various providers (see How much does it cost to do something on the web?). Once you settle on which provider to use, the provider will email you the access information, usually in the form of an SFTP URL, username, pa...
Example 2 - Learn web development
>Lemon</li> <li class="option">Banana</li> <li class="option">Strawberry</li> <li class="option">Apple</li> </ul> </div> <form> CSS Content .widget select, .no-widget .select { position : absolute; left : -5000em; height : 0; overflow : hidden; } /* --------------- */ /* Required Styles */ /* --------------- */ .select { position: relative; display : inline-block; } .select.active, .select:focus { box-shadow: 0 0 3px 1px #227755; outline: none; } .select .optList { position: absolute; top : 100%; left : 0; } .select .optList.hidden { max-height: 0; visibility: hidden; } /* ------------ */ /* Fancy Styles */ /* ------------ */ .select { font-size : 0.625em; /* 10px */ font-family : Verdana, Arial, sans-serif; -moz-b...
... /* 10px */ font-family : Verdana, Arial, sans-serif; -moz-box-sizing : border-box; box-sizing : border-box; padding : 0.1em 2.5em 0.2em 0.5em; /* 1px 25px 2px 5px */ width : 10em; /* 100px */ border : 0.2em solid #000; /* 2px */ border-radius : 0.4em; /* 4px */ box-shadow : 0 0.1em 0.2em rgba(0,0,0,.45); /* 0 1px 2px */ background : #F0F0F0; background : -webkit-linear-gradient(90deg, #E3E3E3, #fcfcfc 50%, #f0f0f0); background : linear-gradient(0deg, #E3E3E3, #fcfcfc 50%, #f0f0f0); } .select .value { display : inline-block; width : 100%; overflow : hidden; white-space : nowrap; text-overflow : ellipsis; vertical-align: top; } .select:after { content : "?"; position: absolute; z-index : 1; height : 100%; width : 2em; /* 20px...
Example 3 - Learn web development
emon</li> <li class="option">Banana</li> <li class="option">Strawberry</li> <li class="option">Apple</li> </ul> </div> </form> CSS Content .widget select, .no-widget .select { position : absolute; left : -5000em; height : 0; overflow : hidden; } /* --------------- */ /* Required Styles */ /* --------------- */ .select { position: relative; display : inline-block; } .select.active, .select:focus { box-shadow: 0 0 3px 1px #227755; outline: none; } .select .optList { position: absolute; top : 100%; left : 0; } .select .optList.hidden { max-height: 0; visibility: hidden; } /* ------------ */ /* Fancy Styles */ /* ------------ */ .select { font-size : 0.625em; /* 10px */ font-family : Verdana, Arial, sans-serif; -moz-b...
... /* 10px */ font-family : Verdana, Arial, sans-serif; -moz-box-sizing : border-box; box-sizing : border-box; padding : 0.1em 2.5em 0.2em 0.5em; /* 1px 25px 2px 5px */ width : 10em; /* 100px */ border : 0.2em solid #000; /* 2px */ border-radius : 0.4em; /* 4px */ box-shadow : 0 0.1em 0.2em rgba(0,0,0,.45); /* 0 1px 2px */ background : #F0F0F0; background : -webkit-linear-gradient(90deg, #E3E3E3, #fcfcfc 50%, #f0f0f0); background : linear-gradient(0deg, #E3E3E3, #fcfcfc 50%, #f0f0f0); } .select .value { display : inline-block; width : 100%; overflow : hidden; white-space : nowrap; text-overflow : ellipsis; vertical-align: top; } .select:after { content : "?"; position: absolute; z-index : 1; height : 100%; width : 2em; /* 20px...
Example 4 - Learn web development
emon</li> <li class="option">Banana</li> <li class="option">Strawberry</li> <li class="option">Apple</li> </ul> </div> </form> CSS Content .widget select, .no-widget .select { position : absolute; left : -5000em; height : 0; overflow : hidden; } /* --------------- */ /* Required Styles */ /* --------------- */ .select { position: relative; display : inline-block; } .select.active, .select:focus { box-shadow: 0 0 3px 1px #227755; outline: none; } .select .optList { position: absolute; top : 100%; left : 0; } .select .optList.hidden { max-height: 0; visibility: hidden; } /* ------------ */ /* Fancy Styles */ /* ------------ */ .select { font-size : 0.625em; /* 10px */ font-family : Verdana, Arial, sans-serif; -moz-b...
... /* 10px */ font-family : Verdana, Arial, sans-serif; -moz-box-sizing : border-box; box-sizing : border-box; padding : 0.1em 2.5em 0.2em 0.5em; /* 1px 25px 2px 5px */ width : 10em; /* 100px */ border : 0.2em solid #000; /* 2px */ border-radius : 0.4em; /* 4px */ box-shadow : 0 0.1em 0.2em rgba(0,0,0,.45); /* 0 1px 2px */ background : #F0F0F0; background : -webkit-linear-gradient(90deg, #E3E3E3, #fcfcfc 50%, #f0f0f0); background : linear-gradient(0deg, #E3E3E3, #fcfcfc 50%, #f0f0f0); } .select .value { display : inline-block; width : 100%; overflow : hidden; white-space : nowrap; text-overflow : ellipsis; vertical-align: top; } .select:after { content : "?"; position: absolute; z-index : 1; height : 100%; width : 2em; /* 20px...
Example 5 - Learn web development
ption">Banana</li> <li class="option" role="option">Strawberry</li> <li class="option" role="option">Apple</li> </ul> </div> </form> CSS Content .widget select, .no-widget .select { position : absolute; left : -5000em; height : 0; overflow : hidden; } /* --------------- */ /* Required Styles */ /* --------------- */ .select { position: relative; display : inline-block; } .select.active, .select:focus { box-shadow: 0 0 3px 1px #227755; outline: none; } .select .optList { position: absolute; top : 100%; left : 0; } .select .optList.hidden { max-height: 0; visibility: hidden; } /* ------------ */ /* Fancy Styles */ /* ------------ */ .select { font-size : 0.625em; /* 10px */ font-family : Verdana, Arial, sans-serif; -moz-b...
... /* 10px */ font-family : Verdana, Arial, sans-serif; -moz-box-sizing : border-box; box-sizing : border-box; padding : 0.1em 2.5em 0.2em 0.5em; /* 1px 25px 2px 5px */ width : 10em; /* 100px */ border : 0.2em solid #000; /* 2px */ border-radius : 0.4em; /* 4px */ box-shadow : 0 0.1em 0.2em rgba(0,0,0,.45); /* 0 1px 2px */ background : #F0F0F0; background : -webkit-linear-gradient(90deg, #E3E3E3, #fcfcfc 50%, #f0f0f0); background : linear-gradient(0deg, #E3E3E3, #fcfcfc 50%, #f0f0f0); } .select .value { display : inline-block; width : 100%; overflow : hidden; white-space : nowrap; text-overflow : ellipsis; vertical-align: top; } .select:after { content : "?"; position: absolute; z-index : 1; height : 100%; width : 2em; /* 20px...
Sending forms through JavaScript - Learn web development
ata data += 'content-disposition: form-data; ' // Define the name of the form data + 'name="' + file.dom.name + '"; ' // Provide the real name of the file + 'filename="' + file.dom.files[0].name + '"\r\n'; // And the MIME type of the file data += 'Content-Type: ' + file.dom.files[0].type + '\r\n'; // There's a blank line between the metadata and the data data += '\r\n'; // Append the binary data to our body's request data += file.binary + '\r\n'; } // Text data is simpler // Start a new part in our body's request data += "--" + boundary + "\r\n"; // Say it's form data, and name it data += 'content-disposition: form-data; name="' + text.name + '"\r\n'; // There's a ...
...Data sent and response loaded.' ); }...
Example - Learn web development
ton type="submit">Send your message</button> </div> </form> CSS Content form { /* Just to center the form on the page */ margin: 0 auto; width: 400px; /* To see the limits of the form */ padding: 1em; border: 1px solid #CCC; border-radius: 1em; } div + div { margin-top: 1em; } label { /* To make sure that all label have the same size and are properly align */ display: inline-block; width: 90px; text-align: right; } input, textarea { /* To make sure that all text field have the same font settings By default, textarea are set with a monospace font */ font: 1em sans-serif; /* To give the same size to all text field */ width: 300px; -moz-box-sizing: border-box; box-sizing: border-box; /* To harmonize the look & feel of text field border */...
...pace font */ font: 1em sans-serif; /* To give the same size to all text field */ width: 300px; -moz-box-sizing: border-box; box-sizing: border-box; /* To harmonize the look & feel of text field border */ border: 1px solid #999; } input:focus, textarea:focus { /* To give a little highligh on active elements */ border-color: #000; } textarea { /* To properly align multiline text field with their label */ vertical-align: top; /* To give enough room to type some text */ height: 5em; /* To allow users to resize any textarea vertically It works only on Chrome, Firefox and Safari */ resize: vertical; } .button { /* To position the buttons to the same position of the text fields */ padding-left: 90px; /* same size as the label elements */ } button {...
What will your website look like? - Learn web development
out? Do you like dogs, New York, or Pac-Man? What information are you presenting on the subject? Write a title and a few paragraphs and think of an image you'd like to show on your page. What does your website look like, in simple high-level terms? What's the background color? What kind of font is appropriate: formal, cartoony, bold and loud, subtle? Note: Complex projects need detailed guidelines that go into all the details of colors, fonts, spacing between items on a page, appropriate writing style, and so on. This is sometimes called a design guide, design system, or brand book, and you can see an example at the Firefox Photon Design System. Sketching out your design Next, grab pen and paper and sketch out roughly how you want your site to look. For your first simple webpage, there...
...Font To choose a font: Go to Google Fonts and scroll down the list until you find one you like. You can also use the controls on the right to further filter the results. Click the "plus" (Add to) icon next to the font you want. Click the "* Family Selected" button in the panel at the bottom of the page ("*" depends on how many fonts you selected). In the popup box, you can see and copy the lines of code Google gives you into your text editor to save for later. Previous Overview: Getting started with the web Next In this module Installing basic software What will your website look like? Dealing with files HTML basics CSS basics JavaScript basics Publishing your website How the web works ...
Add a hitmap on top of an image - Learn web development
xels. In case of overlap, source order carries the day. href The URL of the resource you're linking to. You may leave this attribute blank if you don't want the current area to link anywhere (say, if you're making a hollow circle.) alt A mandatory attribute, telling people where the link goes or what it does. alt text only displays when the image is unavailable. Please refer to our guidelines for writing accessible link text. You may write alt="" if the href attribute is blank and the entire image already has an alt attribute. <map name="example-map-1"> <area shape="circle" coords="200,250,25" href="page-2.html" alt="circle example" /> <area shape="rect" coords="10, 5, 20, 15" href="page-3.html" alt="rectangle example" /> </map> Step 3: Make sure it works for ev...
...e. ...
Tips for authoring fast-loading HTML pages - Learn web development
or mobile device visitors. It is just as important for broadband content and can lead to dramatic improvements even for your visitors with the fastest connections. Tips Reduce page weight Page weight is by far the most important factor in page-load performance. Reducing page weight through the elimination of unnecessary whitespace and comments, commonly known as minimization, and by moving inline script and CSS into external files, can improve download performance with minimal need for other changes in the page structure. Tools such as HTML Tidy can automatically strip leading whitespace and extra blank lines from valid HTML source. Other tools can "compress" JavaScript by reformatting the source or by obfuscating the source and replacing long identifiers with shorter versions. Minimize...
...om text compression in transit, thus providing an even quicker response to the user. Any dynamic features that require the page to complete loading before being used, should be initially disabled, and then only enabled after the page has loaded. This will cause the JavaScript to be loaded after the page contents, which will improve the overall appearance of the page load. Reduce the number of inline scripts Inline scripts can be expensive for page loading since the parser must assume that an inline script could modify the page structure while parsing is in progress. Reducing the use of inline scripts in general, and reducing the use of document.write() to output content in particular, can improve overall page loading. Use modern AJAX methods to manipulate page content for modern browsers, r...
Define terms with HTML - Learn web development
In this article, we'll cover how to properly mark up keywords when you're defining them. Prerequisites: You need to be familiar with how to create a basic HTML document. Objective: Learn how to introduce new keywords and how to build description lists. When you need a term defined, you probably go straight to a dictionary or glossary. Dictionaries and glossaries formally associate keywords with one or more descriptions, as in this case: Blue (Adjective) Of a color like the sky in a sunny day. The clear blue sky Of a subtle sadness, melancholy. ...
... uniformly. Just as with any new keyword, you should define your abbreviations the first time they occur. <p> <dfn><abbr>HTML</abbr> (hypertext markup language)</dfn> is a description language used to structure documents on the web. </p> The HTML spec does indeed set aside the title attribute for expanding the abbreviation. However, this is not an acceptable alternative for providing an inline expansion. The contents of title are completely hidden from your users, unless they're using a mouse and they happen to hover over the abbreviation. The spec duly acknowledges this as well. Improve accessibility <dfn> marks the keyword defined, and indicates that the current paragraph defines the keyword. In other words, there's an implicit relationship between the <dfn> element and its contai...
Responsive images - Learn web development
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. Each value contains a comma-separated list, and each part of those lists is made up of three sub-parts. Let's run through the contents of each now: srcset defines the set of images we will allow the browser to choose between, and what size each image is. Each set of image information is separated from the previous one by a comma. For each one, we write: An image filename (elva-fairy-480w.jpg...
...spect the page loaded on the mobile using the desktop developer tools. To see which images were loaded, you can use Firefox DevTools's Network Monitor tab. Older browsers that don't support these features will just ignore them. Instead, those browsers will go ahead and load the image referenced in the src attribute as normal. Note: In the <head> of the example linked above, you'll find the line <meta name="viewport" content="width=device-width">: this forces mobile browsers to adopt their real viewport width for loading web pages (some mobile browsers lie about their viewport width, and instead load pages at a larger viewport width then shrink the loaded page down, which is not very helpful for responsive images or design). Resolution switching: Same size, different resolutions If yo...
Video and audio content - Learn web development
basic foundations that can be achieved with HTML. We won't be teaching you how to produce audio and video files -- that requires a completely different skillset. We have provided you with sample audio and video files and example code for your own experimentation, in case you are unable to get hold of your own. Note: Before you begin here, you should also know that there are quite a few OVPs (online video providers) like YouTube, Dailymotion, and Vimeo, and online audio providers like Soundcloud. Such companies offer a convenient, easy way to host and consume videos, so you don't have to worry about the enormous bandwidth consumption. OVPs even usually offer ready-made code for embedding video/audio in your webpages; if you use that route, you can avoid some of the difficulties we discuss in...
...A typical example might look like so: <audio controls> <source src="viper.mp3" type="audio/mp3"> <source src="viper.ogg" type="audio/ogg"> <p>Your browser doesn't support HTML5 audio. Here is a <a href="viper.mp3">link to the audio</a> instead.</p> </audio> This produces something like the following in a browser: Note: You can run the audio demo live on Github (also see the au...
Functions — reusable blocks of code - Learn web development
The JavaScript language has many built-in functions to allow you to do useful things without having to write all that code yourself. In fact, some of the code you are calling when you invoke (a fancy word for run, or execute) a built in browser function couldn't be written in JavaScript -- ma...
... a paragraph on the page. Open the example up in a browser and in your text editor. Open the JavaScript console in your browser developer tools. In the JavaScript console, enter the following command: output(x); You should see the value of variable x output to the screen. Now try entering the following in your console output(y); output(z); Both of these should return an error along the lines of "ReferenceError: y is not defined". Why is that? Because of function scope -- y and z are locked inside the a() and b() functions, so output() can't access them when called from the global scope. However, what about when it's called from inside another function? Try editing a() and b() so they look like this: function a() { let y = 2; output(y); } function b() { let z = 3; output(...
Function return values - Learn web development
act. We are returning the result of the calculation Math.floor(Math.random() * number) each time the function is called. This return value appears at the point the function was called, and the code continues. So when you execute the following: ctx.arc(random(WIDTH), random(HEIGHT), random(50), 0, 2 * Math.PI); If the three random() calls returned the values 500, 200, and 35, respectively, the line would actually be run as if it were this: ctx.arc(500, 200, 35, 0, 2 * Math.PI); The function calls on the line are run first, and their return values substituted for the function calls, before the line itself is then executed. Active learning: our own return value function Let's have a go at writing our own functions featuring return values. First of all, make a local copy of the function...
... is a simple HTML page containing a text <input> field and a paragraph. There's also a <script> element, in which we have stored a reference to both HTML elements in two variables. This little page will allow you to enter a number into the text box, and display different numbers related to it in the paragraph below. Let's add some useful functions to this <script> element. ...
Making decisions in your code — conditionals - Learn web development
A real example To understand this syntax better, let's consider a real example. Imagine a child being asked for help with a chore by their mother or father. The parent might say "Hey sweetheart! 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 shopping...
... let greeting = ( isBirthday ) ? 'Happy birthday Mrs. Smith -- we hope you have a great day!' : 'Good morning Mrs. Smith.'; Here we have a variable called isBirthday -- if this is true, we give our guest a happy birthday message; if not, we give her the standard daily greeting. Ternary operator example The ternary operator is not just for setting variable values; you can also run functions, or lines of code -- anything you like. The following live example shows a simple theme chooser where the styling for the site is applied using a ternary operator. <label for="theme">Select theme: </label> <select id="theme"> <option value="white">White</option> <option value="black">Black</option> </select> <h1>This is my website</h1> const select = document.querySelector('select'); const html = d...
Introduction to web APIs - Learn web development
a useful update is available on a web app via system notifications (see the Notifications API) or vibration hardware (see the Vibration API). Client-side storage APIs are becoming a lot more widespread in web browsers -- the ability to store data on the client-side is very useful if you want to create an app that will save its state between page loads, and perhaps even work when the device is offline. There are a number of options available, e.g. simple name/value storage with the Web Storage API, and more complex tabular data storage with the IndexedDB API. Common third-party APIs Third-party APIs come in a large variety; some of the more popular ones that you are likely to make use of sooner or later are: The Twitter API, which allows you to do things like displaying your latest tweet...
...rning-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). The first five lines specify the location of the resource we want to fetch, create a new instance of a request object using the XMLHttpRequest() constructor, open an HTTP GET request to retrieve the specified resource, specify that the response should be sent in JSON format, then send the request. The onload handler function then specifies what we do with the response. We know the response will be successfully retu...
Client-side web APIs - Learn web development
side JavaScript examples without them. For this tutorial, we will assume that you are knowledgable about the core JavaScript language, and we will explore common Web APIs in a bit more detail. Basic knowledge of HTML and CSS would also be useful. Note: If you are working on a device where you don't have the ability to create your own files, you could try out (most of) the code examples in an online coding program such as JSBin or Glitch. Guides Introduction to web APIs First up, we'll start by looking at APIs from a high level -- what are they, how do they work, how do you use them in your code, and how are they structured? We'll also take a look at what the different main classes of APIs are, and what kind of uses they have. Manipulating documents When writing web pages and apps, o...
... <audio> -- which in turn come with their own APIs for controlling playback, seeking, etc. This article shows you how to do common tasks such as creating custom playback controls. Client-side storage Modern web browsers feature a number of different technologies that allow you to store data related to web sites and retrieve it when necessary allowing you to persist data long term, save sites offline, and more. This article explains the very basics of how these work. ...
Measuring performance - Learn web development
including the amount of time needed to unload the previous page, how long domain lookups take, the total time spent executing the window's load handler, and more. You can use the API for metrics related to all of the navigation events displayed in the didagram below. The Performance API, which provides access to performance-related information for the current page, includes the Performance Timeline API, the Navigation Timing API, the User Timing API, and the Resource Timing API. These interfaces allows the accurate measurement of the time it takes for JavaScript tasks to complete. The PerformanceEntry object is part of the performance timeline. A performance entry can be directly created by making a performance mark or measure (for example by calling the mark() method) at an explicit point...
...ng a performance mark or measure (for example by calling the mark() method) at an explicit point in an application. Performance entries are also created in indirect ways; such as loading a resource, like an image. The PerformanceObserver API can be used to observe performance measurement events and it can notify you of new performance entries as they are recorded in the browser's performance timeline. While this article does not dive into using these APIs, it is useful to know they exist. You can also refer to the Navigation and timings article for further examples on using performance Web APIs. Tools and metrics There are a number of different tools available to help you improve performance. These can generally be classified into two categories: Tools that indicate or measure perform...
Ember app structure and componentization - Learn web development
w: Client-side JavaScript frameworks Next In this article we'll get right on with planning out the structure of our TodoMVC Ember app, adding in the HTML for it, and then breaking that HTML structure into components. Prerequisites: At minimum, it is recommended that you are familiar with the core HTML, CSS, and JavaScript languages, and have knowledge of the terminal/command line. A deeper understanding of modern JavaScript features (such as classes, modules, etc), will be extremely beneficial, as Ember makes heavy use of them. Objective: To learn how to structure an Ember app, and then break that structure into components. Planning out the layout of the TodoMVC app In the last article we set up a new Ember project, then added and configured o...
... scope of this tutorial, although generally testing should be implemented as you develop, rather than after, otherwise it tends to be forgotten about. If you're curious about testing, or why you would want to have automated tests, check out the official Ember tutorial on testing. Before we start adding any component code, let's create the scaffolding for the other components. ...
Using Vue computed properties - Learn web development
Client-side JavaScript frameworks Next In this article we'll add a counter that displays the number of completed todo items, using a feature of Vue called computed properties. These work similarly to methods, but only re-run when one of their dependencies changes. Prerequisites: Familiarity with the core HTML, CSS, and JavaScript languages, knowledge of the terminal/command line. Vue components are written as a combination of JavaScript objects that manage the app's data and an HTML-based template syntax that maps to the underlying DOM structure. For installation, and to use some of the more advanced features of Vue (like Single File Components or render functions), you'll need a terminal with node + npm installed. Objective: To learn how to use Vue ...
...relying on a button press to trigger the change, we can attach a @change event handler to each checkbox instead of using v-model. Update the <input> element in ToDoItem.vue to look like this. <input type="checkbox" class="checkbox" :id="id" :checked="isDone" @change="$emit('checkbox-changed')" /> Since all we need to do is emit that the checkbox was checked, we can include the $emit() inline. In App.vue, add a new method called updateDoneStatus(), below your addToDo() method. This method should take one parameter: the todo item id. We want to find the item with the matching id and update its done status to be the opposite of its current status: updateDoneStatus(toDoId) { const toDoToUpdate = this.ToDoItems.find(item => item.id === toDoId) toDoToUpdate.done = !toDoToUpdate.done ...
Understanding client-side web development tools - Learn web development
We finish up by providing a complete toolchain example showing you how to get productive. ...
...developer? We have put together a course that includes all the essential information you need to work towards your goal. Get started Guides 1. Client-side tooling overview In this article we provide an overview of modern web tooling, what kinds of tools are available and where you'll meet them in the lifecycle of web app development, and how to find help with individual tools. 2. Command line crash course In your development process you'll undoubtedly be required to run some command in the terminal (or on the "command line" -- these are effectively the same thing). This article provides an introduction to the terminal, the essential commands you'll need to enter into it, how to chain commands together, and how to add your own command line interface (CLI) tools. 3. Package management...
Accessibility/LiveRegionDevGuide
This guide was written from an ATK/AT-SPI point of view as part of the Orca Live Region Support project. However, many of the concepts were also used during the development of FireVox, an AT using IAccessible2. Sometimes the very best guide for some developers is the code itself. Please refer to the liveregions and Gecko Python modules in Orca for a real world example. ...
...on. However, many web sites do not have proper ARIA markup so this cannot be used by itself. An event containing an object that has an attribute "tag:xul*" is not a live region. An event that has an object that is not a descendant of the document frame is not a live region. Live Properties This table describe the object attributes associated with a live region event. The following are guidelines on how to implement each container-live This property determines the interruption policy or politeness level for the event and can have values of "off", "polite", "assertive" and "rude". This property, along with an event's time stamp, determine the priority of a message within the priority queue. The following describes actions that should be taken for an event with the given politeness leve...
Embedding API for Accessibility
ug 71598) To use prefs in embedding, use something like the following code: #include "nsIPref.h"; nsresult rv; nsCOMPtr<nsIPref> prefs(do_GetService(NS_PREF_CONTRACTID, &rv)); prefs->SetBoolPref("bool.pref.name", PR_TRUE /* or PR_FALSE */); prefs->SetIntPref("int.pref.name", newValue); prefs->SetCharPref("string.pref.name", newCharStarValue); To manually add a pref to your settings, add a line like the following to your prefs.js: user_pref("accessibility.browsewithcaret", true); Accessibility Prefs Reference The following is a description of what accessibility prefs give us (or will give us), for accessibility: Functionality Implementation Works as of Images SetIntPref("network...
... /* Setting use_document_colors also stops background images from loading */ Moz 0.8 Link appearance SetCharPref("browser.anchor_color", "#abcdef" /* hex color value */); SetCharPref("browser.visited_color", "#abcdef" /* hex color value */); SetBoolPref("browser.underline_anchors", boolUnderlineLinks); Moz 0.8 Focus appearance SetBoolPref("browser.display.use_focus_colors", useFocusColors); SetCharPref("browser.display.focus_background_color", colorString); SetCharPref("browser.display.focus_text_color", colorString); SetCharP...
Information for External Developers Dealing with Accessibility
. Accessibility API cross reference Should be helpful at anyone looking at implementing accessibility API support for a product on multiple platforms. Contains info on accessible roles, states and events. Accessible Toolkit Checklist A list of what needs to be done for accessibility when building new toolkits, widget by widget. In addition, here is a list of official keyboard UI guidelines for each desktop: Windows keys: Guidelines on keyboard UI design and on implementing keyboard shortcuts: An excellent resource from Microsoft. Mac keys: Keyboard Shortcuts Quick Reference for Mac OS X Complete reference on keyboard for Mac OS X: this document list all functions of specified keys, known keyboard shortcuts, explains how to create keyboard shortcuts, explai...
...ard shortcuts, explains appropriate use for the arrow keys, how to move the insertion point with keys, how to extent text selection with keys, functions of function keys, what are reserved keyboard shortcuts, how to create your own keyboard shortcuts, keyboard focus and navigation, type-ahead and key-repeat, etc. Gnome keys: Keyboard documentation for Gnome 2.2: still seeking developer guidelines for keyboard. Other Useful Resources Links for those who wish to learn more about web accessibility or open source accessibility. Join the Mozilla Accessibility Community Live Chat Both end users and developers are invited for discussion on the live IRC channel at irc.mozilla.org/#accessibility. Since this is a worldwide effort, there is always a good chance to find someone to chat wi...
Lightweight themes
ther toolbar or other UI element is added to the top of the window. The upper right-hand side of the image should have the most important information - as a user increases the width of the browser window, the browser reveals more of the left-hand side of the image. Ultrawide monitors can run to 3440px wide, to look good on these monitors, ensure the left of the image fades to a solid color. Online image editor resources Pixlr -- Pixlr offers professional and easy-to-use tools for creating and editing images within a browser. Photoshop -- Tweak, rotate and touch up photos with Photoshop(R) Express, a free online photo editor. Submitting your theme image To get started submitting your images, go to the Theme Submission page: Name your theme -- pick a unique name for your theme. Dup...
...ext and tab colors -- you can choose the tab ("background") color and foreground text color that work best with your header image. Submit your theme -- if everything looks right, click the Submit Theme button and you're done! You can see all the themes you've authored on your profile page. Tip: to ensure that your theme is approved for the gallery, be sure it complies with the content guidelines and terms of service! Submit Your Theme Now Frequently asked questions For more information about Lightweight themes, including content guidelines, please see these Frequently Asked Questions. More tutorials Mozilla Themes Focal Point on Sizing - A tutorial on theming with a focus on sizing, by VanillaOrchids. ...
Creating reftest-based unit tests
d against an invariant, the test would appear to fail. But the test should not fail, unless the "<blockquote>" element did not cause any indentation at all. If a regression test harness has false failures, it makes the harness not trustworthy and the harness will not be used. Running reftest-based unit tests Note: mach is a Python2 script. If your use Python3 as default you must edit the first line of mach. To run all the reftests, go to the directory where you save Firefox's source code and run: ./mach reftest If you want to run a particular set of reftests, pass the path as an argument: ./mach reftest path/from/sourcedir/reftest.list And to run a single reftest just pass the path to the test file (not the reference file): ./mach reftest path/from/sourcedir/reftest-name.html Ther...
...with .list). More to do Create more reftests. New tests can be added to the reftest.list file, which can contain any number of tests. The file can include other things, but it does not get very complicated. Keep in mind new tests should fit a 600x600 window so we can test on mobile platforms easier. Here is an example. include ../other.list == foo.html bar.html != aaa.html bbb.html The first line, as one might expect, includes another manifest. The second line should look familiar. It says that foo.html and bar.html should produce visually identical output. The third line says that aaa.html and bbb.html should NOT produce visually identical output. More information on this file can be found in the README.txt referenced below, which was written by the creator of the reftest tool. There is...
Simple Instantbird build
it cannot be a sibling folder to your source directory. Use an absolute path to be sure! Building Instantbird What you need to do to build Instantbird rather than Firefox is: echo 'ac_add_options --enable-application=im' >> .mozconfig To start the build, cd into the comm-central subdirectory (created automatically by the hg clone command), and run: ./mozilla/mach build mach is our command-line tool to streamline common developer tasks. See the mach article for more. Building can take a significant amount of time, depending on your system, OS, and chosen build options. Linux builds on a fast box may take under 15 minutes, but Windows builds on a slow box may take several hours. Building purplexpcom and libpurple First download the purplexpcom code: hg clone http://hg.mozilla.org/use...
...s. Building purplexpcom and libpurple First download the purplexpcom code: hg clone http://hg.mozilla.org/users/florian_queze.net/purple mozilla/extensions/purple If you've set up your build environment as above, then all you need to do is: echo 'ac_add_options --enable-extensions=purple' >> .mozconfig in the comm-central directory, or just add the ac_add_options --enable-extensions=purple line to your .mozconfig with your favorite editor. Then just re-run the mach command above (you may need to clobber (see below), or you can do the addition before running make for the first time). Running To run your build, you can use ./mozilla/mach run There are various command line parameters you can add, e.g. to specify a profile. Various temporary files, libraries, and the Instantbird execu...
Simple SeaMonkey build
ill accomodate Visual Studio 2013 Community Edition, the required SDKs, the MozillaBuild package, the Mercurial source repository and enough free disk space to compile. A fast SSD is recommended; the Firefox build process is I/O-intensive. High speed internet Installing build tools If your system is not listed below, see the build prerequisites page. ...
...l necessary build deps sudo aptitude install zip mercurial libasound2-dev libcurl4-openssl-dev libnotify-dev libxt-dev libiw-dev libidl-dev mesa-common-dev autoconf2.13 yasm libgtk2.0-dev libdbus-1-dev libdbus-glib-1-dev python-dev libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev libpulse-dev Ubuntu Linux # for Ubuntu 12.04 LTS (Precise Pangolin), replace the following line with: sudo apt-get build-dep thunderbird sudo apt-get build-dep seamonkey sudo apt-get install zip unzip mercurial g++ make autoconf2.13 yasm libgtk2.0-dev libglib2.0-dev libdbus-1-dev libdbus-glib-1-dev libasound2-dev libcurl4-openssl-dev libnotify-dev libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev libiw-dev libxt-dev mesa-common-dev libpulse-dev Fedora Linux CentOS RH...
Reviewer Checklist
rsonally identifiable information, but also considering the expense of computing and recording log output. [Fennec: Checking for log levels is expensive unless you're using Logger.] Style Follow the style guide for the language and module in question. Follow local style for the surrounding code, even if that local style isn't formally documented. New files have license declarations and modelines. New JS files should use strict mode. Trailing whitespace (git diff and splinter view both highlight this, as does hg with the color extension enabled). Whitespace can be fixed easily in Mercurial using the CheckFiles extension. In git, you can use git rebase --whitespace=fix. Security issues There should be no writing to arbitrary files outside the profile folder. Be careful when readin...
...efs, for example.] Strings There should be no string changes in patches that will be uplifted (including string removals). Rev entity names for string changes. When making UI changes, be aware of the fact that strings will be different lengths in different locales. Documentation The commit message should describe what the patch is changing (not be a copy of the bug summary). The first line should be a short description (since only the first line is shown in the log), and additional description, if needed, should be present, properly wrapped, in later lines. Adequately document any potentially confusing pieces of code. Flag a bug with dev-doc-needed if any addon or web APIs are affected. Use Javadocs extensively, especially on any new non-private methods. When moving files, ensu...
Working with Mozilla source code
illa source code, learn to navigate the code, and how to get the changes you propose checked into the tree. Getting a pre-configured Mozilla build system virtual machine This is the easiest way to get started: use a VirtualBox virtual machine which is already configured with a complete build environment for you to use. Just boot the VM and build! Viewing and searching Mozilla source code online Learn how to use Searchfox, Mozilla's online search and browsing tool for accessing the source code. This isn't a good way to download the code, but is a great way to search it. Navigating the Mozilla source code Learn about the various folders in the Mozilla source tree, and how to find what you're looking for. Bugs for newcomers If you are new to the project and want something to work on,...
...h and browsing tool for accessing the source code. This isn't a good way to download the code, but is a great way to search it. Navigating the Mozilla source code Learn about the various folders in the Mozilla source tree, and how to find what you're looking for. Bugs for newcomers If you are new to the project and want something to work on, look here. Interface development guide Guidelines and documentation for how to create and update XPCOM interfaces. The Firefox codebase: CSS Guidelines This document contains guidelines defining how CSS inside the Firefox codebase should be written, it is notably relevant for Firefox front-end engineers. SVG Cleanup Guide Guidelines and best practices for shipping new SVGs. Try Servers Mozilla products build on at least three platforms. I...
Multiple Firefox profiles
s" option, the profile folder, and files will be deleted. This action cannot be undone. Cancel interrupts the profile deletion. Renaming a profile In the Profile Manager, select the profile you want to rename, and then click "Rename Profile". Enter a new name for the profile and click on OK. Note: The folder containing the files for the profile is not renamed. Options Work offline Choosing this option loads the selected profile, and starts Firefox offline. You can view previously viewed web pages, and experiment with your profile. Don't ask at startup If you have multiple profiles, Firefox prompts you for the profile to use each time you start Firefox. Select this option to allow Firefox to load the selected profile, without prompting at startup. Note: To access other...
...was in Gnome 2. The following tutorial will help get you going overall: Gnome 3 Custom application launcher. 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. If you want to have the profile manager to pop up each time you start Firefox, so you can choose a profile, you will need to set the command line for your new launcher. Set the "command" text field to target the executable file, likely "/usr/bin/firefox", and add the -p parameter. If you want individual icons to launch specific profiles, you will need to set the command line for your new launcher. To do this: Set the "command" text field to target the executable file, likely "/usr/bin/firefox", and add the -p PROFILE_NAME parameter...
Chrome-only CSS reference
Mozilla › Gecko › Chrome › CSS
::-moz-tree-rowThe ::-moz-tree-row CSS pseudo-element is used to select rows and apply styles to tree rows.::-moz-tree-row(hover)The ::-moz-tree-row(hover) CSS pseudo-class will match an element if the mouse cursor is presently hovering over a tree row.::-moz-tree-separator...
...ef() @supports condition is available to Gecko chrome and UA stylesheets to check if a boolean preference is enabled.CSS <display-xul> component</display-xul>Firefox supports the following -moz- prefixed XUL display values:overflow-clip-boxThe overflow-clip-box CSS property specifies relative to which box the clipping happens when there is an overflow. It is short hand for the overflow-clip-box-inline and overflow-clip-box-block properties.overflow-clip-box-blockThe overflow-clip-box-block CSS property specifies relative to which box the clipping happens when there is an overflow -- in the block direction.overflow-clip-box-inlineThe overflow-clip-box-inline CSS property specifies relative to which box the clipping happens when there is an overflow -- in the inline direction. ...
Embedding the editor
, steps towards that final solution are described. Embedding applications Here are some embedding scenarios that editor needs to deal with. Note here that I use the term 'Composer' to mean an HTML-savvy compose widget that does rich text editing, and 'Editor' to mean a plain text editor (as well as the underlying technology for Composer). <htmlarea> is intended as a shorthand for a rich-text multiline text widget embedded in an HTML document, and is not meant to infer that future versions of Mozilla will support this specific tag. Composer embedded in a XUL application Developers need to embed composer widgets in their XUL applications, by using the <editor> tag as we do today. They should need to do as little work as possible to get basic editing functionality, be able to have any number of <...
... dialog JS files assume that they can get at the one true editor via window.editorShell. This assumption was short-sighted, and must be fixed. Editor assumes XUL document structure There is C++ and JS code in the editor that assumes that the editor is living in a XUL document, and that there are XUL document nodes out there whose attributes can be tweaked to change the state of the UI (e.g. the inline style buttons). This needs to be changed to allow embedders to provide their own, possibly native UI. Editor needs to call through one or more interfaces when communicating with the UI. Embedding objectives Editor requires design changes such that the embedding applications above can be fulfilled, and these changes will need to address the current problems. Briefly, the embedding objectives are: ...
Gecko SDK
obably need to build it yourself. Note: You can subscribe to a calendar of the Firefox release schedule. Also, you can view the schedule on the Web. Unpack the SDK tarball to some suitable location. ...
...On 64-bit versions of Mac OS X, you'll need to install libidl with the +universal flag. Once that's done, you should perform the following command: ln -s /opt/local/lib/libintl.8.dylib /opt/local/lib/libintl.3.dylib This should fix the problem. ...
HTTP Cache
heEntryAvailable is true for and only for new entries. Only one consumer (the so called "writer") may have such an entry available (obtained via onCacheEntryAvailable). Other parallel openers of the same cache entry are blocked (wait) for invocation of their onCacheEntryAvailable until one of the following occurs: The writer simply throws the entry away: other waiting opener in line gets the entry again as "new", the cycle repeats. This applies in general, writers throwing away the cache entry means a failure to write the cache entry and a new writer is being looked for again, the cache entry remains empty (a.k.a. "new"). The writer stored all necessary meta data in the cache entry and called metaDataReady on it: other consumers now get the entry and ma...
... revalidation. Reason is that when the writer is interrupted (by e.g. external canceling of the loading channel) concurrent readers would not be able to reach the remaning unread content. This could be improved by keeping the network load running and being stored to the cache entry even after the writing channel has been canceled. When the writer is interrupted, the first concurrent reader in line does a range request for the rest of the data - and becomes that way a new writer. The rest of the readers are still concurrently reading the content since output stream for the cache entry is again open and kept by the current writer. Lifetime of an existing entry with only a partial content Such a cache entry is first examined in the nsICacheEntryOpenCallback.onCacheEntryCheck callback, whe...
How to Report a Hung Firefox
s not responding..." dialog? This usually means that something in Firefox is hung. This may be because of a code error within Firefox itself, such as a deadlock or infinite loop, or it may be caused by 3rd-party software such as a Firefox extension, antivirus software, or even malware or a virus on your computer. What information to include in a bug report As usual, following Bug writing guidelines will make your report much more likely to lead to a fix in 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? (If you're experiencing high CPU usage and Firefox eventually recovers from a hang, you should try the instructions at Reporting a Performa...
... bug report with the crash report ID. The steps to induce a crash are slightly different on each platform: Windows On Windows, the stability team has written a utility which will inject a crash into Firefox which will trigger the crash reporter: Download crashfirefox.exe here (source code). Running this tool will search for firefox.exe and inject crashing code into it. The tool also has command-line options to kill processes with other names or by process ID. Run the crashfirefox.exe tool. The Firefox crash report UI should appear. Please check the box to send the crash report to Mozilla Start Firefox. Type "about:crashes" in the URL bar and click on the top listing. The crash report should look something like this report, which is an example of bug 1132241. Create a new bug report at ...
PBackground
PBackground is a mechanism available since Gecko 30 (see bug 956218) that builds on top of IPDL to provide a solution to common problems that arise when handling multiple threads in the chrome process, for example communication between workers and multiple child processes and other parent-process worker threads. This article outlines what PBackground is, and how it works. IPDL recap IPDL is a language used to define "protocols" -- essentially formalized versions of how two things can communicate. It is similar in some respects to IDL and WebIDL. At build time the IPDL compiler automatically generates a large amount of C++ glue code from the IPDL files. IPDL protocols are used to specify how the chrome and content processes talk to each other and verify that a content process is "foll...
...nning in. Instead, it simply turns all of its operations into IPDL calls on a set of PBackground-based actors and the processing, file I/O, etc, can be controlled from the PBackground thread regardless of where the DOM calls are being made. The logic is all implemented in ActorsParent.cpp and ActorsChild.cpp in the dom/indexedDB directory. These are not small files (ActorsParent.cpp was over 27k lines of code as of this publication) but the logic that needs to run in the parent is very clearly separated from the DOM code no matter what thread it's running on. Note: This article was original published as What is PBackground?, by Kyle Huey. ...
Add-on Manager
These pages show you how to load pages such as services page etc. ...
...These pages show you how to load pages such as services page etc. ...
CustomizableUI.jsm
mple button; type custom should not be used for such a simple widget. If this is your need see the example above CreateWidget - Button Type. Note: the DOM node you construct should have the same ID as the id property described above, so that CustomizableUI can find the node again later. ...
...eElementNS('http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul', 'toolbaritem'); var image = aDocument.createElementNS('http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul', 'image'); image.setAttribute('src', 'chrome://branding/content/icon16.png'); var props = { id: 'navigator-throbber', //id in dom // SHOULD match id of that in cui.jsm (Line #2) title: 'Activity Indicator', align: 'center', pack: 'center', mousethrough: 'always', removable: 'true', sdkstylewidget: 'true', overflows: false }; for (var p in props) { toolbaritem.setAttribute(p, props[p]); } toolbaritem.appendChild(image); return toolba...
OS.File for the main thread
See the Promise object documentation for details. Also, OS.File plays very nicely with Task.jsm. ...
...If the file does not exist, it is created. At the time of this writing, write does not support encoding option so the text to be written has to be encoded with TextEncoder. This example also shows the resolve value of open (an instance of OS.File, this is a file, so you can do any ...
PromiseWorker.jsm
ite doesn't have to know which object should be transferred. For example: myWorker.post('func', [foo(), bar(), baz()]) foo now has the power to determine if the argument should be transferred by returning a Meta instance. So it can transfer an object without modifying the caller. 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. Sending a message from worker With all other workers, to send a message to the main thread, postMessage is typically used. However with PromiseWorker objects this is no longer the case, simply return data or throw from your function depending if you want to resolve or reject the promise. In summary, from a worker file...
...doMyFuncFalse - ', aReason); } ).catch( function(aCaught) { console.error('Caught - promise_doMyFuncFalse - ', aCaught); } ); Result Running the code above will log the following information to the console: "Fullfilled - promise_doMyFuncTrue - " "You sent to PromiseWorker argument of: `true`" bootstrap.js Line 8 "Rejected - promise_doMyFuncFalse - " "You passed in a non-true value for shouldResolve argument and therefore this will reject the main thread promise" bootstrap.js Line 25 Other examples GitHub :: PromiseWorker with Backward Compatability - This example is of a Firefox addon that copies and pastes in the contents of PromiseWorker.js and PromiseWorker.jsm so that it works all the way ba...
Webapps.jsm
ethod overview init: function() loadCurrentRegistry: function() notifyAppsRegistryStart: function notifyAppsRegistryStart() notifyAppsRegistryReady: function notifyAppsRegistryReady() sanitizeRedirects: function sanitizeRedirects(aSource) _saveWidgetsFullPath: function(aManifest, aDestApp) appKind: function(aApp, aManifest) updatePermissionsForApp: function(aId, aIsPreinstalled) updateOfflineCacheForApp: function(aId) installPreinstalledApp: function installPreinstalledApp(aId) removeIfHttpsDuplicate: function(aId) installSystemApps: function() loadAndUpdateApps: function() updateDataStore: function(aId, aOrigin, aManifestURL, aManifest) _registerSystemMessagesForEntryPoint: function(aManifest, aApp, aEntryPoint) _registerInterAppConnectionsForEntryPoint: function(aManifest, aA...
...r: function(aId) _writeFile: function(aPath, aData) doGetList: function() doExport: function(aMsg, aMm) doImport: function(aMsg, aMm) doExtractManifest: function(aMsg, aMm) doLaunch: function (aData, aMm) launch: function launch(aManifestURL, aStartPoint, aTimeStamp, aOnSuccess, aOnFailure) close: function close(aApp) cancelDownload: function cancelDownload(aManifestURL, aError) startOfflineCacheDownload: function(aManifest, aApp, aProfileDir, aIsUpdate) computeManifestHash: function(aManifest) updateAppHandlers: function(aOldManifest, aNewManifest, aApp) checkForUpdate: function(aData, aMm) doInstall: function doInstall(aData, aMm) doInstallPackage: function doInstallPackage(aData, aMm) pushContentAction: function(windowID) popContentAction: function(windowID) actionCancelle...
Localizing extension descriptions
ocalizing before Gecko 1.9 Before Gecko 1.9, add-on developers must go through a special process to define localized add-on descriptions for add-ons targeting toolkit-based apps (such as Firefox or Thunderbird). If you do not currently have them, create localized properties files. Make sure to use UTF-8 encoding (without BOM) to ensure foreign characters display correctly. ...
...he following line to each of your localization properties files (where EXTENSION_ID matches your extension ID (<em:id> from install.rdf) and LOCALIZED_DESCRIPTION is the description of your extension that you want to appear in the given language): extensions.EXTENSION_ID.description=LOCALIZED_DESCRIPTION If you do not currently have one, create a default preferences file. ...
Localizing extension metadata on addons.mozilla.org
p 1). The values you provide here are used as fallback values if someone requests a language that doesn't exist. Step 4 allows you to translate any of the above fields into any other language AMO supports. Remember, all fields are optional when localizing. Any field that is blank will just show up in the default locale. Getting translation help You are kindly advised NOT to use any automatic online translation, which can bring unpleasant low-quality output to users. Always prefer a qualified human translation. AMO doesn't directly provide translation assistance to extension authors, but there are a couple services that can help: BabelZilla.org BabelZilla.org is a community dedicated to the localization of extensions for Moz family apps. They are volunteer translators from all over the wo...
... prefer a qualified human translation. AMO doesn't directly provide translation assistance to extension authors, but there are a couple services that can help: BabelZilla.org BabelZilla.org is a community dedicated to the localization of extensions for Moz family apps. They are volunteer translators from all over the world and are maintaining translations for more than 400 extensions with an online translation system. They also provide help for adding a localization support to your extension if there is no localization structure yet. You can already request for AMO fields localization on the forums, and these fields will be added soon to the Web Translation System. Amazon Mechanical Turk This is not free, but for a very modest amount of money you can get your AMO page quickly translated b...
Localizing without a specialized tool
reate the structure of your localization, where, one-by-one, each of the files needing localization will be copied. This directory structure needs to mimic the same as the en-US source files concerning localization. You will use a tool called compare-locales to do the comparison between your locale's files and the en-US reference. First, install compare-locales. You can follow more detailed guidelines on compare-locale's page, but running the following command from the command line should be enough: $ sudo easy_install -U compare-locales To start, be sure to open your command line interface and change your directory to where you are keeping your localization files, the en-US sources $ cd /path/to/your/working/directory Now, you will need run compare locales. To do this, enter the following...
...ou can always check the path by typing pwd Once you are in the root working directory with both en-US source and the l10n base, copy the searchbar.dtd file by typing cp mozilla-1.9.2/browser/locales/chrome/browser/search.properties l10n-mozilla-1.9.2/x-testing/browser/chrome/browser/ Open that file and translate the strings that follow the "=". For instance, enter the proper translation for the line "Add %S" cmd_addFoundEngine=ADD "%S" With these two string examples translated, you can now test your work to see immediately where you have translated. Refer to the Building and Testing section of the Create a new localization page. Going one-by-one With your compare-locales output open for review, we will start with the first file with "// add and localize this file" note. You should see // ...
Initial setup
ion control environment that houses the main Mozilla source code as well as localized code for each official Mozilla localization. You will need this for localizing Mozilla applications. Hg commit access is not necessary to begin localizing. After you have some experience with hg, you may want to get commit access. At that point, you must visit the Mozilla Committer page and follow the process outlined there. Here is an example bug that illustrates the process well. Use this bug template when filing your hg account registration bug. Add a request about creating your locale's repository to the new locales newsgroup. SVN SVN is a revision control environment that Mozilla uses to house Mozilla source websites and their localizations for each official Mozilla localization. See this wiki page abo...
...ecks L10n checks is another Python script that helps you check your work without running an application. Install instructions are located here. autoconf 2.13 autoconf is a utility that is vital to manually creating Mozilla application builds and language packs. We use version 2.13 and higher for these builds. You can find the source files and install instructions here. wget wget is a command-line utility that allows you to retrieve files using internet protocols. We use it for retrieving files from repositories. You can find the source files and install instructions here. Perl Perl is a programming language that will help you create Mozilla application builds and language packs. You can find the source files and install instructions here. Python Python is a programming language in whi...
Release phase
. Consequently, if you already have a local clone that you pulled using HTTP, you'll need to modify a config file to tell Mercurial to push through SSH. Let's go over configuring your connection protocols. Configuration Before you try pushing, you need to tell SSH which username you wish to use for connecting with hg.mozilla.org. This should be your Mozilla LDAP account name. ...
...LDAP account name: Host hg.mozilla.org User user@host.domain If you have already cloned the remote repository using the HTTP protocol using this command: $ hg clone http://hg.mozilla.org/releases/l10n-central/x-testing then you will need to edit the .hg/hgrc file (inside the x-testing local clone) to tell Mercurial to push using SSH. ...
Localization formats
roject with stable content? Is this a short-term project? Will the content differ per locale? If so, to what extent? As every new web-dev project takes shape, a project manager should ask themselves these questions and have the answers ready before starting the web l10n process. HTML/PHP Maybe you are designing a project that has relatively small translation needs like three to four lines (or more) of content asking users to update to the next version of software available. You may choose to present just the HTML for localization: We give an HTML file which lists several pieces of content like, <H1>Getting Started</H1> and the localizer translates to <H1>Debuter avec Firefox</H1> The localizer then submits the translated HTML or PHP back to us by either checking in chang...
...n" msgstr "Bientot disponible" where the value in the "" of the msgid is the English content, and the value in the "" of the msgstr is the translation. msgstr can be longer translations than just the exact above. For example, below is the entire introduction used for a certificate that was presented to those who downloaded Firefox during the Download Day campaign. ...
Writing localizable code
This page tells you about best practices and guidelines when dealing with UI code with respect to localization. It is aimed at Mozilla and extension developers. For technical details please also look at XUL_Tutorial:Localization. About Localizers A few notes about localizers for developers who rarely deal with them: localizers like tools, and they don't like editors, localization tools are often based on key-value pairs, at least some localizers have their talents focused on language skills and are not savvy in programming, or even building applications. ...
...details please also look at XUL_Tutorial:Localization. About Localizers A few notes about localizers for developers who rarely deal with them: localizers like tools, and they don't like editors, localization tools are often based on key-value pairs, at least some localizers have their talents focused on language skills and are not savvy in programming, or even building applications. Guidelines Thus, there are a few guidelines you should follow to make localization of your code easier: Choose good key names The names chosen for your keys (regardless of whether that's a DTD or a properties file) should be descriptive. Think of them as long variable names. If you change the semantics of a localized string, change the key. This will more likely be a good key name, and it will help to...
Mozilla MathML Status
ey but not in Firefox. See bug 958957. mathcolor Implemented. mathbackground Implemented. Token Elements Element [- attribute] Notes mi Implemented. The mathvariant attribute is fully supported starting with (Firefox 28.0 / Thunderbird 28.0 / SeaMonkey 2.25). See bug 114365. mn Implemented. mo Implemented. mo - linebreaking attributes, indentation attributes Not implemented. See bug 534962. mtext Implemented. mspace Implemented. mspace - linebreak Not implemented. See bug 534962. ms Implemented. General Layout Schemata Element Notes mrow Implemented. mfrac Implemented. msqrt Implemented. mroot ...
... 122253. Elementary Math Element [- attribute] Notes mstack Not implemented. See bug 534967. mlongdiv Not implemented. See bug 534967. msgroup Not implemented. See bug 534967. msrow Not implemented. See bug 534967. mscarries Not implemented. See bug 534967. mscarry Not implemented. See bug 534967. msline Not implemented. See bug 534967. Other elements Element [- attribute] Notes mglyph Not implemented. See bug 297465. maction Implemented. maction - tooltip Not implemented. See bug 544001. semantics Implemented. Original Document Information Author(s): Frederic Wang Other Contributors: Copyright Information: Porti...
Mozilla Development Strategies
r Bugzilla queries to find crashers. Look for problems in existing code. Find and fix string usage problems. Find and fix bad XPCOM macro usage. Switch some code over to nsCOMPtrs. Look for XXX or TODO in the code, verify the code still needs fixing, and fix it. Smaller patches get reviewed faster If you find that you spend a lot of time waiting for reviews, keep in mind that patch size is not linear to time to review. A twenty line patch doesn't take twice as long to review as a ten line patch, it usually takes much more time. If you can divide and conquer what you are working on into smaller chunks, you will find you'll get faster reviews. Of course, not everything can be divided up. And, shorter fixes aren't necessarily better than longer ones. Having parallel trees should allow you to ...
...f you know about later -- chances are the reviewer will make you do the work anyway. If it takes you five extra minutes to do something the "right" way rather than twenty minutes debating it with the reviewer, you've just saved yourself and the reviewer valuable time. Obviously, when doing it the "right" way means re-engineering large amounts of code, then incremental work is better; it's a fine line. Don't drag out reviews by fighting the reviewer in Bugzilla (or email) When getting a review, try not to belabor a point that a reviewer is debating you on. If the debate is involved, solve it in person, on IRC or over AIM. A five minute discussion is worth an hour of e-mails. Do thorough code reviews When you review someone else's code, review thoroughly. If another engineer checks in code ...
Mozilla Development Tools
/Firefox 3.5 and beyond uses the Mercurial source code version control system. Earlier releases and other products use the CVS version control system. If you are doing active development, checking out source code from one of these is preferable to downloading an archived snapshot, as you get up-to-the-minute changes. MXR You can browse the up-to-the-minute latest version of the source code online through a massively-hyperlinked source code browser (based on LXR) that lets you cross-reference function and variable names. Bonsai Bonsai is tree control (get it?). It is our home-grown web-based tool for watching the up-to-the-minute goings-on in our CVS repository (viewing checkins and log messages, reading diffs, etc.) Tinderbox Tinderbox is for knowing when the tree is in flames. ...
...hen the tree is in flames. It is our home-grown web-based tool for watching the progress of the continuous builds that we run on multiple platforms. It is how we are able to tell when a checkin has broken the build on some platform, and how we know which person needs to be viciously flogged. Bugzilla Bugzilla is where developers can report bugs in the Mozilla source releases, and browse an online database of already-reported bugs. Doctor Doctor is a web interface to CVS. It lets developers and others edit pages on the mozilla.org web site without having to use CVS. Doctor lets you edit pages in WYSIWYG mode if the pages contain the <?doctor enable_wysiwyg_mode ?> processing instruction. Access Doctor by clicking the "Edit this Page" link at the bottom of any mozilla.org web page. ...
BloatView
Here's how you interpret the columns. The first, numerical column is the index of the leaking class. Class - The name of the class in question (truncated to 20 characters). Bytes Per-Inst - The number of bytes returned if you were to write sizeof(Class). Note that this number does not reflect any memory held onto by t...
... nsHashKey 8 610568 1842400 2457872 1134592 6045432 32000 536 568 1216 34320 nsTextTransformer 548 8220 469088 1414936 1532756 3425000 0 0 0 0 0 nsStyleContextData 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 (mo...
Memory Profiler
nd identifying memory leaks. However, the information exposed in this way is usually a snapshot and the history of how memory has been used goes missing. Moreover, they usually don't keep tracks of how objects are allocated. Developers have to infer how an object might be allocated and freed by himself/herself. Another common approach is to plot the allocations or the memory usages along the timeline. This gives some intuition of how and when a bulk of objects are allocated. However, it still relies on developers' wisdom, and sometimes chances, to dig out the problematical code snippet. This memory profiler is designed to solve the inconveniences and limitations. The goal is to identify the memory eager codes directly. The profiler is designed at the very beginning to support not only JavaS...
...nd limitations. The goal is to identify the memory eager codes directly. The profiler is designed at the very beginning to support not only JavaScript but also native codes. Naturally, not only JavaScript objects but also native allocations are tracked. The profile while recording is stored in memory in a very compact format. It's supposed to profile a very long time period without problem. Timeline view This view shows the allocation event across the period of time. It shows the overall memory usage history. Red is allocate and blue is deallocate. Rank-list view and tree view The rank-list view shows top functions that are most memory eager. The table could be sorted according to the 6 measurements: {retained, allocated, peak} x {self, inclusive}. The tree view shows functions as call...
TraceMalloc
is documentation is only relevant to older versions of the codebase that still contain it. TraceMalloc captures stack traces of all malloc, calloc , realloc, and free calls (this currently covers all operator new and delete calls in Mozilla, too). To enable TraceMalloc in your build, configure with --enable-trace-malloc. The built Mozilla application will support the following additional command-line options: --trace-malloc filename The application will log allocation and deallocation events with stack traces in a binary format to the given file. If filename is -, nothing is written to a file, but TraceMalloc will be active and will track live allocations and their stack traces. --shutdown-leaks=filename On shutdown, the application will save live allocations (with stack traces) to the g...
... the current log file to the one identified by logfd, returning the previous fd (so you can maintain a number of open files; keep their fds in a JS Array!). TraceMallocCloseLogFD(logfd) - close the log file identified by logfd, flushing its buffer of any events first. If logfd identifies the current log file, change the current log file to the default log file given by the --trace-malloc command line argument. TraceMallocLogTimestamp(caption) - log a timestamp event to the current log file, annotating the log even with the caption string. TraceMallocDumpAllocations(pathname) - dump a human-readable listing of all traced, live allocations. See nsTraceMalloc.h for detailed comments on the log file format. Analyzing the shutdown log The shutdown log is a basic tool for finding memory leaks. T...
tools/power/rapl
These are machine-wide estimates, so if you want to estimate the power consumption of a single program you should minimize other activity on the machine while measuring. Note: The power profiling overview is worth reading at this point if you haven't already. It may make parts of this document easier to understand. Invocation First, do a standard build of Firefox. Mac On Mac, rapl can be run as follows. $OBJDIR/dist/bin/rapl Linux On Linux, rapl can be run as root, as follows. ...
...3 W = 10.43 ( 4.41 + 0.81 + 5.22) + 4.19 W #06 11.16 W = 6.90 ( 1.91 + 1.68 + 3.31) + 4.26 W #07 5.40 W = 1.97 ( 0.20 + 0.10 + 1.67) + 3.44 W #08 5.17 W = 1.76 ( 0.07 + 0.08 + 1.60) + 3.41 W #09 5.17 W = 1.76 ( 0.09 + 0.08 + 1.58) + 3.42 W #10 8.13 W = 4.40 ( 1.55 + 0.11 + 2.74) + 3.73 W Things to note include the following. All measurements are in Watts. The first line indicates the meaning of each column. The underscores in _pkg_, _gpu_ and _ram_ are present so that each column's name has five characters. The total power is the sum of the package power and the RAM power. The package estimate is divided into three parts: cores, GPU, and "other". "Other" is computed as the package power minus the cores power and GPU power. If the processor does not support G...
turbostat
This article provides an introduction to using it. Note: The power profiling overview is worth reading at this point if you haven't already. It may make parts of this document easier to understand. ...
... 0 11.92 3 3 702 19.14 3670 3398 0 8.39 3.09 2.03 67.36 39 3 7 648 17.67 3667 3398 0 9.85 The man page has good explanations of what each column measures. The various "Watt" measurements come from the Intel RAPL MSRs. ...
browser.dom.window.dump.file
Related browser.dom.window.dump.enabled ...
... Related browser.dom.window.dump.enabled ...
Patches and pushes
, visit the OpenSearch wiki page and the MozSearch wiki page. The pages are old (I mean, Firefox 2???), but still accurate. Each plugin has an icon image which is linked within the XML file as an URI ID. Upload your plugins icon image to Data Kitchen to obtain its URI ID and add to the XML file within the Image tag. ...
...add to the XML file within the Image tag. In list.txt, add the search plugin's XML filename (without extensions) on a new line and save. Note that if your team selects a local version of an already default plugin (e.g., Wikipedia), the XML filename should include the locale code (e.g., Wikipedia-es). Create a patch of the searchplugins directory by entering the following command in your command-line tool, where mypatch.diff is where you give your patch a name: $ hg add mozilla/browser/searchplugins/ $ hg diff mozilla/browser/searchplugins/ > mypatch.diff Attach your patch file to the bug by clicking the "Add an attachment" link. Once attached and labeled as a patch, open the attachment details. In the attachment details, select the ? from the dropdown menu next to the review flag. This ...
Research and prep
relates to their locale. It is one of the most customizable and localizable parts of the product l10n process, as it goes beyond string translation. We believe that localization teams are in the best position to provide recommendations on what local providers we can use for web services because you're in the market, work in the language, and know your users. This is, therefore, meant to be a guideline for how you should be formulating your recommendations. Here's the basic process: File a bug under Mozilla Localizations>[your_locale] to request updates to your locale's productization preferences. If this is your first localization for a product, the l10n drivers will file this bug as part of the new product localization release process. It is your l10n team's responsibility to perform resea...
...ence should be taken into account and given preference for what is desired in that language/locale. If you have questions about what that means, please contact milos@mozilla.com or Milos on IRC. RSS Readers and Content handlers Productization for RSS readers and content handlers applies only to Firefox desktop. Your selections for default RSS readers and content handlers should follow these guidelines: Be translated in your language (because it makes the application unusable if it's not in your language Provide for the intended user experience (e.g., minimal to no advertisements within the user experience) No more than three (if possible) choices. Choosing based on popularity is fine. Examples from various localizations Some examples from en-US Web Service Provider Rationa...
Localization Use Cases
the gender of brandShortName. In order to construct a grammatically-correct and naturally-sounding message, we must know the gender of the subject. Solution In L20n, the localizer can define the gender (or, in fact, any arbitrary trait) as an attribute of the entity. ...
... an attribute of the entity. For Polish, we can define brandShortName in shared/branding/official/branding as: <brandShortName "Firefox OS" _gender: "masculine"> And in shared/branding/unofficial/branding, as: <brandShortName "Boot2Gecko" _gender:"neutral"> Now we can translate crash-banner-os2 into Polish without sounding like a robot: <crashBannerOS2[brandShortName::_gender] { masculine: "{{ brandShortName }} ulegl awarii", feminine: "{{ brandShortName }} ulegla awarii", neutral: "{{ brandShortName }} uleglo awarii" }> This will give us, depending on the current branding, the following messages: Firefox OS ulegl awarii Boot2Gecko uleglo awarii Isolation Let's look at how the Settings app formats sizes. First, there is DeviceStorageHelper.showFormatedSize (sic): functi...
Optimizing Applications For NSPR
L</tt>. These different declarations are to accommodate restrictions in Watcom's C/C++ version 11.0 and 11.0a compiler. Windows 3.1 does not provide a non-blocking file I/O interface. NSPR's file I/O is done using Windows 3.1's synchronous file I/O API. The NSPR file I/O APIs may cause a thread switch even though the I/O is fully synchronous. Do not depend on File I/O being synchronous. Command line applications using the LIBC printf() and related APIs behave funny on Windows 3.1. Read the fine print in the Windows SDK for the grizzly details. Watch out for PRIntn overflow on Win16. Make sure all possible values of your PRIntn variables are within 2^16. WIN-95 The WIN-95 version of NSPR should really be labeled WIN-32. The same library will work on either WIN-NT or WIN-95. WIN-95 NSPR ...
... the latest patches for the pthreads library. The changes are not evident until one tries to do thread suspension (<tt>PR_SuspendAll()</tt>) which is in preparation for garbage collection. Digital Unix is the main platform used for NSPR's prototype use of IPv6. There are some conflicts between the patches needed to use IPv6 and those needed for pthreads. The IPv6 kit needs to be applied on a baseline configuration of Digital Unix V4.0B. Linux The pthreads version of Linux (which is not the default) uses the same signals that NSPR uses to suspend threads in preparation for garbage collection. No solution in hand. OS/2 The OS/2 port is not functional in its current state due to the requirement to remove some files that could not be shipped under the NPL. This problem has been resolved a...
NSPR LOG MODULES
uld be set in the NSPR_LOG_MODULES environment variable at execution time to affect NSPR's log service for your application. all The name all enables all log modules. To enable all log module calls to PR_LOG, set the variable as follows: set NSPR_LOG_MODULES=all:5 timestamp Including timestamp results in a timestamp of the form "2015-01-15 21:24:26.049906 UTC - " prefixing every logged line. append Including append results in log entries being appended to the existing contents of the file referenced by NSPR_LOG_FILE. If not specified, the existing contents of NSPR_LOG_FILE will be lost as a new file is created with the same filename. sync The name sync enables unbuffered logging. This ensures that all log messages are flushed to the operating system as they are written, but may...
...OG_FILE will be lost as a new file is created with the same filename. sync The name sync enables unbuffered logging. This ensures that all log messages are flushed to the operating system as they are written, but may slow the program down. bufsize:size The name bufsize:size sets the log buffer to size. Examples Log everything from the Toolkit::Storage component that happens, prefixing each line with the timestamp when it was logged to the file /tmp/foo.log (which will be replaced each time the executable is run). set NSPR_LOG_MODULES=timestamp,mozStorage:5 set NSPR_LOG_FILE=/tmp/foo.log Logging with Try Server For mochitest, edit variable NSPR_LOG_MODULES in testing/mochitest/runtests.py before pushing to try. You would be able to download the log file as an artifact from the Log...
NSPR release process
Make sure the NSS tinderboxes (which also build and test NSPR) are all green. The build+test cycles of the NSS tinderboxes are very long, so you usually need to wait half a day for them to cycle through. Create a BETA CVS tag. The naming convention is NSPR_x_y_z_BETAn for NSPR x.y.z Beta n. ...
...wait half a day for them to cycle through. Create a BETA CVS tag. The naming convention is NSPR_x_y_z_BETAn for NSPR x.y.z Beta n. Push the BETA tag to mozilla-central for testing in Firefox trunk builds. Ideally you should test it for a week. Remove "Beta" from the NSPR version number for the final release. Usually you just need to update prinit.h. Make a dummy change (add or remove a blank line) to mozilla/nsprpub/config/prdepend.h. Create a RTM CVS tag. The naming convention is NSPR_x_y_z_RTM for NSPR x.y.z. Upload a source tar file to https://ftp.mozilla.org/pub/mozilla....nspr/releases/ Write the release notes. Announce the release in the Mozilla NSPR newsgroup. ...
NSS Code Coverage
NSS - Code Coverage Results link 2007-08-14 - Solaris/Sparc platform Results explanation Files Results from every C file are on new line. If file was tested, link points to annotated source file (in TCOV directory), otherwise to original source file (CVS directory). Colors Green: 70-100% of blocks tested. Yellow: 40-70% of blocks tested. Orange: 0-40% of blocks tested. Red: file not tested. File is not part of any binary or library used by test suite. Numbers in tested files Example: 72.69% (165/227/731) 72.69% - ratio of tested blocks and total blocks in file (generated by TCOV). 165 - tested blocks in file (generated by TCOV). 227 - total blocks in file (generated by TCOV). 31 - total lines in file (by wc -l command). Numbers in not tested files Exampl...
... Numbers in total count Example: Total: 42% (574/1351). 42% - ratio of tested blocks and total blocks in file. 165 - tested blocks in all files in directory (sum of numbers generated by TCOV). ...
Getting Started With NSS
x and other applications that make use of NSS? We are looking forward to your contributions! We have a large list of tasks waiting for attention, and we are happy to assist you in identifying areas that match your interest or skills. You can find us on Mozilla IRC in channel #nss or you could ask your questions on the mozilla.dev.tech.crypto newsgroup. The NSS library and its supporting command line tools are written in the C programming language. Its build system and the automated tests are based on makefiles and bash scripts. Over time, many documents have been produced that describe various aspects of NSS. You can start with: the current primary NSS documentation page from which we link to other documentation. a General Overview of the applications that use NSS and the features it pr...
...e NSS sources, building, and testing. Old documentation that is on the archived mozilla.org website. (Unfortunately the NSS project doesn't have a technical writer at this time, so our documentation is not as organized as we would like it to be. You could contribute by organizing it in a better way.) NSS Sample Code A good place to start learning how to write NSS applications are the command line tools that are maintained by the NSS developers. You can find them in subdirectory mozilla/security/nss/cmd Or have a look at some basic NSS sample code. A new set of samples is currently under development and review, see Create new NSS samples. You are welcome to download the samples via: hg clone https://hg.mozilla.org/projects/nss; cd nss; hg update SAMPLES_BRANCH How to Contribute ... (t...
NSS Key Log Format
proach is disabled by default for optimized builds using the Makefile (those using gyp via build.sh are not affected). Distributors can re-enable it at compile time though (using the NSS_ALLOW_SSLKEYLOGFILE=1 make variable) which is done for the official Firefox binaries. (See bug 1188657.) Notably, Debian does not have this option enabled, see Debian bug 842292. This key log file is a series of lines. Comment lines begin with a sharp character ('#') and are ignored. Secrets follow the format <Label> <space> <ClientRandom> <space> <Secret> where: <Label> describes the following secret. <ClientRandom> is 32 bytes Random value from the Client Hello message, encoded as 64 hexadecimal characters. <Secret> depends on the Label (see below). The following labels are defined, followed by a des...
... the hex-encoded exporter secret (for TLS 1.3, used for 1-RTT keys in older QUIC drafts) The RSA form allows ciphersuites using RSA key-agreement to be logged and was the first form supported by Wireshark 1.6.0. It has been superseded by CLIENT_RANDOM which also works with other key-agreement algorithms (such as those based on Diffie-Hellman) and is supported since Wireshark 1.8.0. The TLS 1.3 lines are supported since NSS 3.34 (bug 1287711) and Wireshark 2.4 (EARLY_EXPORTER_SECRET exists since NSS 3.35, bug 1417331). The size of the hex-encoded secret depends on the selected cipher suite. It is 64, 96 or 128 characters for SHA256, SHA384 or SHA512 respectively. For Wireshark usage, see SSL - Wireshark Wiki. ...
NSS_3.12_release_notes.html
following new features: SQLite-Based Shareable Certificate and Key Databases libpkix: an RFC 3280 Compliant Certificate Path Validation Library Camellia cipher support TLS session ticket extension (RFC 5077) NSS 3.12 is tri-licensed under the MPL 1.1/GPL 2.0/LGPL 2.1. Note: Firefox 3 uses NSS 3.12, but not the new SQLite-based shareable certificate and key databases. We missed the deadline to enable that feature in Firefox 3. Distribution Information The CVS tag for the NSS 3.12 release is NSS_3_12_RTM. NSS 3.12 requires NSPR 4.7.1. See the Documentation section for the build instructions. NSS 3.12 source and binary distributions are also available on ftp.mozilla.org for secure HTTPS download: Source tarballs: https://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/NS...
...ll unix-ish platforms Bug 390710: CERTNameConstraintsTemplate is incorrect Bug 416928: DER decode error on this policy extension Bug 375019: Cache-enable pkix_OcspChecker_Check Bug 391454: libPKIX does not honor NSS's override trust flags Bug 403682: CERT_PKIXVerifyCert never succeeds Bug 324744: add generation of policy extensions to certutil Bug 390973: Add long option names to SECU_ParseCommandLine Bug 161326: need API to convert dotted OID format to/from octet representation Bug 376737: CERT_ImportCerts routinely sets VALID_PEER or VALID_CA OVERRIDE trust flags Bug 390381: libpkix rejects cert chain when root CA cert has no basic constraints Bug 391183: rename libPKIX error string number type to pkix error number types Bug 397122: NSS 3.12 alpha treats a key3.db with no global salt as havi...
NSS 3.16.2 release notes
SSL_ERROR_NEXT_PROTOCOL_NO_CALLBACK - An SSL error code that means the next protcol negotiation extension was enabled, but the callback was cleared prior to being needed. SSL_ERROR_NEXT_PROTOCOL_NO_PROTOCOL - An SSL error code that means the server supports no protocols that the client advertises in the ALPN extension. Notable Changes in NSS 3.16.2 The btoa command has a new command-line option -w suffix, which causes the output to be wrapped in BEGIN/END lines with the given suffix. Use "c" as a shorthand for the suffix CERTIFICATE. The certutil commands supports additionals types of subject alt name extensions: --extSAN type:name[,type:name]... The certutil commands supports generic certificate extensions, by loading binary data from files, which have been prepared...
... external tools, or which have been extracted and dumped to file from other existing certificates: --dump-ext-val OID --extGeneric OID:critical-flag:filename[,OID:critical-flag:filename]... The certutil command has three new certificate usage specifiers: L: certificateUsageSSLCA A: certificateUsageAnyCA Y: certificateUsageVerifyCA The pp command has a new command-line option -u, which means "use UTF-8". The default is to show a non-ASCII character as ".". On Linux, NSS is built with the -ffunction-sections -fdata-sections compiler flags and the --gc-sections linker flag to allow unused functions to be discarded. Bugs fixed in NSS 3.16.2 This Bugzilla query returns all the bugs fixed in NSS 3.16.2: https://bugzilla.mozilla.org/buglist.cgi?resolution=FIXED&cla...
NSS 3.46 release notes
ent "resp" directories Bug 1561598 - Remove -Wmaybe-uninitialized warning in pqg.c Bug 1560806 - Increase softoken password max size to 500 characters Bug 1568776 - Output paths relative to repository in NSS coverity Bug 1453408 - modutil -changepw fails in FIPS mode if password is an empty string Bug 1564727 - Use a PSS SPKI when possible for delegated credentials Bug 1493916 - fix ppc64 inline assembler for clang Bug 1561588 - Remove -Wmaybe-uninitialized warning in p7env.c Bug 1561548 - Remove -Wmaybe-uninitialized warning in pkix_pl_ldapdefaultclient.c Bug 1512605 - Incorrect alert description after unencrypted Finished msg Bug 1564715 - Read /proc/cpuinfo when AT_HWCAP2 returns 0 Bug 1532194 - Remove or fix -DDEBUG_$USER from make builds Bug 1565577 - Visual Studio's cl.exe -?
...ilder times out while fetching gpg key Bug 1563786 - Update hacl-star docker image to pull specific commit Bug 1559012 - Improve GCM perfomance using PMULL2 Bug 1528666 - Correct resumption validation checks Bug 1568803 - More tests for client certificate authentication Bug 1564284 - Support profile mobility across Windows and Linux Bug 1573942 - Gtest for pkcs11.txt with different breaking line formats Bug 1575968 - Add strsclnt option to enforce the use of either IPv4 or IPv6 Bug 1549847 - Fix NSS builds on iOS Bug 1485533 - Enable NSS_SSL_TESTS on taskcluster This Bugzilla query returns all the bugs fixed in NSS 3.46: https://bugzilla.mozilla.org/buglist.cgi?resolution=FIXED&classification=Components&query_format=advanced&product=NSS&target_milestone=3.46 Compatibility NSS 3.4...
Overview of NSS
re or transport private keys, certificates, and other secret material. S/MIME (RFC 2311 and RFC 2633). IETF message specification (based on the popular Internet MIME standard) that provides a consistent way to send and receive signed and encrypted MIME data. X.509 v3. ITU standard that governs the format of certificates used for authentication in public-key cryptography. OCSP (RFC 2560). The Online Certificate Status Protocol (OCSP) governs real-time confirmation of certificate validity. PKIX Certificate and CRL Profile (RFC 3280). The first part of the four-part standard under development by the Public-Key Infrastructure (X.509) working group of the IETF (known at PKIX) for a public-key infrastructure for the Internet. RSA, DSA, ECDSA, Diffie-Hellman, EC Diffie-Hellman, AES, Triple DES, ...
...n test cases of invalid input data). Complete Software Development Kit In addition to libraries and APIs, NSS provides security tools required for debugging, diagnostics, certificate and key management, cryptography module management, and other development tasks. NSS comes with an extensive and growing set of documentation, including introductory material, API references, man pages for command-line tools, and sample code. NSS is available as source and shared (dynamic) libraries. Every NSS release is backward compatible with previous releases, allowing NSS users to upgrade to the new NSS shared libraries without recompiling or relinking their applications. Open-Source Licensing and Distribution NSS is available under the Mozilla Public License, version 2. The latest source code is availa...
PKCS #11 Module Specs
Names can be any alpha/numeric combination, and are parsed case-insensitive. ...
... must pass to the pkcs #11 library at C_Initialize() time (see below). In additions applications/libraries should be able to ignore additional name value pairs which are used to specify configuration for other applications. Of course these application/libraries should be able to parse their own name/value pairs. Each of these name/value pairs are optional. If the library is not specified, the line represents some application specific meta configuration data. Other applications and libraries can safely ignore this line. If the name is not specified, the application can use the library path to describe the PKCS #11 library in any UI it may have. If the parameter is not specified, no parameters are passed to the PKCS #11 module. If the application/library does not find its application/libr...
NSS tools : certutil
It can specifically list, generate, modify, or delete certificates, create or change the password, generate new public and private key pairs, display the contents of the key database, or delete key pairs within the key database. ...
...es follow the more common legacy type. Using the SQLite databases must be manually specified by using the sql: prefix with the given security directory. For example: $ certutil -L -d sql:/home/my/sharednssdb To set the shared database type as the default type for the tools, set the NSS_DEFAULT_DB_TYPE environment variable to sql: export NSS_DEFAULT_DB_TYPE="sql" This line can be set added to the ~/.bashrc file to make the change permanent. Most applications do not use the shared database by default, but they can be configured to use them. For example, this how-to article covers how to configure Firefox and Thunderbird to use the new shared NSS databases: * https://wiki.mozilla.org/NSS_Shared_DB_Howto For an engineering draft on th...
NSS tools : crlutil
dify, or delete CRLs within the NSS security database file(s) and list, create, modify or delete certificates entries in a particular CRL. Synopsis crlutil [options] [[arguments]] STATUS This documentation is still work in progress. Please contribute to the initial review in Mozilla NSS bug 836477[1] Description The Certificate Revocation List (CRL) Management Tool, crlutil, is a command-line utility that can list, generate, modify, or delete CRLs within the NSS security database file(s) and list, create, modify or delete certificates entries in a particular CRL. The key and certificate management process generally begins with creating keys in the key database, then generating and managing certificates in the certificate database(see certutil tool) and continues with certificates...
...or new CRL. Bracket the output-file string with quotation marks if it contains spaces. If this argument is not used the output destination defaults to standard output. -t crl-type Specify type of CRL. possible types are: 0 - SEC_KRL_TYPE, 1 - SEC_CRL_TYPE. This option is obsolete -u url Specify the url. CRL Generation script syntax CRL generation script file has the following syntax: * Line with comments should have # as a first symbol of a line * Set "this update" or "next update" CRL fields: update=YYYYMMDDhhmmssZ nextupdate=YYYYMMDDhhmmssZ Field "next update" is optional. Time should be in GeneralizedTime format (YYYYMMDDhhmmssZ). For example: 20050204153000Z * Add an extension to a CRL or a crl certificate entry: addext extension-name critical/non-critical [arg1[arg2 ...]]...
sslfnc.html
Upgraded documentation may be found in the Current NSS Reference SSL Functions Chapter 4 SSL Functions This chapter describes the core SSL functions. ...
...ays to transfer the content of SSL_INHERITANCE from parent to child: The child inherits the parent's environment, which must include the SSL_INHERITANCE variable. For the child to inherit the parent's environment you must set a specific argument to CreateProcess or PR_CreateProcess. The parent transmits the content of SSL_INHERITANCE to the child by some other means, such as on the command line, or in another file or pipe. In either case, the child must call SSL_InheritMPServerSIDCache to complete the inheritance of the shared cache FDs/handles. SSL_ConfigMPServerSIDCache Sets up parameters for and opens the server session cache for a multi-process application. Syntax #include "ssl.h" SECStatus SSL_ConfigMPServerSIDCache( int maxCacheEntries, PRUint32 timeout, ...
NSS Tools crlutil
The key and certificate management process generally begins with creating keys in the key database, then generating and managing certificates in the certificate database(see certutil tool) and continues with certificates expiration or revocation. ...
...ndard output. -t crl-type Specify type of CRL. possible types are: 0 - SEC_KRL_TYPE, 1 - SEC_CRL_TYPE. This option is obsolete -u url Specify the url. CRL Generation script syntax: CRL generation script file has the following syntax: Line with comments should have <bold>#</bold> as a first symbol of a line Set "this update" or "next update" CRL fields: update=YYYYMMDDhhmmssZ nextupdate=YYYYMMDDhhmmssZ Field "next update" is optional. Time should be in GeneralizedTime format (YYYYMMDDhhmmssZ). For example: 20050204153000Z Add an extension to a CRL or a crl certificate entry: addex...
certutil
It can also list, generate, modify, or delete certificates within the database, create or change the password, generate new public and private key pairs, display the contents of the key database, or delete key pairs within the key database. ...
...y databases follow the more common legacy type. Using the SQLite databases must be manually specified by using the sql: prefix with the given security directory. For example: $ certutil -L -d sql:/home/my/sharednssdb To set the shared database type as the default type for the tools, set the NSS_DEFAULT_DB_TYPE environment variable to sql: export NSS_DEFAULT_DB_TYPE="sql" This line can be set added to the ~/.bashrc file to make the change permanent. Most applications do not use the shared database by default, but they can be configured to use them. For example, this how-to article covers how to configure Firefox and Thunderbird to use the new shared NSS databases: o https://wiki.mozilla.org/NSS_Shared_DB_Howto For an engineering draft on the changes i...
NSS tools : crlutil
Mozilla › Projects › NSS › tools › crlutil
Name crlutil -- List, generate, modify, or delete CRLs within the NSS security database file(s) and list, create, modify or delete certificates entries in a particular CRL. Synopsis crlutil [options] arguments Description The Certificate Revocation List (CRL) Management Tool, crlutil, is a command-line utility that can list, generate, modify, or delete CRLs within the NSS security database file(s) and list, create, modify or delete certificates entries in a particular CRL. The key and certificate management process generally begins with creating keys in the key database, then generating and managing certificates in the certificate database(see certutil tool) and continues with certificates expiration or revocation. This document discusses c...
... if it contains spaces. If this argument is not used the output destination defaults to standard output. -t crl-type Specify type of CRL. possible types are: 0 - SEC_KRL_TYPE, 1 - SEC_CRL_TYPE. This option is obsolete -u url Specify the url. CRL Generation script syntax CRL generation script file has the following syntax: * Line with comments should have # as a first symbol of a line * Set "this update" or "next update" CRL fields: update=YYYYMMDDhhmmssZ nextupdate=YYYYMMDDhhmmssZ Field "next update" is optional. Time should be in GeneralizedTime format (YYYYMMDDhhmmssZ). For example: 20050204153000Z * Add an extension to a CRL or a crl certificate entry: addext extension-name critical/non-critical...
NSS tools : signver
Mozilla › Projects › NSS › tools › signver
The Signature Verification Tool can also display the contents of the signed object. ...
...follow the more common legacy type. Using the SQLite databases must be manually specified by using the sql: prefix with the given security directory. For example: # signver -A -s signature -d sql:/home/my/sharednssdb To set the shared database type as the default type for the tools, set the NSS_DEFAULT_DB_TYPE environment variable to sql: export NSS_DEFAULT_DB_TYPE="sql" This line can be set added to the ~/.bashrc file to make the change permanent. Most applications do not use the shared database by default, but they can be configured to use them. For example, this how-to article covers how to configure Firefox and Thunderbird to use the new shared NSS databases: o https://wiki.mozilla.org/NSS_Shared_DB_Howto For an engineering draft on the changes i...
Rhino Examples
The liveConnect.js script shows a sample usage of LiveConnect (Java-to-JavaScript connectivity). The jsdoc.js script is a JavaScript analog to Java's javadoc. It makes heavy use of regular expressions. ...
...f using a JavaAdapter to implement a Java interface using a JavaScript object. The NervousText.js script is a JavaScript implementation of the famous NervousText applet using JavaScript compiled to Java classes using jsc. It can be run in the HTML page NervousText.html. Controlling the JavaScript Engine The RunScript class RunScript.java is a simple program that executes a script from the command line. The Control class Control.java is a program that executes a simple script and then manipulates the result. JavaScript Shell Shell.java is a program that executes JavaScript programs; it is a simplified version of the shell in the tools package. The programs may be specified as files on the command line or by typing interactively while the shell is running. PrimitiveWrapFactory PrimitiveWrapFacto...
SpiderMonkey Build Documentation
aldrdash may fail to compile with /usr/local/Cellar/llvm/7.0.1/lib/clang/7.0.1/include/inttypes.h:30:15: fatal error: 'inttypes.h' file not found /usr/local/Cellar/llvm/7.0.1/lib/clang/7.0.1/include/inttypes.h:30:15: fatal error: 'inttypes.h' file not found, err: true This is because, starting from Mohave, headers are no longer installed in /usr/include. ...
...You can test it with dist/bin/js --help, which displays a help page. At this point, you're ready to run and try out the shell. ...
Invariants
(Here "the global object" refers to the object at the end of the scope chain of the Function object we're executing.) Requests Many functions require a request. That is, they take a parameter cx of type JSContext *, and require that cx is in a request on the current thread. See JS_THREADSAFE. "Are we in a request on cx?", where cx is any variable of type JSContext *, is a static yes for most lines of code where such a variable exists. Occasionally it's a static no; other times we don't care. Almost all JSAPI callbacks provide a request; that is, when we call a callback with a cx argument, we know statically that we must be in a request on cx there. Locks "Are we holding the runtime-wide GC lock?" is a static yes or no for almost every line of code. A general rule about the state of a...
...ither one writer (in GC) or many readers (in requests). No JSNative or other object-related callback ever runs at the same time as a finalizer for that object. Property locks Each thread may have a lock on at most one property at a time. (Nesting them would risk deadlock. JS_SetWatchPoint violates this rule.) Whether a property is locked, and which one, is static information for almost every line of code. The locking scheme is described under JSObjectOps.dropProperty. (Note that the locking scheme applies to all objects and talks about properties being locked. As implemented for native objects, the locking is not really that fine-grained, but that is a transparent optimization as long as we follow the rules.) A thread holding a property lock never leaves or suspends the current request. ...
Property cache
communicate between the interpreter and JIT. Warning: The details below are obsolete. Shape integers do not exist anymore. The property cache still exists, but it is simpler now. SpiderMonkey mainly uses type inference to determine which properties are being accessed; in cases where type inference does not find the exact shape of the object being accessed, SpiderMonkey uses a PIC (polymorphic inline caches) to store the result of the lookup. The property cache is only used in the interpreter. The property cache was introduced in bug 365851. Basics In general, accessing a property of a native object entails: a property lookup; examining the Shape to see how the property can be accessed; actually carrying out the property access. The property cache is a per-thread cache of the resul...
...es exist to support this case. When a property cache entry of this type is created, the scope of the object that contains the property is branded. The "branded scope guarantee" documented above ensures that any changes to function-valued own properties of that object will bump its shape, conservatively invalidating all property cache entries of this type for that object (and JIT code that might inline a call to the function). The JIT uses a fourth kind of PCVal, having pcval.isNull(), internally to indicate that a property lookup missed entirely. But property cache entries are never populated such that .vword.isNull(). To do Treat cache invalidation systematically. Does the global object always have a unique shape? a branded scope? Explain bug 554955. ...
JS::CreateError
This article covers features introduced in SpiderMonkey 38 Create an Error object. Syntax // Added in SpiderMonkey 45 bool JS::CreateError(JSContext *cx, JSExnType type, HandleObject stack, HandleString fileName, uint32_t lineNumber, uint32_t columnNumber, JSErrorReport *report, HandleString message, MutableHandleValue rval); // Obsolete since JSAPI 39 bool JS::CreateError(JSContext *cx, JSExnType type, HandleString stack, HandleString fileName, uint32_t lineNumber, uint32_t columnNumber, JSErrorReport *report, HandleString message, MutableHandleValue rval); Name Type Description cx JSContext * Pointer to a JS context from which to derive runtime information. Requires request. In a JS...
... Pointer to a JS context from which to derive runtime information. Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext. type JSExnType The exception's type. stack JS::HandleString or JS::HandleObject The value of Error.prototype.stack. fileName JS::HandleString The value of Error.prototype.fileName. lineNumber uint32_t The value of Error.prototype.lineNumber. columnNumber uint32_t The value of Error.prototype.columnNumber. report JSErrorReport * A pointer to JSErrorReport instance. message JS::HandleString The value of Error.prototype.message. rval JS::MutableHandleValue Out parameter. Receives the created error object. Desc...
JS_CompileUCFunctionForPrincipalsVersion
This article covers features introduced in SpiderMonkey 1.8.5 Please provide a description for this function. Syntax JSFunction * JS_CompileUCFunctionForPrincipalsVersion(JSContext *cx, JSObject *obj, JSPrincipals *principals, const char *name, unsigned int nargs, const char **argnames, const jschar *chars, size_t length, const char *filename, unsigned int lineno, JSVersion version); Name Type Description cx JSContext * The context. Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext. obj JSObject * principals JSPrincipals * name const char * nargs unsigned int argnames const char ** chars const ...
... Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext. obj JSObject * principals JSPrincipals * name const char * nargs unsigned int argnames const char ** chars const jschar * length size_t filename const char * lineno unsigned int version JSVersion Description Please provide a description. See Also Please provide a description. ...
JS_SetRegExpInput
Set the pending RegExp input. Syntax bool JS_SetRegExpInput(JSContext *cx, JS::HandleObject obj, JS::HandleString input, bool multiline); Name Type Description cx JSContext * The context. Requires request. In a JS_THREADSAFE build, the caller must be in a request on this JSContext. obj JS::HandleObject A pointer to a global object. input JS::HandleString A pointer to the input string. multiline bool true if input is multiline. Description JS_SetRegExpInput sets the pending input string of the built-in RegExp object to the specified input string. The JSREG_MULTILINE is set to multiline parameter, and other flags are all reset. On successful, JS_SetRegExpInput returns true, other...
...s multiline. Description JS_SetRegExpInput sets the pending input string of the built-in RegExp object to the specified input string. The JSREG_MULTILINE is set to multiline parameter, and other flags are all reset. On successful, JS_SetRegExpInput returns true, otherwise returns false. ...
Running Automated JavaScript Tests
specific tests by giving the three names. Or you can run all but selected tests with the --exclude option. Now that the full set of test262 tests is included in the tree, jstests take a long time to complete. 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. Run with the -h option to see all the options. The jstests test suite also includes some tests from web-platform-tests. By default, t...
... the -h option to see all the options. The jstests test suite also includes some tests from web-platform-tests. By default, these are only run when no tests paths are specified; this can be overridden by the --wpt=enabled flag. ...
Redis Tips
s given on the right-hand side of the page. Recipes - At the bottom of many pages is a section that gives usage patterns or recipes for the command under discussion. There are many insightful ideas to be found here. Getting Started with Redis Before you go any further in this document, make sure you have played with redis for at least 5 or 10 minutes. If you have not, here is a fantastic on-line, interactive redis tutorial: http://try.redis.io/ For reference later on, you'll want the source of all things redis: https://redis.io You'll want to run a redis-server on your machine, and use the redis-cli at the command-line for hacking. Node.JS redis client: https://github.com/mranney/node_redis npm install redis Python redis client: https://github.com/andymccurdy/redis-py T...
...plicit host and port like so: > var r = require('redis').createClient(6379, '127.0.0.1') Commands are asynchronous. In standard node fashion, first return value is error or null; second return value is result of redis command. > r.set('foo', 42, console.log) null 'OK' > r.get('foo', console.log) null '42' For the rest of this, I'm going to use the synchronous redis-cli for demonstrations. Lines beginning with redis> are input to the redis-cli. Things are Strings, Mostly As you can see from that last example, the values pointed to by keys are strings or they are nil. Nil values will be given as null in node, not undefined. But some commands only work with numbers (like INCR); for these, if your key can't be parsed as a number, it's an error: redis> set foo pie OK redis> incr fo...
Browser security
A Web PKI x509 certificate primerX.509 (in this document referred as x509) is an ITU standard to describe certificates. ...
... ...
Setting up an update server
y build an "official" MAR yourself. This is a security measure designed to prevent anyone from serving malicious updates. If you want to use a locally-built MAR, the copy of Firefox being updated will need to be built to allow un-signed MARs. See Building Firefox for more information on building Firefox locally. These changes will need to be made in order to use the locally built MAR: Put this line in the mozconfig file in root of the build directory (create it if it does not exist): ac_add_options --disable-verify-mar Several files contain a line that must be uncommented. Open them and find this line: #DEFINES['DISABLE_UPDATER_AUTHENTICODE_CHECK'] = True. Delete the # at the beginning of the line to uncomment it. These are the files that must be changed: toolkit/components/maintenan...
...ve built your own MAR, you can obtain its sha512 checksum by running the following command, which should work in Linux, macOS, or Windows in the MozillaBuild environment: shasum --algorithm 512 <filename> On Windows, you can get the exact file size in bytes for your MAR by right clicking on it in the file explorer and selecting Properties. You'll find the correct size in bytes at the end of the line that begins "Size", not the one that begins "Size on disk". Be sure to remove the commas when you paste this number into the XML file. On macOS, you can get the exact size of your MAR by running the command: stat -f%z <filename> Or on Linux, the same command would be: stat --format "%s" <filename> Starting your update server Now, start an update server to serve the update files on port 8000...
XForms Accessibility
see the spec, the docs). The follwoing representations input element are accessible: text field - see the docs. checkbox - see the docs datepicker - see the docs. calendar - see the docs. days list - see the docs. months list - see the docs. secret Used for inputting passwords (see the spec, the docs). This element is represented by password field. textarea Serves to show/change multiline text (see the spec, the docs). This element is represented by multiline text field. output Serves to show instance data that the element is bound to (see the spec, the docs). It can have the following presentations: text - see the docs. calendar - see the docs. upload Provides a means for the user to select a file (see the spec, the docs). This element is represented by upload. range A...
... hint Similar to a tooltip (see the spec, the docs). The value of hint element is used as description of accessible object. alert This message will be shown when the form control cannot properly bind to instance data or when the instance data value is invalid or out of the specified range of selectable values (see the spec, the docs). The alert element has ROLE_ALERT role for both usual and inline alert elements. message Used in combination with event listeners to display a message to the user when the specified event occurs (see the spec, the docs). The message element has ROLE_ALERT role. Resources Below you will find a list of XForms/Accessiblity resources: Mozilla accessibility project at mozilla.org XForms specification at w3.org Mozilla XForms project at mozilla.org UI XFor...
XML Extras
Available Web Services with SOAP and WSDL No longer available from Gecko 1.9/Firefox 3. XML Persistence FIXptr and XPointer Available since 1.4alpha in the core Mozilla. Moved to XML Extras during 1.4beta. See also: XML in Mozilla document.load() A few examples dealing with XML from MozillaZine Knowledge Base. QA and Testing There are some online tests for mainly exercising the HTTP GET method via XMLHttpRequest. Other test cases for each of the implemented components listed above exist in extensions/xmlextras/tests/. More exhaustive test suites need to be created, however. If you'd like to help out with QA, you can do one of the following: Sign up as the QA owner for any of the implemented components. The QA owner will manage the tes...
...string, and pass the temporary document into send(). XMLHttpRequest.open("aHost") ok file:// documents can access http:// documents but you need to enable UniversalBrowserRead privilege in your scripts - see the JavaScript Security: Signed Scripts document for more details. Normally your files should reside on a webserver so this shouldn't pose a problem (there you do not need that line either). Additionally, "foo.com:80" and "foo.com:313" are considered different hosts for security purposes. You cannot open a connection to a different host. DOMParser Creation not available new DOMParser() XMLSerializer Creation not available new XMLSerializer() Minimal documentation for the components listed above can be found using Mozilla documentation gen...
Creating a Python XPCOM component
component; the procedure is the same for any component, but will not work if Python components weren't enabled. To register the component, touch the .autoreg (a hidden file) in the bin directory, or delete xpti.dat. Then, the next time Mozilla starts, it will rebuild the index of components, including any new one in the 'components' directory. It is helpful to then start Mozilla from the command line to see if new components register successfully. Generating implementation templates The module xpcom.xpt is used internally to process type information, but it has a nice feature - it can spit out a template for a Python implementation of any interface. Just execute this file as a script with the interface name as a param. For example: % cd c:\mozilla\bin\python\xpcom % python xpt.py nsISample cl...
..._contractid_ = "The.Object.Name" def get_value( self ): # Result: string pass def set_value( self, param0 ): # Result: void - None # In: param0: string pass As you can see, the output is valid Python code, with basic signatures and useful comments for each of the methods. Testing it To see this work, you will have to start Firefox from the command line, since that'll be where the stuff will be printed out. External links Creating XPCOM components, on which this short tutorial is based. A three-part tutorial on ibm developerWorks: Getting to know PyXPCOM - info on building PyXPCOM (and maybe Mozilla) to get it to work. Getting started with PyXPCOM, part 2 - accessing xpcom from Python. Getting started with PyXPCOM, pa...
Generating GUIDs
and they're never resolved. Canonical form The common form of a GUID is xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx, where each x stands for a hexadecimal digit. There are a number of tools that can be used to generate a GUID in the canonical form. Note: If you do choose to use an email-style ID for your add-on, you probably don't want it to be a real email address, since it might attract spam. Online tools Generate GUID Online UUID (GUID) Generator on the WEB UUID Generator for Mozilla Code (both IDL and C++.h forms) You can get a GUID from one of the bots (such as botbot, firebot) on #firefox IRC channel by /msging "uuid" to them. Windows Windows users can use the GuidGen tool from Microsoft to obtain a GUID. (This tool is also part of MS Visual C++) Linux Use /usr/bin/uuidgen. Th...
...illa code using nsIUUIDGenerator. See the linked page for details. COM/XPCOM format When #define-ing IIDs and CIDs in Mozilla C++ code, you generally use the following format: // xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx #define NS_...ID \ { 0xXXXXXXXX, 0xXXXX, 0xXXXX, \ { 0xXX, 0xXX, 0xXX, 0xXX, 0xXX, 0xXX, 0xXX, 0xXX } } You can generate code in this format using one of the following tools. Online tools http://mozilla.pettay.fi/cgi-bin/mozuuid.pl guidgen guidgen.exe, part of Microsoft Visual Studio, can generate UUIDs in this format. bash You can put the following into your .bashrc file: uuidgen-c++() { local UUID=$(uuidgen) echo "// $UUID" echo "#define NS__IID \\" echo "{ 0x${UUID:0:8}, 0x${UUID:9:4}, 0x${UUID:14:4}, \\" echo -n " { 0x${UUID:19:2}, 0x${UUID:...
XPCOM changes in Gecko 2.0
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm"); function myComponent() { } myComponent.prototype = { // this must match whatever is in chrome.manifest! classID: Components.ID("{e6b866e3-41b2-4f05-a4d2-3d4bde0f7ef8}"), QueryInterface: XPCOMUtils.generateQI([Components.interfaces.nsIMyComponent]), /* nsIMyComponent implementation goes here */ ... }; // The following line is what XPCOM uses to create components. Each component prototype // must have a .classID which is used to create it. const NSGetFactory = XPCOMUtils.generateNSGetFactory([myComponent]); A component may implement backwards compatibility with Gecko 1.9.2 by dynamically detecting which symbols are exported by XPCOMUtils.jsm and exporting the correct function: /** * XPCOMUtils.generateNSGetFactory ...
...ions observed app-startup because in the past, you needed to load for app-startup in order to be able to register to observe profile-after-change in the first place. As of Gecko 1.9.1, this is no longer the case, however; you can now register for profile-after-change using the Category Manager. See Receiving startup notifications for details. To add a category entry, you must insert the following line to your chrome.manifest: category profile-after-change MyComponent @foobar/mycomponent;1 Important: Formerly, the contract id of the category entry was prefixed with "service," if the component was implemented as a service. This prefix needs to be dropped when migrating to chrome.manifest. Changed category names The XPCOM category manager is used to register certain global helper objects. Becaus...
Building the WebLock UI
owser functionality in Mozilla. In Using XPCOM Components you saw how XPCOM objects are reflected into the interface layer as JavaScript objects. In this chapter, now that we've created the WebLock component and made it available to XPCOM, we create the UI that actually instantiates the WebLock component and uses its methods to control page loading in the browser. In the previous section, we outlined the JavaScript that interacts with the WebLock component. In this section, we are going to create the XUL interface that calls the JavaScript methods when the user interacts with it. The XUL Document The first thing to do is create the actual XUL document in which the user interface for the dialog and the events that initiate interaction with the web locking are defined. At the top of all XUL ...
...In overlays the ordinarily unique id attributes that XUL elements use to distinguish themselves are purposely made redundant with UI in the existing browser with which they should be merged. In this c...
Component Internals
XPCOM Framework When you build a component or module and compile it into a library, it must export a single method named NSGetModule. This NSGetModule function is the entry point for accessing the library. It gets called during registration and unregistration of the component, and when XPCOM wants to discover what interfaces or classes the module/library implements. In this chapter we will outline this entire process. As A Component in the XPCOM Framework illustrates, in addition to the NSGetModule entry point, there are nsIModule and nsIFactory interfaces that control the actual creation of the component, and also the string and XPCOM glue parts, which we'll discuss in some detail in the next section (see XPCOM Glue). These latter supply ease-of-development utilities like smart pointers,...
...tion? In a nutshell, registration is the process that makes XPCOM aware of your component(s). As this section and the next describe, you can register your component explicitly during installation, or with the regxpcom program, or you can use the autoregistration methods in the Service Manager to find and register components in a specified components directory: XPInstall APIs regxpcom command-line tool nsIComponentRegistrar APIs from Service Manager The registration process is fairly involved. This section introduces it in terms of XPCOM initialization, and the next chapter describes what you have to do in your component code to register your component with XPCOM. Once the manifest files are read in, XPCOM checks to see if there are any components that need to be registered. There are...
Setting up the Gecko SDK
nt. The WebLock component needs to link against the appropriate libraries to uses XPCOM Glue. To add these libraries, select the Link tab, then choose the Input category. In this panel, instead of linking to the include subdirectories of the nspr, embedstring, and xpcom directories, add the paths to the bin subdirectories. ...
.../bin/xpidl CXX ?= c++ XPIDLSRCS = \ InterfaceA.idl \ InterfaceB.idl \ $(NULL) CPPSRCS = \ SourceA.cpp \ SourceB.cpp \ $(NULL) CPPFLAGS += -fno-rtti \ -fno-exceptions \ -fshort-wchar \ -fPIC \ $(NULL) # GCC only define which allows us to not have to #include mozilla-config # in every .cpp file. If your not using GCC remove this line and add # #include "mozilla-config.h" to each of your .cpp files. GECKO_CONFIG_INCLUDE = -include mozilla-config.h GECKO_DEFINES = -DMOZILLA_STRICT_API GECKO_INCLUDES = -I$(GECKO_SDK_PATH) \ -I$(GECKO_SDK_PATH)/idl \ -I$(GECKO_SDK_PATH)/include \ -I$(GECKO_SDK_PATH)/xpcom/include \ ...
Using XPCOM Utilities to Make Things Easier
of interfaces NS_DECL_ISUPPORTS Declares methods of nsISupports including mRefCnt NS_INIT_ISUPPORTS Initializes mRefCnt to zero. Must be called in class's constructor NS_GET_IID Returns the IID given the name of an interface. Interface must be generated by XPIDL Using the macros described here, the code for the WebLock component has gone from around 340 lines of code to just under 40. Clearly from a code maintenance point of view, this kind of reduction is outstanding. The entire source file with these macros included appears in weblock2.cpp. 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 S...
...In C++, the string literal "XPCOM", for example, consists of 6 consecutive bytes, where `X' is at byte offset zero and a null character is at byte offset 5. Other kinds of strings like "wide" strings use two bytes to represent each character, and are often used to deal with Unicode strings. The string classes in XPCOM are not just limited to representing a null termina...
Components object
utils.createObjectIn Creates a new object in the scope of the specified object's compartment. May only be called from JavaScript code. utils.evalInSandbox Runs JavaScript code in a sandbox, usually used to run code with restricted privileges. utils.forceGC ...
...s code lastResult result code of most recent XPConnect call manager the global XPCOM component manager results array of known result codes by name returnCode pending result for current call stack current JavaScript call stack utils provides access to several useful features utils.atline Provides access to the value of the atline property in the JavaScript environment. utils.createObjectIn Creates a new object in the scope of the specified object's compartment. May only be called from JavaScript code. utils.evalInSandbox Runs JavaScript code in a sandbox, usually used to run code with restricted privileges. utils.forceGC Forces a garbage collection cycle. utils.get...
Using components
XPConnect works transparently in Mozilla and xpcshell to give you access to XPCOM components. Commonly, we start our scripts like so: var Cc = Components.classes; var Ci = Components.interfaces; If we want to get a hold of a component, we then do something like: var rc = Cc["@mozilla.org/registry;1"]; var rs = rc.getService(Ci.nsIRegistry); See also: xpcshell -- how to get a command line interface to JavaScript More Info As was already stated, it is common to start addon scripts like: var Cc = Components.classes; var Ci = Components.interfaces; There is also another way to start, which is exactly equivalent to the above. var {Cc: classes, Ci: interfaces} = Components; There are many more than just classes and interfaces. var { Cu: utils, Ci: interfaces, Cc: classes,...
...aces] classes=[object nsXPCComponents_Classes] results=[object nsXPCComponents_Results] isSuccessCode=function isSuccessCode() { [native code] } Constructor=[object nsXPCComponents_Constructor] QueryInterface=function QueryInterface() { [native code] } interfacesByID=[object nsXPCComponents_InterfacesByID] classesByID=[object nsXPCComponents_ClassesByID] stack=JS frame :: Scratchpad/4 :: cDump :: line 8 manager=[xpconnect wrapped nsIComponentManager] ID=[object nsXPCComponents_ID] Exception=[object nsXPCComponents_Exception] reportError=function reportError() { [native code] } canCreateWrapper=function canCreateWrapper() { [native code] } canCallMethod=function canCallMethod() { [native code] } canGetProperty=function canGetProperty() { [native code] } canSetProperty=function canSetProperty() ...
HOWTO
test harness does. There should really be a better solution in xpcshell. Using JS modules and non-UI JavaScript chrome files Problem You want to write a JavaScript file, and run it in xpcshell. The file uses JS modules. Maybe it even uses JavaScript files from chrome:// URLs. ...
.../ URLs. E.g., you use: Components.utils.import("resource://app/modules/gloda/log4moz.js"); However, you get (for that particular line, which is the first import): uncaught exception: [Exception... ...
XPCshell Test Manifest Expressions
...
... in bits One of 32, 64, possibly unknown debug - Set to true if this build is a debug build, false otherwise crashreporter - Set to true if this build has crash reporting code enabled, false otherwise. Comments If an expression contains a # (pound/hash) character outside of a string, the character and the rest of the line will be treated as a comment. This is useful as the entire line will generally be reported whenever tests are reported as being skipped, meaning the comment as well as the expression itself will appear in any logs where this is reported. ...
xpcshell
he mozilla build shell(bash). It should be executed under the window command prompt source_directory/obj-xxxxx/dist/bin> xpcshell.exe Using the Latest Version of Javascript At present, xpcshell doesn't use the latest version of JavaScript, so newer language features, such as the let statement introduced in JavaScript 1.7, are not available. To rectify this, run xpcshell with the -v 180 command-line option, which tells xpcshell to use JavaScript 1.8. Example You can input JavaScript, straight to Mozilla. js> 5+7 12 js> print("Hello, world!") Hello, world! js> See also HOWTO for common problems in writing xpcshell scripts, e.g., doing async network calls or using JS modules. Pretty much all Mozilla programs use XPCOM components via XPConnect. Read XPConnect:Using components to get s...
...put JavaScript, straight to Mozilla. js> 5+7 12 js> print("Hello, world!") Hello, world! js> See also HOWTO for common problems in writing xpcshell scripts, e.g., doing async network calls or using JS modules. Pretty much all Mozilla programs use XPCOM components via XPConnect. Read XPConnect:Using components to get started with that. See the XPCShell Reference for information on command line arguments and extension functions. Learn how to write xpcshell-based unit tests. Read XPCShell:Profiling for information on how to profile scripts. ...
inIDOMUtils
ement); 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 ge...
... The node to return the parent of. aShowingAnonymousContent Whether you are interested in the XBL flattened tree. Return value Returns the parent of a node. The parent of a document node is the frame/iframe containing that document. If you have requested anonymous content and the element's parent has an XBL binding then the element containing the insertion point is returned instead. getRuleLine() Returns the line number of the specified CSS style rule in its source file. unsigned long getRuleLine( in nsIDOMCSSStyleRule aRule ); Parameters aRule The style rule to retrieve the line number of. Return value The line number of the style rule; the URL of the rule can be obtained from its parent style sheet object. getRuleColumn() Returns the column number of the specified CSS s...
nsIAccessibleStates
E_READONLY 0x00000040 The object is designated read-only. STATE_HOTTRACKED 0x00000080 The object is hot-tracked by the mouse, which means that its appearance has changed to indicate that the mouse pointer is located over it. Currently unused. STATE_DEFAULT 0x00000100 This state represents the default button in a window. STATE_EXPANDED 0x00000200 Children of this object that have the ROLE_OUTLINEITEM role are displayed. (See nsIAccessibleRole.Constants). STATE_COLLAPSED 0x00000400 Children of this object that have the ROLE_OUTLINEITEM role are hidden. (See nsIAccessibleRole.Constants). STATE_BUSY 0x00000800 The control cannot accept input at this time. STATE_FLOATING 0x00001000 Children "owned" not "contained" by parent. STATE_MARQUEED 0x00002000 The object is scrolling or moving ...
...TATE_DEFUNCT 0x00000002 Object no longer exists. EXT_STATE_SELECTABLE_TEXT 0x00000004 For text which is selectable, object must implement nsIAccessibleText. EXT_STATE_EDITABLE 0x00000008 Implements nsIAccessibleEditableText. EXT_STATE_ACTIVE 0x00000010 This window is currently the active window. EXT_STATE_MODAL 0x00000020 Must do something with control before leaving it. EXT_STATE_MULTI_LINE 0x00000040 Edit control that can take multiple lines. EXT_STATE_HORIZONTAL 0x00000080 Uses horizontal layout. EXT_STATE_OPAQUE 0x00000100 Indicates this object paints every pixel within its rectangular region. EXT_STATE_SINGLE_LINE 0x00000200 This text object can only contain 1 line of text. EXT_STATE_TRANSIENT 0x00000400 EXT_STATE_VERTICAL 0x00000800 Especially used for sliders and s...
nsIApplicationCacheContainer
le This interface is used by objects that can be associated with an application cache. ...
... Inherits from: nsISupports Last changed in Gecko 1.9.1 (Firefox 3.5 / Thunderbird 3.0 / SeaMonkey 2.0) Attributes Attribute Type Description applicationCache nsIApplicationCache The application cache with which the object is associated. See also Offline resources in Firefox nsIApplicationCache nsIApplicationCacheChannel nsIApplicationCacheService nsIApplicationCacheNamespace nsIDOMOfflineResourceList ...
nsIApplicationCacheNamespace
n cache. This can be combined with NAMESPACE_FALLBACK to provide a fallback entry in the data attribute. Methods init() Initializes the namespace. ...
...e namespace. void init( in unsigned long itemType, in ACString namespaceSpec, in ACString data ); Parameters itemType The namespace type. namespaceSpec The namespace's prefix. ...
nsICacheService
66 Introduced Gecko 1.0 Inherits from: nsISupports Last changed in Gecko 2.0 (Firefox 4 / Thunderbird 3.3 / SeaMonkey 2.1) This interface is no longer supported and planned to be removed soon: use nsICacheStorageService instead. At the time of writing there is no documentation for nsICacheStorageService but comments are available in the source. ...
... Return value Returns a new cache session. createTemporaryClientID() Obsolete since Gecko 1.9.2 (Firefox 3.6 / Thunderbird 3.1 / Fennec 1.0)This feature is obsolete. Although it may still work in some browsers, its use is discouraged since it could be removed at any time. Try to avoid using it. This method creates and returns a unique, temporary cache client ID. This is used by the offline cache. The offline cache lets clients accumulate entries in a temporary client and merge them in as a group using nsIOfflineCacheSession.mergeTemporaryClient(). ACString createTemporaryClientID( in nsCacheStoragePolicy storagePolicy ); Parameters storagePolicy The cache storage policy. Return value Returns a newly created unique, temporary cache client ID. Exceptions thrown NS_ERR...
nsICacheSession
(); nsICacheEntryDescriptor openCacheEntry(in ACString key, in nsCacheAccessMode accessRequested, in boolean blockingMode); void doomEntry(in ACString key, in nsICacheListener listener); Attributes Attribute Type Description doomEntriesIfExpired PRBool Expired entries will be doomed or evicted if this attribute is set to true. If false, expired entries will be returned (useful for offline mode and clients, such as HTTP, that can update the valid lifetime of cached content). This attribute defaults to true. Methods asyncOpenCacheEntry() This method gives an asynchronous cache access. Does not block the calling thread. Instead, the listener will be notified when the descriptor is available. void asyncOpenCacheEntry( in ACString key, in nsCacheAccessMode accessRequested, in ...
... writable descriptor will be granted. If blockingMode is set to false, it will return NS_ERROR_CACHE_WAIT_FOR_VALIDATION rather than block when another descriptor has been given WRITE access but hasn't validated the entry yet. Note: If at all possible, you should use asyncOpenCacheEntry() instead of calling openCacheEntry(), in order to avoid blocking on I/O on the calling thread. This will streamline overall application performance. A cache session can only give out one descriptor with WRITE access to a given cache entry at a time. Until the client calls MarkValid on its descriptor, other attempts to open the same cache entry will block. nsICacheEntryDescriptor openCacheEntry( in ACString key, in nsCacheAccessMode accessRequested, in boolean blockingMode ); Parameters key The key for ...
nsIChromeRegistry
Converts a chrome URL into a canonical representation by ensuring that the ...
...package.ext. The extension, ext, is one of: xul For a "content" package. css For a "skin" package. dtd For a "locale" package. nsIURI convertChromeURL( in nsIURI aChromeURL ); Parameters aChromeURL The URL that is to be converted. Return value A new nsIURI object containing the loadable URI for the specified chrome URL. Violates the XPCOM interface guidelines wrappersEnabled() Returns whether XPCNativeWrappers are enabled for the specified URI. boolean wrappersEnabled( in nsIURI aURI ); Parameters aURI The URI for which to determine if XPCNativeWrappers are enabled. Return value true if XPCNativeWrappers are enabled for the specified URI; otherwise false. See also Chrome Registration ...
nsIDOMHTMLTimeRanges
ned long The number of ranges represented by the nsIDOMHTMLTimeRanges object. Read only. Methods end() Returns the time offset to the end of the specified time range. float end( in unsigned long index ); Parameters index The index to the time range whose end time is to be returned. Return value The time at which the specified range ends, in seconds measured from the beginning of the timeline represented by the object. Exceptions thrown INDEX_SIZE_ERR The specified index is not valid. start() Returns the time offset to the start of the specified time range. float start( in unsigned long index ); Parameters index The index to the time range whose start time is to be returned. Return value The time at which the specified range starts, in seconds measured from the beginning of the...
...esented by the object. Exceptions thrown INDEX_SIZE_ERR The specified index is not valid. start() Returns the time offset to the start of the specified time range. float start( in unsigned long index ); Parameters index The index to the time range whose start time is to be returned. Return value The time at which the specified range starts, in seconds measured from the beginning of the timeline represented by the object. Exceptions thrown INDEX_SIZE_ERR The specified index is not valid. ...
nsIDOMWindow
sIDOMWindow2 has been merged into this interface. In Gecko 8.0 nsIDOMStorageWindow and nsIDOMWindowInternal have been merged into this interface. Method overview nsIDOMCSSStyleDeclaration getComputedStyle(in nsIDOMElement elt, [optional] in DOMString pseudoElt); nsISelection getSelection(); void scrollBy(in long xScrollDif, in long yScrollDif); void scrollByLines(in long numLines); void scrollByPages(in long numPages); void scrollTo(in long xScroll, in long yScroll); void sizeToContent(); Attributes Attribute Type Description applicationCache nsIDOMOfflineResourceList Get the application cache object for this window. Read only. Note: Prior to Gecko 7.0 this attribute was part of nsIDOMWindo...
...n(); Parameters None. Return value The nsISelection object for the window. scrollBy() Scrolls the window by a given number of pixels relative to the current scroll position. void scrollBy( in long xScrollDif, in long yScrollDif ); Parameters xScrollDif The number of pixels by which to scroll horizontally. yScrollDif The number of pixels by which to scroll vertically. scrollByLines() Scrolls the window by the specified number of lines. void scrollByLines( in long numLines ); Parameters numLines The number of lines by which to scroll. scrollByPages() Scrolls the window by the specified number of pages. void scrollByPages( in long numPages ); Parameters numPages The number of pages by which to scroll. scrollTo() Scrolls the window to an absolute pixe...
nsIDocShell
void fireUnloadNotification(); Native code only! Obsolete since Gecko 1.8 nsISimpleEnumerator getDocShellEnumerator(in long aItemType, in long aDirection); nsIDOMStorage getSessionStorageForPrincipal(in nsIPrincipal principal, in DOMString documentURI, in bo...
...eAboutBlankContentViewer( in nsIPrincipal aPrincipal ); Parameters aPrincipal The principal to use for the new document. createLoadInfo() Creates a DocShellLoadInfo object that you can manipulate and then pass to loadURI(). void createLoadInfo( out nsIDocShellLoadInfo loadInfo ); Parameters loadInfo The new nsIDocShellLoadInfo object. Violates the XPCOM interface guidelines DetachEditorFromWindow() Disconnects this docshell's editor from its window, and stores the editor data in the open document's session history entry. This should be called only during page transitions. void DetachEditorFromWindow(); Parameters None. finishRestore() Finish firing WebProgressListener notifications and DOM events for restoring a page presentation. This should only be called vi...
nsIEditorIMESupport
ribute Type Description composing boolean whether this editor has active IME transaction. Read only. Methods Native code only!beginComposition Obsolete since Gecko 2.0 (Firefox 4 / Thunderbird 3.3 / SeaMonkey 2.1)This feature is obsolete. Although it may still work in some browsers, its use is discouraged since it could be removed at any time. Try to avoid using it. Handles the start of inline input composition. void beginComposition( in nsTextEventReplyPtr aReply ); Parameters aReply endComposition() Obsolete since Gecko 2.0 (Firefox 4 / Thunderbird 3.3 / SeaMonkey 2.1) Handles the end of inline input composition. void endComposition(); Parameters None. forceCompositionEnd() Force the composition end. void forceCompositionEnd(); Parameters None. Nativ...
...id using it. Get the composition position. void queryComposition( in nsTextEventReplyPtr aReply ); Parameters aReply Native code only!setCompositionString Obsolete since Gecko 2.0 (Firefox 4 / Thunderbird 3.3 / SeaMonkey 2.1)This feature is obsolete. Although it may still work in some browsers, its use is discouraged since it could be removed at any time. Try to avoid using it. Sets the inline input composition string. beginComposition() must be called prior to this. void setCompositionString( in DOMString aCompositionString, in nsIPrivateTextRangeListPtr aTextRange, in nsTextEventReplyPtr aReply ); Parameters aCompositionString aTextRange aReply ...
nsIFeedProgressListener
If the document is a standalone item or entry, the HandleFeedAtFirstEntry() method will not already have been called, and the received nsIFeedEntry will have a null parent value. void handleEntry( in nsIFeedEntry entry, in nsIFeedResult result ); Parameters entry Pointer to an nsIFeedE...
...ar to be an actual feed rather than some other sort of document. void handleStartFeed( in nsIFeedResult result ); Parameters result An nsIFeedResult describing the current state of the feed at the moment parsing begins. reportError() Called by the feed processor when a fatal XML parsing error occurs, or if the document isn't a feed. void reportError( in AString errorText, in long lineNumber, in boolean bozo ); Parameters errorText A short description of the error. lineNumber The line on which the error occurred. bozo The bozo bit will be set if the error was due to a fatal error. See also nsIFeedResultListener Interwiki lin ...
nsIIOService
Observers will be notified of changes to this attribute. Methods allowPort() Checks if a port number i...
... nsIPrincipal aLoadingPrincipal, in nsIPrincipal aTriggeringPrincipal, in uint32_t aSecurityFlags, in uint32_t aContentPolicyType); nsIURI newFileURI(in nsIFile aFile); nsIURI newURI(in AUTF8String aSpec, in string aOriginCharset, in nsIURI aBaseURI); Attributes Attribute Type Description offline boolean Returns true if networking is in "offline" mode. When in offline mode, attempts to access the network will fail (although this does not necessarily correlate with whether there is actually a network available -- that's hard to detect without causing the dialer to come up). Observers will be notified of changes to this attribute. Methods allowPort() Checks if a port number is banned. This involves consulting a list of unsafe port...
nsIInProcessContentFrameMessageManager
Return value The nsIContent object representing the owner's content. See also Content process event handling nsIContentFrameMessageManager ...
...Return value The nsIContent object representing the owner's content. See also Content process event handling nsIContentFrameMessageManager ...
nsIJSID
create a named JSID while the last two cases create an unnamed JSID. An unnamed JSID also results when you implement a function that is passed an nsIIDRef parameter, such as QueryInterface(). Note that for these cases of JSID the specified class or interface must exist and be scriptable. Method overview boolean equals(in nsIJSID other); const nsID* getID(); Violates the XPCOM interface guidelines void initialize(in string idString); string toString(); Attributes Attribute Type Description id nsIDPtr Read only. Native code only! Obsolete since Gecko 1.9 The internal nsID. name string Read only. The name of the JSID, if it was set. number string Read only. The string representation of the internal nsID. valid boolean Read only. Returns true if the JSID has been initialis...
...internal nsID. valid boolean Read only. Returns true if the JSID has been initialised. Methods equals() This method determines if this nsIJSID has the same nsID as another nsIJSID. boolean equals( in nsIJSID other ); Parameters other The other nsIJSID to compare to. Return value true if the nsIJSID's are valid and have the same nsID, otherwise false. Violates the XPCOM interface guidelines getID() const nsID* getID(); Parameters None. Return value A pointer to the internal nsID structure. initialize() Initializes the JSID. void initialize( in string idString ); Parameters idString The number to initialize the JSID, in string format, e.g. {00000000-0000-0000-c000-000000000046}. A JSID can only be initialized once. toString() This methods returns a string representation of...
nsIMsgDBHdr
sage. Setting this property will probably result in an inconsistent database representation, so only internal database code should set this attribute. threadParent nsMsgKey Indicates the parent of this message in its thread. If this is the root of the thread, it will return nsMsgKey_None. messageSize unsigned long Indicates the size of this message in bytes. ...
...sentation, so only internal database code should set this attribute. threadParent nsMsgKey Indicates the parent of this message in its thread. If this is the root of the thread, it will return nsMsgKey_None. messageSize unsigned long Indicates the size of this message in bytes. lineCount unsigned long Indicates the size of the message body in number of lines. statusOffset unsigned long Indicates the offset within the message of the X-Mozilla-Status header. messageOffset unsigned long Indicates the position of the offline copy of an IMAP or news messages within the offline store. offlineMessageSize unsigned long Indicates the size of the offline copy of an IMAP or news message. date PRTime I...
nsITelemetry
data. That is governed by user preference and other mechanisms. histogramSnapshots jsval An object containing a snapshot from all of the currently registered histograms. { name1: {data1}, name2:{data2}...} where data consists of the following properties: min - Minimal bucket size max - Maximum bucket size histogram_type - HISTOGRAM_EXPONENTIAL or HISTOGRAM_LINEAR counts - An array representing the values of buckets in the histogram. ranges - An array with corresponding bucket sizes. sum - Sum of the counts array. static - true for histograms defined in Histograms.json, false for ones defined with newHistogram(). Read only. Constants Histogram Types Constant Value Description HISTOGRAM_EXPONEN...
...the histogram. ranges - An array with corresponding bucket sizes. sum - Sum of the counts array. static - true for histograms defined in Histograms.json, false for ones defined with newHistogram(). Read only. Constants Histogram Types Constant Value Description HISTOGRAM_EXPONENTIAL 0 Buckets increase exponentially. HISTOGRAM_LINEAR 1 Buckets increase linearly. HISTOGRAM_BOOLEAN 2 For storing 0/1 values. HISTOGRAM_FLAG 3 For storing a single value; its count is always == 1. HISTOGRAM_COUNT 4 For storing counter values without bucketing. HISTOGRAM_CATEGORICAL 5 For storing enumerated values by label. Scalar Types Constant Value Descr...
nsIToolkitProfileService
nents.classes["@mozilla.org/toolkit/profile-service;1"] .createInstance(Components.interfaces.nsIToolkitProfileService); Prior to Gecko 1.9.1 only the built-in profile manager was able to access the toolkit profile service. To access the built-in profile manager in versions of Firefox up to 4.0 and Thunderbird up to 3.3 you can launch with the -profilemanager command line flag. Future versions will require the separate Profile Manager application. Warning: This service is synchronous so it is recommended that you use OS.File to find the profile directory via OS.Constants.Path.profileDir. OS.File is available from Gecko 18 (Firefox 18.0 / Thunderbird 18.0 / SeaMonkey 2.15). Method overview nsIToolkitProfile createProfile(in nsILocalFile aRootDir, i...
...Profile The profile that is marked as "Default=1" in the Profiles.ini file. (NOT the profile currently in use.) Not sure what happens if you change this setting but someone said: You can change profiles by setting this attribute's value. This may throw an NS_ERROR_FAILURE (0x80004005) when trying to get the current profile if it's unavailable or if permissions restrict access. startOffline boolean startWithLastProfile boolean Methods createProfile() Creates a new profile. The profile temporary directory will be chosen based on where the profile directory is located. nsIToolkitProfile createProfile( in nsILocalFile aRootDir, in AUTF8String aName ); Parameters aRootDir The profile directory. May be null, in which case a suitable default wil...
nsITreeBoxObject
erface("Components.interfaces.nsITreeBoxObject"); Or simply: let boxobject = tree.treeBoxObject; Method Overview long getFirstVisibleRow(); long getLastVisibleRow(); long getPageLength(); void ensureRowIsVisible(in long index); void ensureCellIsVisible(in long row, in nsITreeColumn col); void scrollToRow(in long index); void scrollByLines(in long numLines); void scrollByPages(in long numPages); void scrollToCell(in long row, in nsITreeColumn col); void scrollToColumn(in nsITreeColumn col); void scrollToHorizontalPosition(in long horizontalPosition); void invalidate(); void invalidateColumn(in nsITreeColumn col); void invalidateRow(in long index); void invalid...
...CellIsVisible() Ensures that a given cell in the tree is visible. void ensureCellIsVisible(in long row, in nsITreeColumn col); Parameters index The index of the row to check col The nsITreeColumn to check scrollToRow() Scrolls such that the row at index is at the top of the visible view. void scrollToRow(in long index); Parameters index The index of the row scrollByLines() Scroll the tree up or down by numLines lines. void scrollByLines(in long numLines); Parameters numlines The number of lines to scroll. Positive values move down in the tree. Prevents scrolling off the end of the tree. scrollByPages() Scroll the tree up or down by numPages pages. A page is considered to be the amount displayed by the tree. This method prevents scrolling off the end ...
nsITreeView
h of the cell. getLevel() The level is an integer value that represents the level of indentation. It is multiplied by the width specified in the ::moz-tree-indentation pseudoelement to compute the exact indentation. long getLevel( in long index ); Parameters index The index of the item. Return value The level of indentation. getParentIndex() Methods used by the tree to draw thread lines in the tree. getParentIndex is used to obtain the index of a parent row. If there is no parent row, getParentIndex returns -1. long getParentIndex( in long rowIndex ); Parameters rowIndex The index of the row whose parent should be found. Return value The row index of the parent row. getProgressMode() The progress mode for a given cell. This method is only called for columns of typ...
... if so, whether an open or closed twisty should be used. boolean isContainerOpen( in long index ); Parameters index The index of the item being asked about. Return value true if the item is an open container. Otherwise false. isEditable() Called to ask the view if the cell contents are editable. A value of true will result in the tree popping up a text field when the user tries to inline edit the cell. boolean isEditable( in long row, in nsITreeColumn col ); Parameters row The row of the cell. col The column of the cell. isSelectable() Called to ask the view if the cell is selectable. This method is only called if the selection type is cell or text. boolean isSelectable( in long row, in nsITreeColumn col ); Parameters row The row of the cell. col The ...
nsMsgFolderFlagType
in which unfinised, unsent messages are saved for later editing. const nsMsgFolderFlagType Drafts = 0x00000400; /// Whether this is the folder in which messages are queued for later delivery. const nsMsgFolderFlagType Queue = 0x00000800; /// Whether this is the primary inbox folder. ...
...er = 0x00200000; /// Whether this is the template folder const nsMsgFolderFlagType Templates = 0x00400000; /// This folder is one of your personal folders that is shared with other users const nsMsgFolderFlagType PersonalShared = 0x00800000; /// This folder is an IMAP \\Noselect folder const nsMsgFolderFlagType ImapNoselect = 0x01000000; /// This folder created offline const nsMsgFolderFlagType CreatedOffline = 0x02000000; /// This imap folder cannot have children :-( const nsMsgFolderFlagType ImapNoinferiors = 0x04000000; /// This folder configured for offline use const nsMsgFolderFlagType Offline = 0x08000000; /// This folder has offline events to play back const nsMsgFolderFlagType OfflineEvents = 0x10000000; /// This folde...
nsMsgSearchScope
Defined in comm-central/ mailnews/ base/ search/ public/ nsMsgSearchCore.idl [scriptable, uuid(6e893e59-af98-4f62-a326-0f00f32147cd)] interface nsMsgSearchScope { const nsMsgSearchScopeValue offlineMail = 0; const nsMsgSearchScopeValue offlineMailFilter = 1; const nsMsgSearchScopeValue onlineMail = 2; const nsMsgSearchScopeValue onlineMailFilter = 3; /// offline news, base table, no body or junk const nsMsgSearchScopeValue localNews = 4; const nsMsgSearchScopeValue news = 5; const nsMsgSearchScopeValue newsEx = 6; const nsMsgSearchScopeValue LDAP = 7; const nsMsgSearchScopeValue LocalAB = 8; const nsMsgSearchScopeValue allSearchableGroups = 9; const nsMsgSearchScopeValue newsFilter = 10; const nsMsgSearchScopeValue LocalABAnd = 11; const nsMsgSearchScopeVa...
... const nsMsgSearchScopeValue newsEx = 6; const nsMsgSearchScopeValue LDAP = 7; const nsMsgSearchScopeValue LocalAB = 8; const nsMsgSearchScopeValue allSearchableGroups = 9; const nsMsgSearchScopeValue newsFilter = 10; const nsMsgSearchScopeValue LocalABAnd = 11; const nsMsgSearchScopeValue LDAPAnd = 12; // IMAP and NEWS, searched using local headers const nsMsgSearchScopeValue onlineManual = 13; /// local news + junk const nsMsgSearchScopeValue localNewsJunk = 14; /// local news + body const nsMsgSearchScopeValue localNewsBody = 15; /// local news + junk + body const nsMsgSearchScopeValue localNewsJunkBody = 16; }; ...
XPCOM Interface Reference
rnsICacheMetaDataVisitornsICacheServicensICacheSessionnsICacheVisitornsICachingChannelnsICancelablensICategoryManagernsIChannelnsIChannelEventSinknsIChannelPolicynsICharsetResolvernsIChromeFrameMessageManagernsIChromeRegistrynsIClassInfonsIClipboardnsIClipboardCommandsnsIClipboardDragDropHookListnsIClipboardDragDropHooksnsIClipboardHelpernsIClipboardOwnernsICollectionnsICommandControllernsICommandLinensICommandLineHandlernsICommandLineRunnernsIComponentManagernsIComponentRegistrarnsICompositionStringSynthesizernsIConsoleListenernsIConsoleMessagensIConsoleServicensIContainerBoxObjectnsIContentFrameMessageManagernsIContentPrefnsIContentPrefCallback2nsIContentPrefObservernsIContentPrefServicensIContentPrefService2nsIContentSecurityPolicynsIContentSniffernsIContentViewnsIContentViewManagernsIConte...
...ErrornsIDOMGeoPositionErrorCallbacknsIDOMGeoPositionOptionsnsIDOMGlobalPropertyInitializernsIDOMHTMLAudioElementnsIDOMHTMLFormElementnsIDOMHTMLMediaElementnsIDOMHTMLSourceElementnsIDOMHTMLTimeRangesnsIDOMJSWindownsIDOMMouseScrollEventnsIDOMMozNetworkStatsnsIDOMMozNetworkStatsDatansIDOMMozNetworkStatsManagernsIDOMMozTouchEventnsIDOMNSHTMLDocumentnsIDOMNavigatorDesktopNotificationnsIDOMNodensIDOMOfflineResourceListnsIDOMOrientationEventnsIDOMParsernsIDOMProgressEventnsIDOMSerializernsIDOMSimpleGestureEventnsIDOMStoragensIDOMStorage2nsIDOMStorageEventObsoletensIDOMStorageItemnsIDOMStorageListnsIDOMStorageManagernsIDOMStorageWindownsIDOMUserDataHandlernsIDOMWindownsIDOMWindow2nsIDOMWindowInternalnsIDOMWindowUtilsnsIDOMXPathEvaluatornsIDOMXPathExceptionnsIDOMXPathExpressionnsIDOMXPathResultnsIDOMXU...
XPCOM Interface Reference by grouping
nt nsIXFormsNSModelElement XMLHttpRequest nsIXMLHttpRequestEventTarget FavIcon nsIFaviconDataCallback nsIFaviconService Frame nsIChromeFrameMessageManager nsIFrameLoader nsIFrameLoaderOwner nsIFrameMessageListener nsIFrameMessageManager Interface nsIJSXMLHttpRequest Jetpack nsIJetpack nsIJetpackService offlineStorage nsIApplicationCache nsIApplicationCacheChannel nsIApplicationCacheContainer nsIApplicationCacheNamespace nsIApplicationCacheService Places nsIAnnotationObserver RSS Feed nsIFeed nsIFeedContainer nsIFeedElementBase nsIFeedEntry nsIFeedGenerator nsIFeedPerson nsIFeedProcessor nsIFeedProgressListener nsIFeedResult ...
...ntion nsIExtensionManager nsIInstallLocation External nsIExternalProtocolService Frame nsIContentFrameMessageManager History nsISHEntry nsISHistory Idle nsIIdleService Internal Command nsICommandLine nsICommandLineHandler nsICommandLineRunner Component nsIComponentManager Preferences nsIContentPrefObserver nsIContentPrefService nsIComponentRegistrar Internationalization nsIBidiKeyboard nsILocale ...
Setting HTTP request headers
So where you see Ci and Cc in this page there used to be Components.interfaces and Components.classes. Please also note that the code itself usually is wrapped inside a exports.main = function() { ... } block. Note that the number of parameter that the observe method takes is important. It takes 3 parameters (as we've shown in the example code above). For the...
...r the "http-on-modify-request" topic, the first parameter (named subject in the code above) will be the nsIHttpChannel. However, it is passed to us as an nsISupports. So we need to change the nsISupports into a nsIHttpChannel which is what the QueryInterface call does. And yes, converting objects from one kind to another is very ugly, and lacks (what is usually called) syntactic sugar. The second line of code in the if block should already be familiar to you. It is the same code we used before, earlier in this article, to add the HTTP request header. The name of this object -- httpRequestObserver -- isn't important. We could have named it anything we liked. Registering After we've created the observer, we need to register it. In our case, we want to register it for the "http-on-modify-request"...
Performance
oz_historyvisit using an index, and will then look up in moz_history using the primary key. Both of these are "good" because they use indices and primary keys, which are fast. sqlite> explain query plan select * from moz_historyvisit where session = 12; 0|0|TABLE moz_historyvisit In this example, you can see that it is not using an index, so this query would be slow. You can download the command line tool from the sqlite download page. Be sure you have a version of the command line tool that is at least as recent as what Mozilla uses. As of April 10, 2006, Mozilla uses sqlite 3.3.4, but the latest precompiled version of the command line tools is not available for all platforms. This will lead to errors that say "database is encrypted" because the tool is not able to recognize the file format.
...qlite works like a memory manager or a file system. When data is deleted, the associated bytes are marked as free but are not removed from the file. This means that the file will not shrink, and some data may still be visible in the file. The way to work around this is to run the VACUUM command to remove this space. Vacuuming is very slow. The vacuum command is essentially the same as the command line sqlite3 olddb .dump | sqlite3 newdb; mv newdb olddb. On some networked drives, vacuuming a 10MB database has been timed at over one minute. Therefore, you should avoid vacuuming whenever possible. Some items in databases are privacy sensitive, such as deleted history items. Users have the expectation that deleting items in their history will remove the traces of that from the database. As a resul...
Getting Started Guide
ying object. That object cannot go away until the owning reference has relinquished its claim. Not all references need to be owning references. In fact, if two objects somehow end up owning each other (even transitively) it becomes difficult for either of those object to be reclaimed without adding some `out-of-band' mechanism for breaking the ownership cycle. The document Some COM Ownership Guidelines provides some hints on when ownership is needed. The following lists are good starting point, but by no means complete. You use an owning reference when you created the object; you got the object from a function that might have created it, e.g., any `getter' function, such as QueryInterface, or CreateInstance. All good getters AddRef the interface pointers they produce, thus providing you w...
...ember variable, where it will simplify setters, and eliminate constructors, destructors, and assignment operators. You should use nsCOMPtr on the stack, where it makes calling QueryInterface almost pleasant, and eliminates the complex logic that falls out of error handling. Where shouldn't I use nsCOMPtrs? Don't use nsCOMPtrs where you don't need an owning reference. See Some COM Ownership Guidelines. nsCOMPtr is designed to be used with XPCOM interfaces, so don't use it with non-interfaces with specific exceptions described below. Don't use nsCOMPtrs in XPCOM interfaces. Don't use them in plain old C code; nsCOMPtrs are, of course, a C++ only construct. Never cast an nsCOMPtr, it's almost guaranteed to leak. nsCOMPtrs for non-interface classes Appropriately formatted answer to come, in th...
Testing Mozilla code
lly allocated memory. More information on how ASan works can be found on the Address Sanitizer wiki. ...
...rity researchers to test C/C++ code with either libFuzzer or afl-fuzz.Measuring Code Coverage on FirefoxCode coverage essentially is about measuring how often certain lines are hit, branches taken or conditions met in a program, given some test that you run on it. There are different types of coverage metrics (see also the Wikipedia entry), but when we speak of code coverage here, we usually mean line and branch coverage. This type of coverage is only concerned with hit counts for lines and branches.The Valgrind Test JobThe Valgrind test job builds the browser and runs it under Valgrind, which can detect various common memory-related errors. This job only runs on Linux64, which is the platform best suited to running Valgrind. ...
Creating a gloda message query
with any attachment, but this is somewhat untested. More constraints can be found in the three js files given further below. From https://developer.mozilla.org/docs/Mozilla/Thunderbird/Thunderbird_extensions/Demo_Addon, Demo3, it seems that the attributeName given in these files is the constraintname to be used (e.g. query.subjectMatches(searchString) for message subject (compare fundattr.js line 145 ). Create a collection from the query Your listener is notified as messages are added to the collection as the database query completes. You may also see new messages show up if new messages are indexed that meet the constraints. let myListener = { /* called when new items are returned by the database query or freshly indexed */ onItemsAdded: function myListener_onItemsAdded(aItems, a...
... In the future, the STEEL layer should provide wrappers to make manipulation clean and fun. Note that this message may return "null" if gloda is unable to locate the underlying message anymore. Attributes provided by fundattr.js: from: A single GlodaIdentity corresponding to the author of the message. to: A list of GlodaIdentity instances corresponding to the email addresses found on the To line of the message. cc: ditto, but cc. involves: A list of all GlodaIdentity instances associated with this message. Effectively, this is the contents of from/to/cc in a single list and with duplicates removed. attachmentTypes: A list of the attachment mime types found on this message. Attributes provided by explattr.js: tags: A list of the nsIMsgTags applied to this message. starred: A bool...
Building a Thunderbird extension 5: XUL
>s ... </statusbar> <statusbar id="status-bar"> is a "merge point" for a XUL overlay. XUL Overlays are a way of attaching other UI widgets to a XUL document at run time. A XUL Overlay is a .xul file that specifies XUL fragments to insert at specific merge points within a "master" document. These fragments can specify widgets to be inserted, removed or modified. In this example you are adding a line to the indented statusbar. Therefore it becomes an item owned by the id called "status-bar". This shows how the Thunderbird architecture allows extensions to modify the user experience without modifying the installation files. This also enables version independence between Thunderbird and Thunderbird extensions. Example XUL Overlay Document Create a new file called myhelloworld.xul within the c...
...ide of Thunderbird's statusbar and display "Date". We have also added a <script> tag that contains a reference to the JavaScript file overlay.js. In the next section you will learn how to use JavaScript to modify your label so that it shows the current date. The overlay.js file will be created in a later section and your add-on will still work if the file is missing. For now you can ignore this line, but remember that this is how you reference a JavaScript file. << PreviousNext >> ...
Creating a Custom Column
eveloping a small extension that will be adding a column that will display the "Reply-To:" field of an email (if it exists, it if often not set). If you are unfamiliar with the setup and creation of an extension please read Building a Thunderbird Extension. Adding A Column By far the easiest part is the physical addition of the column. For this we overlay messenger.xul, by placing the following line in our chrome.manifest file: overlay chrome://messenger/content/messenger.xul chrome://replyto_col/content/replyto_col_overlay.xul Now that our overlay is set up we need to connect a column to the current columns that exist. Looking in messenger.xul reveals that the columns reside inside a tree with the id "threadTree" whose columns (treecols) reside in "threadCols". To attach our column we add...
...interfaces.nsIObserverService); ObserverService.addObserver(CreateDbObserver, "MsgCreateDBView", false); } var CreateDbObserver = { // Components.interfaces.nsIObserver observe: function(aMsgFolder, aTopic, aData) { addCustomColumnHandler(); } } In this example we have a function addCustomColumnHandler() that is called whenever the event is fired. This function is a simple one liner along the lines of: function addCustomColumnHandler() { gDBView.addColumnHandler("colReplyTo", columnHandler); } Wrap Up As you have seen it is quite easy to add your own custom column handler. Most of the dirty tasks (displaying and sorting) are done for you in the background - so that all that's left to you, the Extension developer is to populate the code with your feature. Don't forge...
WebIDL bindings
override on mozilla::dom::MyInterface that just calls through to mozilla::dom::MyInterface_Binding::Wrap. Note that if your C++ type is implementing multiple distinct Web IDL interfaces, you need to choose which mozilla::dom::MyInterface_Binding::Wrap to call here. See AudioContext::WrapObject, for example. Expose whatever methods the interface needs on mozilla::dom::MyInterface. These can be inline, virtual, have any calling convention, and so forth, as long as they have the right argument types and return types. You can see an example of what the function declarations should look like by running mach webidl-example MyInterface. 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 us...
...ented APIs There are two reasons a JS implemented API might throw. The first reason is that some unforeseen condition occurred and the second is that a specification requires an exception to be thrown. When throwing for an unforeseen condition, the exception will be reported to the console, and a sanitized NS_ERROR_UNEXPECTED exception will be thrown to the calling content script, with the file/line of the content code that invoked your API. This will avoid exposing chrome URIs and other implementation details to the content code. When throwing because a specification requires an exception, you need to create the exception from the window your WebIDL object is associated with (the one that was passed to your init method). The binding code will then rethrow that exception to the web page. A...
Zombie compartments
6%) -- style-sets | | | | +--0.29 MB (00.06%) -- pres-shell | | | | +--0.05 MB (00.01%) -- rule-nodes | | | | +--0.04 MB (00.01%) -- style-contexts | | | | +--0.03 MB (00.01%) -- frames | | | | | +--0.02 MB (00.00%) -- sundries | | | | | +--0.01 MB (00.00%) -- nsBlockFrame | | | | +--0.01 MB (00.00%) -- pres-contexts | | | | +--0.01 MB (00.00%) -- line-boxes | | | | +--0.00 MB (00.00%) -- text-runs | | | +--3.78 MB (00.76%) ++ js-compartment(https://www.google.de/?gws_rd=ssl) | | | +--0.51 MB (00.10%) -- style-sheets | | | +--0.33 MB (00.07%) -- dom | | | | +--0.17 MB (00.04%) -- text-nodes | | | | +--0.13 MB (00.03%) -- element-nodes | | | | +--0.02 MB (00.00%) -- other | | | | +--0.01 MB (00.00%) -...
... When are compartments created? Any compartments with the following forms are created by Firefox for its own internal use, and can usually be ignored when looking for zombie compartments. js-compartment([System Principal], 0x7f10f1250000) compartment(atoms) js-compartme...
Working with data
Using arrays of non-pointers If...
...var ptrArrayType = ctypes.char.ptr.array(5); var myArray = ptrArrayType(); var someCFunction = library.declare("someCFunction", ctypes.default_abi, ctypes.void_t, ctypes.char.ptr.array() /*same as ctypes.char.ptr.ptr*/); someCFunction(myArray); Line 1 declares a new array type, capable of containing 5 arrays of pointers to C characters. This might be an array of strings, for example. The next line instantiates an object of that type, creating a new array. Each pointer in the array is initialized to null. Line 4 declares the C function that accepts the array as an input, and the last line calls that function. Using arrays of non-pointers If a function expects an argument that is a pointer to a list of elements, this is how it is accomplished: var myArrayType = ctypes.char.array(5); var m...
URLs - Plugins
L(NPP instance, const char *url, const char *target, uint32 len, const char *buf, NPBool file); The instance, url, and target parameters have the same definitions as those of NPN_GetURL. The buf parameter identifies a local temporary file or data buffer that contains the data to post. Windows and Mac If a file is posted with any protocol other than FTP, the file must be text with Unix-style line breaks ('\n' separators only). NPN_PostURL works identically with buffers and files. To post data from a memory buffer, set the flag file to false, the buffer buf to the data to post, and len to the length of the buffer. Possible URL types include http (similar to an HTML form submission), mailto (sending mail), news (posting a news article), and ftp (uploading a file). For protocols in which t...
... flag file to false, the buffer buf to the data to post, and len to the length of the buffer. Possible URL types include http (similar to an HTML form submission), mailto (sending mail), news (posting a news article), and ftp (uploading a file). For protocols in which the headers must be distinguished from the body, such as http, the buffer or file should contain the headers, followed by a blank line, then the body. If no custom headers are required, simply add a blank line ('\n') to the beginning of the file or buffer. NOTE: You cannot use NPN_PostURL to specify headers (even a blank line) in a memory buffer. To do this, use NPN_PostURLNotify for this purpose. ? The NPN_PostURLNotify function has all the same capabilities and works like NPN_PostURL in most ways except that (1) it supports s...
Breaking on exceptions - Firefox Developer Tools
A tooltip describes the exception. Starting in Firefox 80, a disclosure triangle within the tooltip reveals a stack trace. ...
...A tooltip describes the exception. Starting in Firefox 80, a disclosure triangle within the tooltip reveals a stack trace. ...
Use watchpoints - Firefox Developer Tools
When debugging JavaScript code, it can be useful to know when properties on objects are read or modified. In a large, complex codebase, it's not always easy to know where in the code a given property is accessed. In the Firefox Debugger, this information can be provided by watchpoints. By setting a watchpoint on the property, rather than a breakpoint at a particular line, you can discover where that access occurs. There are three types of watchpoints: get, set, and get or set. A get watchpoint pauses whenever a property is read; a set watchpoint pauses whenever a property value changes; a get or set watchpoint pauses whenever a property value is accessed in either way. Set a watchpoint Run and then pause the debugger. In the Scopes pane on the right side of the Debugger user int...
... A watchpoint icon appears to the right of the property in the Scopes pane. Set watchpoint icons are blue, get watchpoint icons are reddish, and get or set watchpoint icons are dark yellow. Click Play or press F8 to resume execution. View a watchpoint When the watched property is accessed in the way specified by the watchpoint type (get or set), the debugger pauses, enabling you to see line of code responsible, and to inspect anything else you wish at that time. In the following screenshot, the debugger pauses at line 7, where obj.a is set. The message panel in the upper right corner indicates that the debugger is "Paused on property set". Delete a watchpoint Locate the watched property in the Scopes pane. Click the watchpoint icon, or right-click and choose Remove watchpoin...
Debugger keyboard shortcuts - Firefox Developer Tools
By default, on some Macs, the function key is remapped to use a special feature: for example, to change the screen brightness or the volume. See this guide to using these keys as standard function keys. To use a remapped key ...
... P Cmd + P Ctrl + P Resume execution when at a breakpoint F8 F8 1 F8 Step over F10 F10 1 F10 Step into F11 F11 1 F11 Step out Shift + F11 Shift + F11 1 Shift + F11 Toggle breakpoint on the currently selected line Ctrl + B Cmd + B Ctrl + B Toggle conditional breakpoint on the currently selected line Ctrl + Shift + B Cmd + Shift + B Ctrl + Shift + B 1. By default, on some Macs, the function key is remapped to use a special feature: for example, to change the screen brightness or the volume. See this guide to using these keys as standard function keys. To use a remapped key as a standard function key, hold the Function key down as well (so to open the Profiler, use Shift + Func...
Set a logpoint - Firefox Developer Tools
log() statements throughout your code, you can use a special type of breakpoint, the logpoint. Logpoints print a message to the Console panel instead of pausing code execution. The logpoint is especially useful in cases where breaking the execution breaks testing procedures, such as when you are debugging popup windows, or executing focus-related logic. To create a logpoint: Right click on a line number in the Debugger panel and pick Add log action from the context menu. Create an expression inline. The result is logged in the console panel every time the line with the logpoint executes. You can use any variable or function available in the current scope. Working with logpoints When you set a logpoint, the indicator is purple, rather than the blue of an unconditional breakpoint...
... view the list of logpoints in the Breakpoints side panel. When execution hits a logpoint, the message you have defined is logged to the console. You can make it easier to see the message by opening a split console under the debugger. (Either press Esc or select the elipsis menu (...) and then click Show Split Console.) When should you use logpoints? When you want to know that a specific line in your code has executed, but you don't want to break code execution, set a logpoint. Logpoints are useful to log the value of a variable at a specific point in the code. It's faster than changing the underlying source code itself to add calls to the console.log method. If you need to execute additional logic related to the source code and you can't change the source code itself, you can use a...
Set event listener breakpoints - Firefox Developer Tools
hen event listeners are hit, check the boxes next the events you are interested in. All of the standard events supported in your version of Firefox are listed, arranged by which API or API area they're part of. Now when a keydown, keyup, keypress, or input event occurs, execution will pause as soon as it enters the listener code. When execution pauses, the source pane displays the highlighted line of the JavaScript code that is next to be executed, along with the surrounding code for context. In addition, you get a box overlaid on the viewport saying "Paused on event breakpoint", with buttons to step over that line of code or resume execution. You could add regular breakpoints at the entry point of the listener to achieve the same effect. If however you have multiple elements, all of whic...
...ather than where in jQuery the event was fired: Filter by event type Also added to Firefox 71 is a new Filter by event type... text input, which can also be found at the top of the Event Listener Breakpoints list. When you click in this input and type a search term, the list of event listener types will filter by that term allowing you to find the events you want to break on more easily. Inline variable preview New in Firefox 71, the source pane now gives you an instant preview of the variables on each line of code you've stepped through. See Set a breakpoint > Inline variable preview for more information. ...
Using the Debugger map scopes feature - Firefox Developer Tools
rom the generated scopes (e.g., a bundle file with all concatenated module files). Let's take a look at how this works. If you want to follow along, use this example. Open the example page and then open the debugger using Tools > Web Developer > Debugger (or press Ctrl + I and then select the debugger). Select the "bundle.js" file in the Sources panel on the left and then set a breakpoint at line 102 in the increment function. When you click the increment button on the page and hit the breakpoint, an additional section is added to the right-hand panel below the Call stack to display variables mapped from the original scope, like this: As useful as this is, it would be even nicer if you could view the original code (before it was packages into the "bundle.js" file. Right-click on t...
...he original code (before it was packages into the "bundle.js" file. Right-click on the source code and the context menu now includes an option to Jump to original location as shown below. Click Jump to original location. The debugger opens the file "increment.js" so you can view the original code. Notice that your breakpoint is set here in the original code as it was in the corresponding line in the "bundle.js" file. And, since Map has been checked in the Scopes panel, you also see variable symbols from the original code. Using this feature is expensive in terms of resources, but it certainly makes your life easier when you have to debug source code that has been packaged webpack or a similar tool. ...
Debugger.Frame - Firefox Developer Tools
rame running code at the top level of a module. "wasmcall": a frame running a WebAssembly function call. "debugger": a frame for a call to user code invoked by the debugger (see the eval method below). implementation A string describing which tier of the JavaScript engine this frame is executing in: "interpreter": a frame running in the interpreter. "baseline": a frame running in the unoptimizing, baseline JIT. "ion": a frame running in the optimizing JIT. "wasm": a frame running in WebAssembly baseline JIT. this The value of this for this frame (a debuggee value). For a wasmcall frame, this property throws a TypeError. older The next-older visible frame, in which control will resume when this frame completes. If there is no...
...derMonkey from extending this frame's environment as requested, this call throws an Error exception. If given,options should be an object whose properties specify details of how the evaluation should occur. The eval method recognizes the following properties: url The filename or URL to which we should attributecode. If this property is omitted, the URL defaults to "debugger eval code". lineNumber The line number at which the evaluated code should be claimed to begin withinurl. evalWithBindings(code,bindings, [options]) Like eval, but evaluatecode in the environment of this frame, extended with bindings from the objectbindings. For each own enumerable property ofbindings namedname whose value isvalue, include a variable in the environment in whichcode is evaluated namedname...
Debugger.Object - Firefox Developer Tools
a function that is debuggee code, a Debugger.Environment instance representing the lexical environment enclosing the function when it was created. If the referent is a function proxy or not debuggee code, this is undefined. errorMessageName If the referent is an error created with an engine internal message template this is a string which is the name of the template; undefined otherwise. errorLineNumber If the referent is an Error object, this is the line number at which the referent was created; undefined otherwise. errorColumnNumber If the referent is an Error object, this is the column number at which the referent was created; undefined otherwise. isBoundFunction If the referent is a debuggee function, returns true if the referent is a bound function; false otherwise. If the refere...
..., the call d.makeDebuggeeValue(o) returns a Debugger.Object instance that presentso as it would be seen by code ind's compartment. decompile([pretty]) If the referent is a function that is debuggee code, return the JavaScript source code for a function definition equivalent to the referent function in its effect and result, as a string. Ifpretty is present and true, produce indented code with line breaks. If the referent is not a function that is debuggee code, return undefined. call(this,argument, ...) If the referent is callable, call it with the giventhis value andargument values, and return a completion value describing how the call completed.This should be a debuggee value, or { asConstructor: true } to invoke the referent as a constructor, in which case SpiderMonkey provides an app...
Edit CSS filters - Firefox Developer Tools
You can also add new effects by selecting an effect from the dropdown list at the bottom of the dialog. Once you have selected the effect you want to add, click the plus sign (+) to the right of the dropdown list. ...
... You can also add new effects by selecting an effect from the dropdown list at the bottom of the dialog. Once you have selected the effect you want to add, click the plus sign (+) to the right of the dropdown list. ...
Examine Event Listeners - Firefox Developer Tools
Firefox can display: standard DOM events jQuery events React eve...
...: 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. Firefox can display: standard DOM events jQuery events React events ...
Animation inspector example: CSS transitions - Firefox Developer Tools
efox-logo-animation Example animation using CSS transitions. ...
... margin: 0.5em; box-shadow: 1px 1px 5px #808080; margin: 1.5em; } .channel > * { vertical-align: middle; line-height: normal; } .icon { width: 50px; height: 50px; filter: grayscale(100%); transition: transform 750ms ease-in, filter 750ms ease-in-out; } .note { margin-left: 1em; font: 1.5em "Open Sans",Arial,sans-serif; overflow: hidden; white-space: nowrap; display: inline-block; opacity: 0; width: 0; transition: opacity 500ms 150ms, width 500ms 150ms; } .icon#selected { filter: grayscale(0%); transform: scale(1.5); } .icon#selected+span { opacity: 1; width: 300px; } JavaScript Content function toggleSelection(e) { if (e.button != 0) { return; } if (e.target.classList.contains("icon")) { var wasSelected = (e.target.getAttribute("id...
Animation inspector example: Web Animations API - Firefox Developer Tools
x-logo-animation Example animation using the Web Animations API. ...
... Edition</span> </div> CSS Content .channel { padding: 2em; margin: 0.5em; box-shadow: 1px 1px 5px #808080; margin: 1.5em; } .channel > * { vertical-align: middle; line-height: normal; } #icon { width: 50px; height: 50px; filter: grayscale(100%); } #note { margin-left: 1em; font: 1.5em "Open Sans",Arial,sans-serif; overflow: hidden; white-space: nowrap; display: inline-block; opacity: 0; width: 0; } JavaScript Content var iconKeyframeSet = [ { transform: 'scale(1)', filter: 'grayscale(100%)'}, { filter: 'grayscale(100%)', offset: 0.333}, { transform: 'scale(1.5)', offset: 0.666 }, { transform: 'scale(1.5)', filter: 'grayscale(0%)'} ]; var noteKeyframeSet = [ { opacity: '0', width: '0'}, { opacity: '1', width: '300px'} ]; var iconKeyframeOp...
Intensive JavaScript - Firefox Developer Tools
ich tells us what kinds of operations the browser is doing during the recording. The pink says that we are mostly performing CSS calculations and possibly reflow: this is the CSS animation that's running throughout the profile. Then there are three solid blocks of orange, representing JavaScript execution, one for each time we pressed the button. The bottom half, which is correlated with the timeline summary in time, shows frame rate. We can see that frame rate is pretty healthy for most of the recording, but collapses completely whenever we press the button. We can select one of these periods and have a closer look at it in the main Waterfall view: Here, when we pressed the button, the browser ran a JavaScript function, or series of functions, that blocked the main thread for 71.73ms, or...
...he button, the browser ran a JavaScript function, or series of functions, that blocked the main thread for 71.73ms, or more than four times our frame budget. Which function, though? By switching to the Flame Chart view we can find out: This shows us the JS call stack at this point in the execution. At the top of the stack is a function called calculatePrimes(), and we can see its filename and line number. Here's the code, together with its immediate caller: const iterations = 50; const multiplier = 1000000000; function calculatePrimes(iterations, multiplier) { var primes = []; for (var i = 0; i < iterations; i++) { var candidate = i * (multiplier * Math.random()); var isPrime = true; for (var c = 2; c <= Math.sqrt(candidate); ++c) { if (candidate % c === 0) { ...
Settings - Firefox Developer Tools
f the Developer Tools. You can choose between the default setting at the bottom of the windows, or move the tools to the left or right side of the screen. These settings are particularly useful if you have a widescreen monitor. You can also choose to open the tools in a separate window. Show split console adds a section at the bottom of the tools showing the console. It makes visible the command line and one or two lines of the console output. The rest of the settings are on the Developer Tools Settings Pane. To see the settings, open any of the Developer Tools, and then: click the "Settings" command in the menu: or press F1 to toggle between the active tool and the Settings pane The Settings pane looks something like this: Categories Default Firefox Developer Tools This group o...
...l still be saved to your Downloads directory). New in Firefox 53. Play camera shutter sound When you click the icon for the Screenshot tool, play a shutter sound. New in Firefox 53. Editor Preferences Preferences for the CodeMirror source editor, which is included in Firefox and used by several developer tools, including Scratchpad and the Style Editor. Detect indentation Auto-indent new lines based on the current indentation. Autoclose brackets Determines whether typing an opening character like [ or { will cause the editor to insert the matching closing character ] or } for you. Indent using spaces When checked, indentation will be performed using spaces, when off, the editor will use tabs instead. Tab size The frequency of tab stops in the editor. Select 2, 4, or 8. Keybindi...
Shader Editor - Firefox Developer Tools
oon be removed from Firefox. For details, see Deprecated tools. The Shader Editor enables you to see and edit the vertex and fragment shaders used by WebGL. WebGL is a JavaScript API for rendering interactive 3D graphics and 2D graphics in the browser without using plugins. With WebGL you provide 2 programs called shaders which are called at the appropriate stages of the OpenGL rendering pipeline: a vertex shader, which computes the clip space coordinates of each vertex to be drawn, and a fragment shader, which determines the color for each pixel to be drawn. These shaders are written in OpenGL Shading Language, or GLSL. In WebGL they can be included in a page in several ways: as text hardcoded in JavaScript strings, as separate files included using <script> tags, or retrieved from the...
...them. ...
Web Console UI Tour - Firefox Developer Tools
enabled, the JavaScript interpreter attempts to autocomplete while you type. Instant Evaluation: When enabled, the interpreter displays the evaluated results of an expression, when possible, before you press Enter to submit it. Message display pane This is where the messages appear, both those generated by the code in the page, and those generated by the commands entered on the command line. See Console messages for a lot more detail on what the messages can contain. Note: You can clear the contents of the console by entering the keyboard command Ctrl + Shift + L (Windows, macOS, and Linux) or Cmd + K on macOS. Command line The command line starts with double angle brackets (>>). Use it to enter JavaScript expressions. In Firefox 71 onwards, there is a new "split pane" icon o...
...e detail on what the messages can contain. Note: You can clear the contents of the console by entering the keyboard command Ctrl + Shift + L (Windows, macOS, and Linux) or Cmd + K on macOS. Command line The command line starts with double angle brackets (>>). Use it to enter JavaScript expressions. In Firefox 71 onwards, there is a new "split pane" icon on the right hand side of the command line -- clicking this will open the new console multi-line mode. ...
AnalyserNode.getByteFrequencyData() - Web APIs
The getByteFrequencyData() method of the AnalyserNode interface copies the current frequency data into a Uint8Array (unsigned byte array) passed into it. The frequency data is composed of integers on a scale from 0 to 255. Each item in the array represents the decibel value for a specific frequency. The frequencies are spread linearly from 0 to 1/2 of the sample rate. For example, for 48000 sample rate, the last item of the array will represent the decibel value for 24000 Hz. If the array has fewer elements than the AnalyserNode.frequencyBinCount, excess elements are dropped. If it has more elements than needed, excess elements are ignored. Syntax var audioCtx = new AudioContext(); var analyser = audioCtx.createAnalyser(); var dataArray = new Uint8Array(analyser.frequencyBinCount); // Ui...
...lements than needed, excess elements are ignored. Return value None. 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. For more examples/information, check out our Voice-change-O-matic demo (see app.js lines 128-205 for relevant code). var audioCtx = new (window.AudioContext || window.webkitAudioContext)(); var analyser = audioCtx.createAnalyser(); ... analyser.fftSize = 256; var bufferLength = analyser.frequencyBinCount; console.log(bufferLength); var dataArray = new Uint8Array(bufferLength); canvasCtx.clearRect(0, 0, WIDTH, HEIGHT); function draw() { drawVisual = requestAnimationFrame(dra...
AnalyserNode.getByteTimeDomainData() - Web APIs
excess elements are ignored. 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. For more complete applied examples/information, check out our Voice-change-O-matic demo (see app.js lines 128-205 for relevant code). const audioCtx = new (window.AudioContext || window.webkitAudioContext)(); const analyser = audioCtx.createAnalyser(); ... analyser.fftSize = 2048; const bufferLength = analyser.fftSize; const dataArray = new Uint8Array(bufferLength); analyser.getByteTimeDomainData(dataArray); // draw an oscilloscope of the current audio source function draw() { drawVisual = r...
... 2048; const bufferLength = analyser.fftSize; const dataArray = new Uint8Array(bufferLength); analyser.getByteTimeDomainData(dataArray); // draw an oscilloscope of the current audio source function draw() { drawVisual = requestAnimationFrame(draw); analyser.getByteTimeDomainData(dataArray); canvasCtx.fillStyle = 'rgb(200, 200, 200)'; canvasCtx.fillRect(0, 0, WIDTH, HEIGHT); canvasCtx.lineWidth = 2; canvasCtx.strokeStyle = 'rgb(0, 0, 0)'; const sliceWidth = WIDTH * 1.0 / bufferLength; let x = 0; canvasCtx.beginPath(); for(var i = 0; i < bufferLength; i++) { const v = dataArray[i]/128.0; const y = v * HEIGHT/2; if(i === 0) canvasCtx.moveTo(x, y); else canvasCtx.lineTo(x, y); x += sliceWidth; } canvasCtx.lineTo(WIDTH, HEIGHT/2); ca...
AnalyserNode.getFloatTimeDomainData() - Web APIs
... ...
...rgb(200, 200, 200)'; canvasCtx.fillRect(0, 0, WIDTH, HEIGHT); canvasCtx.lineWidth = 2; canvasCtx.strokeStyle = 'rgb(0, 0, 0)'; canvasCtx.beginPath(); var sliceWidth = WIDTH * 1.0 / bufferLength; var x = 0; for(var i = 0; i < bufferLength; i++) { var v = dataArray[i] * 200.0; var y = HEIGHT/2 + v; if(i === 0) { canvasCtx.moveTo(x, y); } else { canvasCtx.lineTo(x, y); } x += sliceWidth; } canvasCtx.lineTo(canvas.width, canvas.height/2); canvasCtx.stroke(); }; draw(); Parameters array The Float32Array that the time domain data will be copied to. Specifications Specification Status Comment Web Audio APIThe definition of 'getFloatTimeDomainData()' in that specification. Working Draft ...
AudioDestinationNode - Web APIs
AudioDestinationNode has no output (as it is the output, no more AudioNode can be linked after it in the audio graph) and one input. The number of channels in the input must be between 0 and the maxChannelCount value or an exception is raised. ...
...n unsigned long defining the maximum number of channels that the physical device can handle. Methods No specific method; inherits methods from its parent, AudioNode. Example There is no complex set up for using an AudioDestinationNode -- by default, this simply represents the output of the user's system (e.g. their speakers), so you can get it hooked up inside an audio graph using only a few lines of code: var audioCtx = new AudioContext(); var source = audioCtx.createMediaElementSource(myMediaElement); source.connect(gainNode); gainNode.connect(audioCtx.destination); To see a more complete implementation, check out one of our MDN Web Audio examples, such as Voice-change-o-matic or Violent Theremin. Specifications Specification Status Comment Web Audio APIThe d...
BasicCardResponse - Web APIs
To change preferences in Firefox, visit about:config.IE No support NoOpera No support NoSafari ? WebView Android No support ...
...To change preferences in Firefox, visit about:config.Opera Android No support NoSafari iOS ? Samsung Internet Android Full support 7.0billingAddress...
CSS.registerProperty() - Web APIs
lor>', inherits: false, initialValue: '#c0ffee', }); In this example, the custom property --my-color has been registered using the syntax <color> . We can now use that property to transition a gradient on hover or focus. ...
...cus. ...
Cache.match() - Web APIs
Web › API › Cache › match
e. Return value A Promise that resolves to the first Response that matches the request or to undefined if no match is found. Note: Cache.match() is basically identical to Cache.matchAll(), except that rather than resolving with an array of all matching responses, it resolves with the first matching response only (that is, response[0]). Examples This example is taken from the custom offline page example (live demo). It uses a cache to supply selected data when a request fails. A catch() clause is triggered when the call to fetch() throws an exception. Inside the catch() clause, match() is used to return the correct response. In this example, only HTML documents retrieved with the GET HTTP verb will be cached. If our if() condition is false, then this fetch handler won't intercept t...
...(event) { // We only want to call event.respondWith() if this is a GET request for an HTML document. if (event.request.method === 'GET' && event.request.headers.get('accept').indexOf('text/html') !== -1) { console.log('Handling fetch event for', event.request.url); event.respondWith( fetch(event.request).catch(function(e) { console.error('Fetch failed; returning offline page instead.', e); return caches.open(OFFLINE_CACHE).then(function(cache) { return cache.match(OFFLINE_URL); }); }) ); } }); Specifications Specification Status Comment Service WorkersThe definition of 'Cache match' in that specification. Working Draft Initial definition. ...
CanvasRenderingContext2D.addHitRegion() - Web APIs
Using the addHitRegion method This example demonstrates the addHitRegion() method. HTML <canvas id="canvas"></canvas> JavaScript const canvas = document.getElementById('canvas'); const ctx = canvas.getContext('2d'); canvas.addEventListener('mousemove', function(event) { if(event.region) { alert('ouch, my eye :('); } }); ctx.beginPath(); ctx.arc(100, 100, 75, 0, 2 * Math.PI); ctx.lineWidth = 5; ctx.stroke(); // Eyes ctx.beginPath(); ctx.arc(70, 80, 10, 0, 2 * Math.PI); ctx.arc(130, 80, 10, 0, 2 * Math.PI); ctx.fill(); ctx.addHitRegion({id: "eyes"}); // Mouth ctx.beginPath(); ctx.arc(100, 110, 50, 0, Math.PI); ctx.stroke(); Edit the code below to see your changes update live in the canvas. (If you don't see the full smiley, check the browser compatibility table to see if yo...
...ht need to activate a preference.) Playable code <canvas id="canvas" width="400" height="200" class="playable-canvas"></canvas> <div class="playable-buttons"> <input id="edit" type="button" value="Edit" /> <input id="reset" type="button" value="Reset" /> </div> <textarea id="code" class="playable-code" style="height:250px"> ctx.beginPath(); ctx.arc(100, 100, 75, 0, 2 * Math.PI, false); ctx.lineWidth = 5; ctx.stroke(); // eyes ctx.beginPath(); ctx.arc(70, 80, 10, 0, 2 * Math.PI, false); ctx.arc(130, 80, 10, 0, 2 * Math.PI, false); ctx.fill(); ctx.addHitRegion({id: "eyes"}); // mouth ctx.beginPath(); ctx.arc(100, 110, 50, 0, Math.PI, false); ctx.stroke();</textarea> var canvas = document.getElementById("canvas"); var ctx = canvas.getContext("2d"); var textarea = document.getElementByI...
CanvasRenderingContext2D.fill() - Web APIs
dd winding rule. path A Path2D path to fill. Examples Filling a rectangle This example fills a rectangle with the fill() method. HTML <canvas id="canvas"></canvas> JavaScript const canvas = document.getElementById('canvas'); const ctx = canvas.getContext('2d'); ctx.rect(10, 10, 150, 100); ctx.fill(); Result Specifying a path and a fillRule This example saves some intersecting lines to a Path2D object. The fill() method is then used to render the object to the canvas. A hole is left unfilled in the object's center by using the "evenodd" rule; by default (with the "nonzero" rule), the hole would also be filled. HTML <canvas id="canvas"></canvas> JavaScript const canvas = document.getElementById('canvas'); const ctx = canvas.getContext('2d'); // Create path let region =...
...en used to render the object to the canvas. A hole is left unfilled in the object's center by using the "evenodd" rule; by default (with the "nonzero" rule), the hole would also be filled. HTML <canvas id="canvas"></canvas> JavaScript const canvas = document.getElementById('canvas'); const ctx = canvas.getContext('2d'); // Create path let region = new Path2D(); region.moveTo(30, 90); region.lineTo(110, 20); region.lineTo(240, 130); region.lineTo(60, 130); region.lineTo(190, 20); region.lineTo(270, 90); region.closePath(); // Fill path ctx.fillStyle = 'green'; ctx.fill(region, 'evenodd'); Result Specifications Specification Status Comment HTML Living StandardThe definition of 'CanvasRenderingContext2D.fill' in that specification. Living Standard ...
CanvasRenderingContext2D.miterLimit - Web APIs
e the chapter Applying styles and color in the Canvas tutorial for more information. ...
...ng styles and color in the Canvas tutorial for more information. ...
CanvasRenderingContext2D.shadowColor - Web APIs
e shadows' color, while shadowOffsetX and shadowOffsetY set their position relative to the shapes. HTML <canvas id="canvas"></canvas> JavaScript const canvas = document.getElementById('canvas'); const ctx = canvas.getContext('2d'); // Shadow ctx.shadowColor = 'red'; ctx.shadowOffsetX = 10; ctx.shadowOffsetY = 10; // Filled rectangle ctx.fillRect(20, 20, 100, 100); // Stroked rectangle ctx.lineWidth = 6; ctx.strokeRect(170, 20, 100, 100); Result Shadows on translucent shapes A shadow's opacity is affected by the transparency level of its parent object (even when shadowColor specifies a completely opaque value). This example strokes and fills a rectangle with translucent colors. HTML <canvas id="canvas"></canvas> JavaScript The resulting alpha value of the fill shadow is .8 * .
...ow is .8 * .2, or .16. The alpha of the stroke shadow is .8 * .6, or .48. const canvas = document.getElementById('canvas'); const ctx = canvas.getContext('2d'); // Shadow ctx.shadowColor = 'rgba(255, 0, 0, .8)'; ctx.shadowBlur = 8; ctx.shadowOffsetX = 30; ctx.shadowOffsetY = 20; // Filled rectangle ctx.fillStyle = 'rgba(0, 255, 0, .2)'; ctx.fillRect(10, 10, 150, 100); // Stroked rectangle ctx.lineWidth = 10; ctx.strokeStyle = 'rgba(0, 0, 255, .6)'; ctx.strokeRect(10, 10, 150, 100); Result Specifications Specification Status Comment HTML Living StandardThe definition of 'CanvasRenderingContext2D.shadowColor' in that specification. Living Standard ...
CanvasRenderingContext2D.strokeStyle - Web APIs
pattern A CanvasPattern object (a repeating image). ...
... pattern A CanvasPattern object (a repeating image). Examples Changing the stroke color of a shape This example applies a blue stroke color to a rectangle. ...
CanvasRenderingContext2D.textAlign - Web APIs
x value of the fillText() method. For example, if textAlign is "center", then the text's left edge will be at x - (textWidth / 2). Syntax ctx.textAlign = "left" || "right" || "center" || "start" || "end"; Options Possible values: "left" The text is left-aligned. "right" The text is right-aligned. "center" The text is centered. "start" The text is aligned at the normal start of the line (left-aligned for left-to-right locales, right-aligned for right-to-left locales). "end" The text is aligned at the normal end of the line (right-aligned for left-to-right locales, left-aligned for right-to-left locales). The default value is "start". Examples General text alignment This example demonstrates the three "physical" values of the textAlign property: "left", "center", and "righ...
... default value is "start". Examples General text alignment This example demonstrates the three "physical" values of the textAlign property: "left", "center", and "right". ...
Compositing example - Web APIs
le = "#f00"; ctx.fillRect(0,0,30,30) ctx.fill(); }; var colorSphere = function(element) { var ctx = canvas1.getContext("2d"); var width = 360; var halfWidth = width / 2; var rotate = (1 / 360) * Math.PI * 2; // per degree var offset = 0; // scrollbar offset var oleft = -20; var otop = -20; for (var n = 0; n <= 359; n ++) { var gradient = ctx.createLinearGradient(oleft + halfWidth, otop, oleft + halfWidth, otop + halfWidth); var color = Color.HSV_RGB({ H: (n + 300) % 360, S: 100, V: 100 }); gradient.addColorStop(0, "rgba(0,0,0,0)"); gradient.addColorStop(0.7, "rgba("+color.R+","+color.G+","+color.B+",1)"); gradient.addColorStop(1, "rgba(255,255,255,1)"); ctx.beginPath(); ctx.moveTo(oleft + halfWidt...
...fWidth, otop, oleft + halfWidth, otop + halfWidth); var color = Color.HSV_RGB({ H: (n + 300) % 360, S: 100, V: 100 }); gradient.addColorStop(0, "rgba(0,0,0,0)"); gradient.addColorStop(0.7, "rgba("+color.R+","+color.G+","+color.B+",1)"); gradient.addColorStop(1, "rgba(255,255,255,1)"); ctx.beginPath(); ctx.moveTo(oleft + halfWidth, otop); ctx.lineTo(oleft + halfWidth, otop + halfWidth); ctx.lineTo(oleft + halfWidth + 6, otop); ctx.fillStyle = gradient; ctx.fill(); ctx.translate(oleft + halfWidth, otop + halfWidth); ctx.rotate(rotate); ctx.translate(-(oleft + halfWidth), -(otop + halfWidth)); } ctx.beginPath(); ctx.fillStyle = "#00f"; ctx.fillRect(15,15,30,30) ctx.fill(); ...
Using images - Web APIs
ct we can use the drawImage() method to render it to the canvas. As we will see later the drawImage() method is overloaded and has several variants. In its most basic form it looks like this: drawImage(image, x, y) Draws the CanvasImageSource specified by the image parameter at the coordinates (x, y). SVG images must specify a width and height in the root <svg> element. Example: A simple line graph In the following example, we will use an external image as the backdrop for a small line graph. Using backdrops can make your script considerably smaller because we can avoid the need for code to generate the background. In this example, we're only using one image, so I use the image object's load event handler to execute the drawing statements. The drawImage() method places the backdrop a...
...at the coordinate (0, 0), which is the top-left corner of the canvas. <html> <body onload="draw();"> <canvas id="canvas" width="180" height="150"></canvas> </body> </html> function draw() { var ctx = document.getElementById('canvas').getContext('2d'); var img = new Image(); img.onload = function() { ctx.drawImage(img, 0, 0); ctx.beginPath(); ctx.moveTo(30, 96); ctx.lineTo(70, 66); ctx.lineTo(103, 76); ctx.lineTo(170, 15); ctx.stroke(); }; img.src = 'https://mdn.mozillademos.org/files/5395/backdrop.png'; } The resulting graph looks like this: ScreenshotLive sample Scaling The second variant of the drawImage() method adds two new parameters and lets us place scaled images on the canvas. drawImage(image, x, y, width, height) This adds the wi...
ContentIndex - Web APIs
Properties There are no properties of this interface. Methods ContentIndex.add Registers an item with the content index. ContentIndex.delete Unregisters an item from the currently indexed content. ContentIndex.getAll Returns a Promise that resolves with an iterable list of content index entries. Examples Feature Detection and Interface Access Here we get a reference to the ServiceWorkerRegistration, then check for the index property, which gives us access to the content index interface. ...
...orker.ready; // get our index entries const entries = await registration.index.getAll(); // create a containing element const readingListElem = document.createElement('div'); // test for entries if (!Array.length) { // if there are no entries, display a message const message = document.createElement('p'); message.innerText = 'You currently have no articles saved for offline reading.' readingListElem.append(message); } else { // if entries are present, display in a list of links to the content const listElem = document.createElement('ul'); for (const entry of entries) { const listItem = document.createElement('li'); const anchorElem = document.createElement('a'); anchorElem.innerText = entry.title; anchorElem.setAttribut...
DelayNode() - Web APIs
options Optional An object specifying the delay node options. Can contain the following members: delayTime: The initial delay time for the node, in seconds. The default is 0. maxDelayTime: The maximum delay time for the node, in seconds. ...
... options Optional An object specifying the delay node options. Can contain the following members: delayTime: The initial delay time for the node, in seconds. The default is 0. maxDelayTime: The maximum delay time for the node, in seconds. Defaults to 1. Return value A new DelayNode object instance. ...
Traversing an HTML table with JavaScript and DOM Interfaces - Web APIs
descendants of the body: myBodyElements = myBody.getElementsByTagName("p"); Finally, we get the second item from the list of p elements via myP = myBodyElements[1]; Once you have gotten the DOM object for an HTML element, you can set its properties. For example, if you want to set the style background color property, you just add: myP.style.background = "rgb(255,0,0)"; // setting inline STYLE attribute Creating TextNodes with document.createTextNode("..") Use the document object to invoke the createTextNode method and create your text node. You just need to pass the text content. The return value is an object that represents the text node. myTextNode = document.createTextNode("world"); This means that you have created a node of the type TEXT_NODE (a piece of text) whose te...
...des and inserting them into the document tree The basic steps to create the table in sample1.html are: Get the body object (first item of the document object). Create all the elements. Finally, append each child according to the table structure (as in the above figure). The following source code is a commented version for the sample1.html. At the end of the start function, there is a new line of code. The table's border property was set using another DOM method, setAttribute(). setAttribute() has two arguments: the attribute name and the attribute value. You can set any attribute of any element using the setAttribute method. <head> <title>Sample code - Traversing an HTML Table with JavaScript and DOM Interfaces</title> <script> function start() { // get the reference for...
Element: MozMousePixelScroll event - Web APIs
imilar device is operated. It's represented by the MouseScrollEvent interface. Important: Do not use this non-standard and obsolete event. Instead, you should always use the standard wheel event. ...
... Interface MouseScrollEvent Getting the distance scrolled The event's detail property indicates the scroll distance in terms of lines, with negative values indicating the scrolling movement is either toward the bottom or toward the right, and positive values indicating scrolling to the top or left. If the platform's native mouse wheel events indicate the scroll distance in terms of lines or pages, the value of detail is computed using that value and the line height or page width/height of the nearest ancestor scrollable element that contains the target element. Note: On macOS, the scroll distance (and therefore the value of detail) is computed based on the accelerated scroll distance. The value of detail is never 0 if the events are legitimate. ...
Element: mousewheel event - Web APIs
, use the standard wheel event. Bubbles Yes Cancelable Yes Interface MouseWheelEvent Event handler property onmousewheel The detail property The value of the detail property is always zero, except in Opera, which uses detail similarly to the Firefox-only DOMMouseScroll event's detail value, which indicates the scroll distance in terms of lines, with negative values indicating the scrolling movement is either toward the bottom or toward the right, and positive values indicating scrolling to the top or left. Note: On macOS, the scroll distance (and therefore the value of detail) is computed based on the accelerated scroll distance. On Linux, 2 or -2 is set per native wheel event. wheelDelta, wheelDeltaX and wheelDeltaY value The w...
... The value is always computed from accelerated scroll amount. This is really different from other browsers except Chrome with continuous scroll supported device. Opera (Presto) The value is always the detail attribute value ? 40. On Windows, since the detail attribute value is computed from actual scroll amount, the value is different from other browsers except the scroll amount per notch is 3 lines in system settings or a page. On Linux, the value is 80 or -80 per native wheel event. This is different from other browsers. On Mac, the detail attribute value is computed from accelerated scroll amout of native event. The value is usually much bigger than Safari's or Chrome's value. Specifications Not part of any specification. ...
HTMLCanvasElement.mozFetchAsStream() - Web APIs
mples Save to disk with mozFetchAsStream (Chrome context only) This technique also converts it to ico, however it will not work in Windows XP as WinXP cannot convert from PNG to ICO. It saves to the desktop it uses FileUtils.jsm. ...
...sk with mozFetchAsStream (Chrome context only) This technique also converts it to ico, however it will not work in Windows XP as WinXP cannot convert from PNG to ICO. It saves to the desktop it uses FileUtils.jsm. ...
HTMLImageElement.align - Web APIs
ign, which does in fact also work on images despite its name. You can also use the float property to float the image to the left or right margin. The align property reflects the HTML align content attribute. Syntax htmlImageElement.align = alignMode; alignMode = htmlImageElement.align; Value A DOMString specifying one of the following strings which set the alignment mode for the image. Baseline alignment These three values specify the alignment of the element relative to the text baseline. These should be replaced by using the CSS vertical-align property. bottom The bottom edge of the image is to be aligned vertically with the current text baseline. Default value. middle The center of the object should be aligned vertically with the current baseline. top The top edge of the obj...
...f the element relative to the text baseline. These should be replaced by using the CSS vertical-align property. bottom The bottom edge of the image is to be aligned vertically with the current text baseline. Default value. middle The center of the object should be aligned vertically with the current baseline. top The top edge of the object should be aligned vertically with the current baseline. It may be worth noting that vertical-align offers several additional options for its value; you may wish to consider these when changing your code to use it. Floating images horizontally The left and right properties don't affect the baseline-relative alignment. Instead, they cause the image to "float" to the left or right margin, allowing the following text to flow around the image. You sho...
HTMLImageElement.alt - Web APIs
mandatory; it's meant to always be specified. If the image doesn't require a fallback (such as for an image which is simply decorative or an advisory icon of minimal importance), you may specify an empty string (""). For compatibility reasons, browsers generally will accept an image without an alt attribute, but you should try to get into the habit of using it. ...
...These are shown in the examples below. Decorative images Images with no semantic meaning--such as those which are solely decorative--or of limited informational value, should have their alt attributes set to the empty string (""). ...
HTMLStyleElement.media - Web APIs
The HTMLStyleElement.media property specifies the intended destination medium for style information. Syntax medium = style.media style.media = medium Parameters medium is a string describing a single medium or a comma-separated list. ...
...ngle medium or a comma-separated list. Example <!doctype html> <html> <head> <link id="LinkedStyle" rel="stylesheet" href="document.css" type="text/css" media="screen" /> <style id="InlineStyle" rel="stylesheet" type="text/css" media="screen, print"> p { color: blue; } </style> </head> <body> <script> alert('LinkedStyle: ' + document.getElementById('LinkedStyle').media); // 'screen' alert('InlineStyle: ' + document.getElementById('InlineStyle').media); // 'screen, print' </script> </body> </html> Specifications Specification Status Comment HTML Living StandardThe definition of 'HTMLStyleElement' in that specification. Living Standard HTML 5.1The definition of 'HTMLStyleElement' in that specification. Recommendation HTML5The...
Recommended Drag Types - Web APIs
nk's URL for their data. For example: var dt = event.dataTransfer; dt.setData("text/uri-list", "https://www.mozilla.org"); dt.setData("text/plain", "https://www.mozilla.org"); As usual, set the text/plain type last, as a fallback for the text/uri-list type. Note: the URL type is uri-list with an I, not an L. To drag multiple links, separate each link inside the text/uri-list data with a CRLF linebreak. Lines that begin with a number sign (#) are comments, and should not be considered URLs. You can use comments to indicate the purpose of a URL, the title associated with a URL, or other data. The text/plain fallback for multiple links should include all URLs, but no comments. For example, this sample text/uri-list data contains two links and a comment: http://www.mozilla.org #A second ...
...thin data for the text/uri-list type. Do not add data with the URL type -- attempting to do so will set the value of the text/uri-list type instead. var url = event.dataTransfer.getData("URL"); You may also see data with the Mozilla-specific type text/x-moz-url. If it appears, it should appear before the text/uri-list type. It holds the URLs of links followed by their titles, separated by a linebreak. For example: http://www.mozilla.org Mozilla http://www.example.com Example Dragging HTML and XML HTML content may use the text/html type. The data for this type should be serialized HTML source code. For example, it would be suitable to set its data to the value of the innerHTML property of an element. XML content may use the text/xml type, but ensure that the data is well-formed XML. ...
IDBObjectStoreSync - Web APIs
e value to store into the index. key A key to use for identifying the record. any The key for the stored record. CONSTRAINT_ERR If a record exists in this index with a key corresponding to the key parameter or the index is auto-populated, or if no record exists with a key corresponding to the value parameter in the index's referenced object store. DATA_ERR If this object store uses out-of-line keys, and the key parameter was not passed. SERIAL_ERR If the data being stored could not be serialized by the internal structured cloning algorithm. createIndex() Creates and returns a new index with the given name in the connected database. IDBIndexSync createIndex ( in DOMString name, in DOMString keypath, in optional boolean unique ); Parameters name The name of a ne...
...e record. Returns any The key for the stored record. Exceptions This method can raise an IDBDatabaseException with the following codes: CONSTRAINT_ERR If noOverwrite was true, and a record exists in this index for the given key or this index is auto-populated; or if no record exists with the given key in the index's referenced object store. DATA_ERR If this object store uses out-of-line keys and no key generator, but no key was given. SERIAL_ERR If the data being stored could not be serialized by the internal structured cloning algorithm. remove() Removes from this object store any records that correspond to the given key. void remove ( in any key ) raises (IDBDatabaseException); Parameters key Key of the records to be removed. Returns void Exceptions This met...
InterventionReportBody - Web APIs
ge A string containing a human-readable description of the intervention, including information such how the intervention could be avoided. This typically matches the message a browser will display in its DevTools console when an intervention is imposed, if one is available. sourceFile A string containing the path to the source file where the intervention occurred, if known, or null otherwise. lineNumber A number representing the line in the source file in which the intervention occurred, if known, or null otherwise. columnNumber A number representing the column in the source file in which the intervention occurred, if known, or null otherwise. Examples let options = { types: ['intervention'], buffered: true } let observer = new ReportingObserver(function(reports, observer) { l...
...nown, or null otherwise. Examples let options = { types: ['intervention'], buffered: true } let observer = new ReportingObserver(function(reports, observer) { let firstReport = reports[0]; console.log(firstReport.type); // intervention console.log(firstReport.body.id); console.log(firstReport.body.message); console.log(firstReport.body.sourceFile); console.log(firstReport.body.lineNumber); console.log(firstReport.body.columnNumber); }, options); Specifications Specification Status Comment Reporting APIThe definition of 'InterventionReportBody' in that specification. Editor's Draft ...
LocalFileSystem - Web APIs
Concepts article.) In most cases, you need to create only one file system, but in a few cases, it might be useful to create a second one. For example, if you were to create a mail app, you might create a temporary storage for caching assets (like images and attachments) to speed up performance, while creating persistent storage for unique data--such as drafts of emails that were composed while offline--that should not be lost before they are backed up into the cloud. Using persistent storage The requestFileSystem() method lets you ask for PERSISTENT or TEMPORARY storage. Persistent storage is storage that stays in the browser unless the app or the user removes it, but the user must grant you permission before you can use it. In contrast, temporary storage is automatically granted without a...
...p can use persistent storage. Once your user grants it, you don't need to call requestQuota() again. Subsequent calls are a noop. Another API, the Quota Management API, lets you query an origin's current quota usage and allocation using window.webkitPersistentStorage.queryUsageAndQuota(). To learn more, see this StackOverflow Answer. (An older version of the API is described at Managing HTML5 Offline Storage.) Working within a single origin The file system is sandboxed to a single origin. This means that your app cannot read, or write the files of another app's files. Your app cannot access files in an arbitrary folder (such as, My Pictures, My Documents) on the user's hard drive either. For more information about restrictions, see the Basic Concepts article. Example The following is a ...
Location - Web APIs
Web › API › Location
itle="hostname">example.org</span>:<span id="port" title="port">8888</span></span><span id="pathname" title="pathname">/foo/bar</span><span id="search" title="search">?q=baz</span><span id="hash" title="hash">#bang</span></span> CSS html, body {height:100%;} html {display:table; width:100%;} body {display:table-cell; text-align:center; vertical-align:middle; font-family:georgia; font-size:230%; line-height:1em; white-space:nowrap;} [title] {position:relative; display:inline-block; box-sizing:border-box; /*border-bottom:.5em solid;*/ line-height:2em; cursor:pointer;} [title]:before {content:attr(title); font-family:monospace; position:absolute; top:100%; width:100%; left:50%; margin-left:-50%; font-size:40%; line-height:1.5; background:black;} [title]:hover:before, :target:before {backgroun...
...itle]:before {content:attr(title); font-family:monospace; position:absolute; top:100%; width:100%; left:50%; margin-left:-50%; font-size:40%; line-height:1.5; background:black;} [title]:hover:before, :target:before {background:black; color:yellow;} [title] [title]:before {margin-top:1.5em;} [title] [title] [title]:before {margin-top:3em;} [title]:hover, :target {position:relative; z-index:1; outline:50em solid rgba(255,255,255,.8);} JavaScript [].forEach.call(document.querySelectorAll('[title][id]'), function (node) { node.addEventListener("click", function(e) { e.preventDefault(); e.stopPropagation(); window.location.hash = '#' + $(this).attr('id'); }); }); [].forEach.call(document.querySelectorAll('[title]'), function (node) { node.addEventListener("click", function(e) ...
MathMLElement - Web APIs
The MathMLElement interface represents any MathML element. ...
... The MathMLElement interface represents any MathML element. ...
MediaDevices.ondevicechange - Web APIs
mise returned by enumerateDevices() is fulfilled. The fulfillment handler is called when the device list is ready. The list is passed into the fulfillment handler as an array of MediaDeviceInfo objects, each describing one media input or output device. A forEach() loop is used to scan through all the devices. For each device, we create a new <li> object to be used to display it to the user. The line let [kind, type, direction] = device.kind.match(/(\w+)(input|output)/i); deserves special notice. This uses destructuring assignment (a new feature of ECMAScript 6) to assign the values of the first three items in the array returned by String.match() to the variables kind, type, and direction. We do this because the value of MediaDeviceInfo.kind is a single string that includes both the media typ...
...s special notice. This uses destructuring assignment (a new feature of ECMAScript 6) to assign the values of the first three items in the array returned by String.match() to the variables kind, type, and direction. We do this because the value of MediaDeviceInfo.kind is a single string that includes both the media type and the direction the media flows, such as "audioinput" or "videooutput". This line, then, pulls out the type ("audio" or "video") and direction ("input" or "output") so they can be used to construct the string displayed in the list. Once the string is assembled, containing the device's name in bold and the direction in parentheses, it's appended to the appropriate list by calling appendChild() on either audioList or videoList, as appropriate based on the device type. Handling...
MediaStreamTrack: mute event - Web APIs
ubbles No Cancelable No Interface Event Event handler property onmute Examples In this example, event handlers are established for the mute and unmute events in order to detect when the media is not flowing from the source for the MediaStreamTrack referenced by musicTrack. musicTrack.addEventListener("mute", event => { document.getElementById("timeline-widget").style.backgroundColor = "#aaa"; }, false); musicTrack.addEventListener("unmute", event => { document.getElementById("timeline-widget").style.backgroundColor = "#fff"; }, false); With these event handlers in place, when the track musicTrack enters its muted state, the element with the ID timeline-widget gets its background color changed to #aaa. When the track exits the muted state--d...
... track exits the muted state--detected by the arrival of an unmute event--the background color is restored to white. You can also use the onmute event handler property to set up a handler for this event; similarly, the onunmute event handler is available for setting up a handler for the unmute event. 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. Candidate Recommendation Initial specification. ...
MediaStreamTrack: unmute event - Web APIs
a track) is actually managed using the MediaStreamTrack.enabled property, for which there are no events. Examples In this example, event handlers are established for the mute and unmute events in order to detect when the media is not flowing from the source for the MediaStreamTrack stored in the variable musicTrack. musicTrack.addEventListener("mute", event => { document.getElementById("timeline-widget").style.backgroundColor = "#aaa"; }, false); musicTrack.addEventListener("unmute", event => { document.getElementById("timeline-widget").style.backgroundColor = "#fff"; }, false); With these event handlers in place, when the track musicTrack enters its muted state, the element with the ID timeline-widget gets its background color changed to #aaa. When the track exits the muted state--d...
...e track exits the muted state--detected by the arrival of an unmuted event--the background color is restored to white. You can also use the onunmute event handler property to set up a handler for this event; similarly, the onmute event handler is available for setting up a handler for the mute event. 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. Candidate Recommendation Initial specification. ...
MediaTrackConstraints.sampleSize - Web APIs
Size as returned by a call to MediaDevices.getSupportedConstraints(). However, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. Syntax var constraintsObject = { sampleSize: constraint }; constraintsObject.sampleSize = constraint; Value If this value is a number, the user agent will attempt to obtain media whose sample size (in bits per linear sample) is as close as possible to this number given the capabilities of the hardware and the other constraints specified. Otherwise, the value of this ConstrainLong will guide the user agent in its efforts to provide an exact match to the required sample size (if exact is specified or both min and max are provided and have the same value) or to a best-possible value. Since this property can ...
...s close as possible to this number given the capabilities of the hardware and the other constraints specified. Otherwise, the value of this ConstrainLong will guide the user agent in its efforts to provide an exact match to the required sample size (if exact is specified or both min and max are provided and have the same value) or to a best-possible value. Since this property can only represent linear sample sizes, this constraint can only be met by devices that can produce audio with linear samples. Example See Example: Constraint exerciser in Capabilities, constraints, and settings for an example. Specifications Specification Status Comment Media Capture and StreamsThe definition of 'sampleSize' in that specification. Candidate Recommendation Initial ...
Navigator - Web APIs
Web › API › Navigator
The Navigator interface represents the state and the identity of the user agent. It allows scripts to query it and to register themselves to carry on some activities. A Navigator object can be retrieved using the read-only window.navigator property. Properties Doesn't inherit any properties, but implements those defined in NavigatorID, NavigatorLanguage, NavigatorOnLine, NavigatorContentUtils, NavigatorStorage, NavigatorStorageUtils, NavigatorConcurrentHardware, NavigatorPlugins, and NavigatorUserMedia. Standard NavigatorID.appCodeName Read only Returns the internal "code" name of the current browser. Do not rely on this property to return the correct value. NavigatorID.appName Read only Returns a DOMString with the official name of the browser. Do not rely on this property to r...
...bilities object that can expose information about the decoding and encoding capabilities for a given format and output capabilities. Navigator.maxTouchPoints Read only Returns the maximum number of simultaneous touch contact points are supported by the current device. NavigatorPlugins.mimeTypes Read only Returns an MimeTypeArray listing the MIME types supported by the browser. Navigator.onLine Read only Returns a Boolean indicating whether the browser is working online. Navigator.permissions Read only Returns a Permissions object that can be used to query and update permission status of APIs covered by the Permissions API. NavigatorID.platform Read only Returns a string representing the platform of the browser. Do not rely on this function to return a significant value. Navi...
Using the Notifications API - Web APIs
can check to see if you already have permission by checking the value of the Notification.permission read only property. It can have one of three possible values: default The user hasn't been asked for permission yet, so notifications won't be displayed. granted The user has granted permission to display notifications, after having been asked previously. denied The user has explicitly declined permission to show notifications. Getting permission If permission to display notifications hasn't been granted yet, the application needs to use the Notification.requestPermission() method to request this from the user. In its simplest form, we just include the following: Notification.requestPermission().then(function(result) { console.log(result); }); This uses the promise-based version...
...: This API shouldn't be used just to have the notification removed from the screen after a fixed delay (on modern browsers) since this method will also remove the notification from any notification tray, preventing users from interacting with it after it was initially shown. Note: When you receive a "close" event, there is no guarantee that it's the user who closed the notification. This is in line with the specification, which states: "When a notification is closed, either by the underlying notifications platform or by the user, the close steps for it must be run." Notification events There are four events that are triggered on the Notification instance: click Triggered when the user clicks on the notification. close Triggered once the notification is closed. error Triggered if ...
OES_texture_float - Web APIs
his extension is only available to WebGL1 contexts. In WebGL2, the functionality of this extension is available on the WebGL2 context by default. Extended methods This extension extends WebGLRenderingContext.texImage2D() and WebGLRenderingContext.texSubImage2D(): The type parameter now accepts gl.FLOAT. The pixels parameter now accepts an ArrayBufferView of type Float32Array. Limitation: Linear filtering Linear filtering on floating-point textures is not allowed with this extension. If you set the magnification or minification filter in the WebGLRenderingContext.texParameter() method to one of gl.LINEAR, gl.LINEAR_MIPMAP_NEAREST, gl.NEAREST_MIPMAP_LINEAR, or gl.LINEAR_MIPMAP_LINEAR, and use floating-point textures, the texture will be marked as incomplete. To use linear filtering on...
...es is not allowed with this extension. If you set the magnification or minification filter in the WebGLRenderingContext.texParameter() method to one of gl.LINEAR, gl.LINEAR_MIPMAP_NEAREST, gl.NEAREST_MIPMAP_LINEAR, or gl.LINEAR_MIPMAP_LINEAR, and use floating-point textures, the texture will be marked as incomplete. To use linear filtering on floating-point textures, enable the OES_texture_float_linear extension in addition to this extension. Floating-point color buffers This extension implicitly enables the WEBGL_color_buffer_float extension (if supported), which allows rendering to 32-bit floating-point color buffers. Examples var ext = gl.getExtension('OES_texture_float'); var texture = gl.createTexture(); gl.bindTexture(gl.TEXTURE_2D, texture); gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGB...
OES_texture_half_float - Web APIs
exts. In WebGL2, the functionality of this extension is available on the WebGL2 context by default. The constant in WebGL2 is gl.HALF_FLOAT. Constants ext.HALF_FLOAT_OES Half floating-point type (16-bit). Extended methods This extension extends WebGLRenderingContext.texImage2D() and WebGLRenderingContext.texSubImage2D(): The type parameter now accepts ext.HALF_FLOAT_OES. Limitation: Linear filtering Linear filtering on half floating-point textures is not allowed with this extension. If you set the magnification or minification filter in the WebGLRenderingContext.texParameter() method to one of gl.LINEAR, gl.LINEAR_MIPMAP_NEAREST, gl.NEAREST_MIPMAP_LINEAR, or gl.LINEAR_MIPMAP_LINEAR, and use half floating-point textures, the texture will be marked as incomplete. To use linear fi...
...ed with this extension. If you set the magnification or minification filter in the WebGLRenderingContext.texParameter() method to one of gl.LINEAR, gl.LINEAR_MIPMAP_NEAREST, gl.NEAREST_MIPMAP_LINEAR, or gl.LINEAR_MIPMAP_LINEAR, and use half floating-point textures, the texture will be marked as incomplete. To use linear filtering on half floating-point textures, enable the OES_texture_half_float_linear extension in addition to this extension. Half floating-point color buffers This extension implicitly enables the EXT_color_buffer_half_float extension (if supported), which allows rendering to 16-bit floating point formats. Examples var ext = gl.getExtension('OES_texture_half_float'); var texture = gl.createTexture(); gl.bindTexture(gl.TEXTURE_2D, texture); gl.texImage2D(gl.TEXTURE_2D, 0,...
PannerNode.rolloffFactor - Web APIs
how quickly the volume is reduced as the source moves away from the listener. This value is used by all distance models.The rolloffFactor property's default value is 1. Syntax var audioCtx = new AudioContext(); var panner = audioCtx.createPanner(); panner.rolloffFactor = 1; Value A number whose range depends on the distanceModel of the panner as follows (negative values are not allowed): "linear" The range is 0 to 1. "inverse" The range is 0 to Infinity. "exponential" The range is 0 to Infinity. Exceptions RangeError The property has been given a value that is outside the accepted range. Example This example demonstrates how different rolloffFactor values affect how the volume of the test tone decreases with increasing distance from the listener: const contex...
...e Z (depth-wise) axis // at the given start time, resulting in a decrease in volume (decay) const scheduleTestTone = (rolloffFactor, startTime) => { const osc = new OscillatorNode(context); const panner = new PannerNode(context); panner.rolloffFactor = rolloffFactor; // set the initial Z position, then schedule the ramp panner.positionZ.setValueAtTime(0, startTime); panner.positionZ.linearRampToValueAtTime(Z_DISTANCE, startTime + NOTE_LENGTH); osc.connect(panner) .connect(context.destination); osc.start(startTime); osc.stop(startTime + NOTE_LENGTH); }; // this tone should decay fairly quickly scheduleTestTone(1, context.currentTime); // this tone should decay slower than the previous one scheduleTestTone(0.5, context.currentTime + NOTE_LENGTH); // this tone should d...
Path2D - Web APIs
Web › API › Path2D
are also present on this interface, which gives you the convenience of being able to retain and replay your path whenever desired. Constructors Path2D() Path2D constructor. Creates a new Path2D object. Methods Path2D.addPath() Adds a path to the current path. Path2D.closePath() Causes the point of the pen to move back to the start of the current sub-path. It tries to draw a straight line from the current point to the start. If the shape has already been closed or has only one point, this function does nothing. Path2D.moveTo() Moves the starting point of a new sub-path to the (x, y) coordinates. Path2D.lineTo() Connects the last point in the subpath to the (x, y) coordinates with a straight line. Path2D.bezierCurveTo() Adds a cubic Bezier curve to the path. It requires three...
...) Adds a quadratic Bezier curve to the current path. Path2D.arc() Adds an arc to the path which is centered at (x, y) position with radius r starting at startAngle and ending at endAngle going in the given direction by anticlockwise (defaulting to clockwise). Path2D.arcTo() Adds a circular arc to the path with the given control points and radius, connected to the previous point by a straight line. Path2D.ellipse() Adds an elliptical arc to the path which is centered at (x, y) position with the radii radiusX and radiusY starting at startAngle and ending at endAngle going in the given direction by anticlockwise (defaulting to clockwise). Path2D.rect() Creates a path for a rectangle at position (x, y) with a size that is determined by width and height. Specifications Specific...
PaymentAddress.toJSON() - Web APIs
d the #web-payments preference (needs to be set to Enabled). To change preferences in Chrome, visit chrome://flags.Edge Full support 15Firefox Full support 62Notes Disabled Full support 62Notes Disabled Notes Available only in nightly builds. Requires the comma-delineated list in dom.payments.request.supportedRegions to contain one or more of the supported 2-character ISO locales, currently US and CA.Disabled From version 62: this feature is behind the dom.payments.request.enabled preference (needs to be set to true). To change preferences in Firefox, visit about:config.IE No support NoOpera No suppo...
...1Disabled Disabled From version 61: this feature is behind the #web-payments preference (needs to be set to Enabled). To change preferences in Chrome, visit chrome://flags.Firefox Android Full support 62Notes Disabled Full support 62Notes Disabled Notes Available only in nightly builds. Requires the comma-delineated list in dom.payments.request.supportedRegions to contain one or more of the supported 2-character ISO locales, currently US and CA.Disabled From version 62: this feature is behind the dom.payments.request.enabled preference (needs to be set to true). To change preferences in Firefox, visit about:config.Opera Android No support NoSafari iOS ...
PaymentRequest.PaymentRequest() - Web APIs
ervices, this structure should match the BasicCardRequest dictionary. details Provides information about the requested transaction. This parameter contains the following fields: total The total amount of the payment request. id Optional A free-form identifier for this payment request. If a value is not supplied, the browser will construct one. displayItems An array of optional line items for the payment request that the user agent may display, such as product details, tax, and shipping. shippingOptions The shipping options the user may choose from. If this sequence is blank, it indicates the merchant cannot ship to the current shipping address. The default shipping option may be indicated in this sequence. modifiers Modifiers for specific payment methods; for exampl...
...s. The default shipping option may be indicated in this sequence. modifiers Modifiers for specific payment methods; for example, adjusting the total amount based on the payment method. This parameter contains the following fields: additionalDisplayItems An array of items to be appended to the details.displayItems property. This property is commonly used to add a discount or surcharge line item indicating the different amount in details.modifiers.total. data A JSON-serializable object that provides optional information that might be needed by the supported payment methods. This has to conform to the structure defined in the BasicCardRequest dictionary. total A total amount for the payment request that overrides value in details.total. This is typically used when details...
PaymentResponse.retry() - Web APIs
The PaymentResponse interface's retry() method makes it possible to ask the user to retry a payment after an error occurs during processing. This lets your app gracefully deal with situations such as invalid shipping addresses or declined credit cards. Syntax retryPromise = paymentRequest.retry(errorFields); Parameters errorFields A PaymentValidationErrors object, with the following properties: error Optional A general description of a payment error from which the user may attempt to recover by retrying the payment, possibly after correcting mistakes in the payment information. error can be provided all by itself to provide only a generic error message, or in concert with the other properties to serve as an overview while other properties' values gude the user to errors in sp...
...ing a loop or recursive function that checks the PaymentResponse for errors or other reasons to retry the payment request. If a retry is needed, the loop calls retry(), then loops back to check the response when it comes in. The loop exits only when the user either cancels the payment request or the request is successful. 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. Continue by... Validate the returned reponse; if there are any fields whose values are not acceptable, call the response's complete() method with a value of "f...
Using the Payment Request API - Web APIs
// privacy settings. The website does not know whether they can make // a fast payment, so pick a generic title. checkoutButton.innerText = "Checkout with W3C"; }); } Note: See our Customizing the payment button demo for the full code. Checking before all prices are known If the checkout flow needs to know whether PaymentRequest.canMakePayment() will return true even before all line items and their prices are known, you can instantiate PaymentRequest with dummy data and pre-query .canMakePayment(). If you call .canMakePayment() multiple times, keep in mind that the first parameter to the PaymentRequest constructor should contain the same method names and data. // The page has loaded. Should the page use PaymentRequest? // If PaymentRequest fails, should the page fallback to...
...he user may have turned off query ability in their privacy settings. // Let's use PaymentRequest by default and fallback to legacy // web form based checkout. shouldCallPaymentRequest = true; fallbackToLegacyOnPaymentRequestFailure = true; }); // User has clicked on the checkout button. We know // what's in the cart, but we don't have a `Checkout` object. function onCheckoutButtonClicked(lineItems) { callServerToRetrieveCheckoutDetails(lineItems); } // The server has constructed the `Checkout` object. Now we know // all of the prices and shipping options. function onServerCheckoutDetailsRetrieved(checkoutObject) { if (shouldCallPaymentRequest) { const request = new PaymentRequest(supportedPaymentMethods, checkoutObject); request.show().then(function(paymentResponse) { ...
performance.getEntries() - Web APIs
Recommendation Initial definition. ...
... Recommendation Initial definition. ...
performance.getEntriesByName() - Web APIs
Recommendation Initial definition. ...
... Recommendation Initial definition. ...
performance.getEntriesByType() - Web APIs
Recommendation Initial definition. ...
... Recommendation Initial definition. ...
Performance - Web APIs
An object of this type can be obtained by calling the window.performance read-only attribute. Note: This interface and its members are available in Web Workers, except where indicated below. Also, note that performance markers and measures are per context. ...
...le via the onresourcetimingbufferfull property. Specifications Specification Status Comment High Resolution Time Level 2The definition of 'Performance' in that specification. Recommendation Defines toJson() method. High Resolution TimeThe definition of 'Performance' in that specification. Recommendation Defines now() method. Performance Timeline Level 2The definition of 'Performance extensions' in that specification. Candidate Recommendation Changes getEntries() interface. Performance TimelineThe definition of 'Performance extensions' in that specification. Recommendation Defines getEntries(), getEntriesByType() and getEntriesByName() methods. Resource Timing Level 1The definition of 'Performance extensions'...
PerformanceEntry.duration - Web APIs
Recommendation Initial definition. ...
... Recommendation Initial definition. ...
PerformanceEntry.entryType - Web APIs
Recommendation Initial definition. ...
... Recommendation Initial definition. ...
PerformanceEntry.name - Web APIs
Recommendation Initial definition. ...
... Recommendation Initial definition. ...
PerformanceEntry.startTime - Web APIs
Recommendation Initial definition. ...
... Recommendation Initial definition. ...
PerformanceEntry - Web APIs
A performance entry can be directly created by making a performance mark or measure (for example by calling the mark() method) at an explicit point in an application. Performance entries are also created in indirect ways such as loading a resource (such as an image). PerformanceEntry instances will always be one of the following subtypes: PerformanceMark PerformanceMeasure PerformanceFrameTiming PerformanceNavigationTiming PerformanceResourceTiming PerformancePaintTiming Note: This feature is available in Web Workers. ...
...nTiming interface and the navigation value for entryType. User Timing Level 2 Working Draft User Timing Recommendation Adds the PerformanceMark and PerformanceMeasure interfaces as well as the mark and measure values for entryType. Frame Timing Draft Adds the PerformanceFrameTiming interface and the frame value for entryType. Performance Timeline Level 2The definition of 'PerformanceEntry' in that specification. Candidate Recommendation Added toJSON() serializer method. Performance TimelineThe definition of 'PerformanceEntry' in that specification. Recommendation Initial definition. ...
PerformanceObserver - Web APIs
Note: This feature is available in Web Workers. Constructor PerformanceObserver() Creates and returns a new PerformanceObserver object. Methods PerformanceObserver.observe() Specifies the set of entry types to observe. ...
...rver.takeRecords() Returns the current list of performance entries stored in the performance observer, emptying it out. Example function perf_observer(list, observer) { // Process the "measure" event } var observer2 = new PerformanceObserver(perf_observer); observer2.observe({entryTypes: ["measure"]}); Specifications Specification Status Comment Performance Timeline Level 2The definition of 'PerformanceObserver' in that specification. Candidate Recommendation Initial definition of PerformanceObserver interface. ...
RTCIceCandidate.RTCIceCandidate() - Web APIs
ue A newly-created RTCIceCandidate object, optionally configured based on the specified object based on the RTCIceCandidateInit dictionary. If candidateInfo is provided, the new RTCIceCandidate is initialized as follows: Each member of the RTCIceCandidateInit object is initialized to the value of the property by the same name from RTCIceCandidateInit. This includes the candidate, sdpMid, sdpMLineIndex, and usernameFragment properties. The candidate string (which is SDP text) is parsed; each property found is stored in the corresponding field in the RTCIceCandidate. If any of the fields is invalid, parsing of the string silently aborts without throwing an exception. The default value of candidate is the empty string, which indicates that the candidate is an "end-of-candidates" message. T...
...if they are not included in the RTCIceCandidate.candidate property: foundation, component, priority , ip, protocol, port, type, tcpType, relatedAddress, and relatedPort. Note: Parsing of the candidate string is performed using the candidate-attribute grammar from the WebRTC Specification. Exceptions TypeError The specified RTCIceCandidateInit has values of null in both the sdpMid and sdpMLineIndex properties. Usage notes This constructor does not do complete validation of the specified candidateInfo object or string. Specifications Specification Status Comment WebRTC 1.0: Real-time Communication Between BrowsersThe definition of 'RTCIceCandidate()' in that specification. Candidate Recommendation Initial definition. ...
RTCIceCandidate.address - Web APIs
The RTCIceCandidate interface's read-only address property is a string providing the address of the device which is the source of the candidate. address is null by default if not otherwise specified. The address field's value is set when the RTCIceCandidate() constructor is used. You can't specify the address in the options object, but the address is automatically extracted from the candidate a-line, if it's formatted properly. Syntax var address = RTCIceCandidate.address; Value A DOMString providing the IP address from which the candidate comes. Note: If port is null -- and port is supported by the user agent -- passing the candidate to addIceCandidate() will fail, throwing an OperationError exception. Security notes It's important to note here that although WebRTC does not require...
...rn.server.ip", username: "username", credential: "password" } ], iceTransportPolicy: "relay" } By setting RTCConfiguration.iceTransportPolicy to "relay", any host candidates (candidates where the IP address is the peer's own IP address) are left out of the pool of candidates, as are any other candidates which aren't relay candidates. Usage notes Consider this SDP attribute line (a-line) which describes an ICE candidate: a=candidate:4234997325 1 udp 2043278322 192.168.0.56 44323 typ host The fifth field, "192.168.0.56" is the IP address in this candidate's a-line string. Example This code snippet uses the value of address to implement an IP address based ban feature. if (ipBanList.includes(candidate.address)) { rejectCandidate(candidate); } else { acceptCandidat...
RTCIceCandidate.port - Web APIs
The RTCIceCandidate interface's read-only port property contains the port number on the device at the address given by ip at which the candidate's peer can be reached. As is the case with most of RTCIceCandidate's properties, the value of port is extracted from the candidate a-line string specified when creating the RTCIceCandidate. The a-line string is obtained either from the RTCIceCandidateInit property candidate or from a-line string passed into the constructor upon using new RTCIceCandidate(). Syntax var port = RTCIceCandidate.port; Value A 16-bit number indicating the port number on the device at the address indicated by ip at which the candidate's peer can be reached. port is initialized to null if it is not specified in the candidate, or if the candidate string can't be parsed p...
...s indicated by ip at which the candidate's peer can be reached. port is initialized to null if it is not specified in the candidate, or if the candidate string can't be parsed propertly. Note: If port is null, passing the candidate to addIceCandidate() will fail, throwing an OperationError exception. This applies only if the candidate implements port. Usage notes Consider this SDP attribute line (a-line) which describes an ICE candidate: a=candidate:4234997325 1 udp 2043278322 192.168.0.56 44323 typ host The port number is found in the sixth field, which is "44323". In this case, the value of port will be 44323. Example This code snippet fetches the IP address and port number of the candidate, storing them into an object for future use. var candidateLoc = { address: candidate.ip, ...
RTCIceCandidate.protocol - Web APIs
ates whether the candidate uses UDP or TCP as its transport protocol. protocol is null by default if not specified properly in the SDP, but this is an error condition and will result in a thrown exception when you call RTCPeerConnection.addIceCandidate(). The protocol property's value is set when the RTCIceCandidate() constructor is used. The value is automatically extracted from the candidate a-line, if it's formatted properly. Syntax var protocol = RTCIceCandidate.protocol; Value A DOMString which indicates what network protocol the candidate uses, UDP or TCP. These values are defined by the enumerated type RTCIceProtocol: tcp The candidate, if selected, would use TCP as the transport protocol for its data. The tcpType property provides additional information about the kind of TCP c...
...d by the object. udp The candidate will use the UDP transport protocol for its data. This is the preferred protocol for media interactions because of its better performance profile. Note: If protocol is null -- and protocol is supported by the user agent -- passing the candidate to addIceCandidate() will fail, throwing an OperationError exception. Usage notes Here's an example candidate a-line from an ICE transaction: a=candidate:4234997325 1 udp 2043278322 192.168.0.56 44323 typ host The third field, "udp", is the protocol type, indicating that the candidate would use the UDP transport protocol. Example This code snippet examines the value of protocol to decide if it should look at the value of tcpType to see if it's a simultaneous-open (S-O) candidate. if (candidate.protocol == ...
RTCIceCandidate.sdpMid - Web APIs
ng specifying the media stream identification tag of the media component with which the candidate is associated. This ID uniquely identifies a given stream for the component with which the candidate is associated. This property can be configured by specifying the value of the sdpMid property when constructing the new candidate object using RTCIceCandidate(). If you call the constructor with an m-line string instead of an RTCIceCandidateInit object, the value of sdpMid is extracted from the specified candidate m-line string. Syntax var sdpMid = RTCIceCandidate.sdpMid; Value A DOMString which uniquely identifies the source media component from which the candidate draws data, or null if no such association exists for the candidate. Note: Attempting to add a candidate (using addIceCandidate...
...value of sdpMid is extracted from the specified candidate m-line string. Syntax var sdpMid = RTCIceCandidate.sdpMid; Value A DOMString which uniquely identifies the source media component from which the candidate draws data, or null if no such association exists for the candidate. Note: Attempting to add a candidate (using addIceCandidate()) that has a value of null for either sdpMid or sdpMLineIndex will throw a TypeError exception. Example ... Specifications Specification Status Comment WebRTC 1.0: Real-time Communication Between BrowsersThe definition of 'RTCIceCandidate.sdpMid' in that specification. Candidate Recommendation Initial definition. ...
RTCIceCandidate.type - Web APIs
The RTCIceCandidate interface's read-only type specifies the type of candidate the object represents. The type field's value is set when the RTCIceCandidate() constructor is used. You can't specify the value of type in the options object, but the address is automatically extracted from the candidate a-line, if it's formatted properly, being taken from its cand-type field. Syntax var type = RTCIceCandidate.type; Value A DOMString whose value is one of those defined by the RTCIceCandidateType enumerated type. These candidate types are listed in order of priority; the higher in the list they are, the more efficient they are. host The candidate is a host candidate, whose IP address as specified in the RTCIceCandidate.ip property is in fact the true address of the remote peer. srflx T...
...te is a peer reflexive candidate; the ip is an intermediary address assigned by the STUN server to represent the candidate's peer anonymously. relay The candidate is a relay candidate, obtained from a TURN server. The relay candidate's IP address is an address the TURN server uses to forward the media between the two peers. If type is null, that information was missing from the candidate's a-line, which will cause RTCPeerConnection.addIceCandidate() to throw an OperationError exception. Example In this example, the candidate's type is used to present a modified user interface for host candidates (those where the ip refers directly to the remote peer, rather than an intermediary). if (candidate.type == "host") { showHostControls(); } else { hideHostControls(); } Specifications ...
RTCIceCandidate - Web APIs
used for connectivity checks. The format of this address is a candidate-attribute as defined in RFC 5245. This string is empty ("") if the RTCIceCandidate is an "end of candidates" indicator. component Read only A DOMString which indicates whether the candidate is an RTP or an RTCP candidate; its value is either "rtp" or "rtcp", and is derived from the "component-id" field in the candidate a-line string. The permitted values are listed in the RTCIceComponent enumerated type. foundation Read only Returns a DOMString containing a unique identifier that is the same for any candidates of the same type, share the same base (the address from which the ICE agent sent the candidate), and come from the same STUN server. This is used to help optimize ICE performance while prioritizing and correl...
...relatedPort is a number indicating the port number of the candidate from which this candidate is derived. For host candidates, the relatedPort property is null. sdpMid Read only A DOMString specifying the candidate's media stream identification tag which uniquely identifies the media stream within the component with which the candidate is associated, or null if no such association exists. sdpMLineIndex Read only If not null, sdpMLineIndex indicates the zero-based index number of the media description (as defined in RFC 4566) in the SDP with which the candidate is associated. tcpType Read only If protocol is "tcp", tcpType represents the type of TCP candidate. Otherwise, tcpType is null. type Read only A DOMString indicating the type of candidate as one of the strings from the RTCIc...
RTCRtpTransceiver - Web APIs
ing of send and receive SRTP streams is significant for some applications, so RTCRtpTransceiver is used to represent this pairing, along with other important state from the media section. Each non-disabled SRTP media section is always represented by exactly one transceiver. A transceiver is uniquely identified using its mid property, which is the same as the media ID (mid) of its corresponding m-line. An RTCRtpTransceiver is associated with an m-line if its mid is non-null; otherwise it's considered disassociated. Properties currentDirection Read only A string from the enum RTCRtpTransceiverDirection which indicates the transceiver's current directionality, or null if the transceiver is stopped or has never participated in an exchange of offers and answers. direction A string from the...
... currentDirection Read only A string from the enum RTCRtpTransceiverDirection which indicates the transceiver's current directionality, or null if the transceiver is stopped or has never participated in an exchange of offers and answers. direction A string from the enum RTCRtpTransceiverDirection which is used to set the transceiver's desired direction. mid Read only The media ID of the m-line associated with this transceiver. This association is established, when possible, whenever either a local or remote description is applied. This field is null if neither a local or remote description has been applied, or if its associated m-line is rejected by either a remote offer or any answer. receiver Read only The RTCRtpReceiver object that handles receiving and decoding incoming media. ...
ResizeObserver() - Web APIs
the new dimensions of the element after each change. observer A reference to the ResizeObserver itself, so it will definitely be accessible from inside the callback, should you need it. This could be used for example to automatically unobserve the observer when a certain condition is reached, but you can omit it if you don't need it. ...
...entry of entries) { // Do something to each entry // and possibly something to the observer itself } } Examples The following snippet is taken from the resize-observer-text.html (see source) example: const resizeObserver = new ResizeObserver(entries => { for (let entry of entries) { if(entry.contentBoxSize) { h1Elem.style.fontSize = Math.max(1.5, entry.contentBoxSize.inlineSize/200) + 'rem'; pElem.style.fontSize = Math.max(1, entry.contentBoxSize.inlineSize/600) + 'rem'; } else { h1Elem.style.fontSize = Math.max(1.5, entry.contentRect.width/200) + 'rem'; pElem.style.fontSize = Math.max(1, entry.contentRect.width/600) + 'rem'; } } }); resizeObserver.observe(divElem); Specifications Specification Status Comment ...
ResizeObserver.observe() - Web APIs
ges to. Possible values are content-box (the default), and border-box. Return value Void. Exceptions None. ...
...ue Void. Exceptions None. ...
ResizeObserver.unobserve() - Web APIs
eters target A reference to an Element or SVGElement to be unobserved. Return value Void. Exceptions None. ...
...ue Void. Exceptions None. ...
ResizeObserverEntry.borderBoxSize - Web APIs
necessary to support elements that have multiple fragments, which occur in multi-column scenarios. Each object in the array contains two properties: blockSize The length of the observed element's border box in the block dimension. For boxes with a horizontal writing-mode, this is the vertical dimension, or height; if the writing-mode is vertical, this is the horizontal dimension, or width. inlineSize The length of the observed element's border box in the inline dimension. For boxes with a horizontal writing-mode, this is the horizontal dimension, or width; if the writing-mode is vertical, this is the vertical dimension, or height. Note: For more explanation of writing modes and block and inline dimensions, read Handling different text directions. Examples const resizeObserver = new...
...s the vertical dimension, or height. Note: For more explanation of writing modes and block and inline dimensions, read Handling different text directions. ...
ResizeObserverEntry.contentBoxSize - Web APIs
eObserverEntry.contentBoxSize; Value An object containing the new content box size of the observed element. This object contains two properties: blockSize The length of the observed element's content box in the block dimension. For boxes with a horizontal writing-mode, this is the vertical dimension, or height; if the writing-mode is vertical, this is the horizontal dimension, or width. inlineSize The length of the observed element's content box in the inline dimension. For boxes with a horizontal writing-mode, this is the horizontal dimension, or width; if the writing-mode is vertical, this is the vertical dimension, or height. Note: For more explanation of writing modes and block and inline dimensions, read Handling different text directions. Examples The following snippet is ...
...x. We could just implement this using border-radius with a percentage, but that quickly leads to ugly-looking elliptical corners; this solution gives you nice square corners that scale with the box size. ...
ResizeObserverEntry.contentRect - Web APIs
e. This uses a simple feature detection test to see if the browser supports the newer ResizeObserverEntry.contentBoxSize property -- if so, it uses that to get the sizing data it needs. If not, it uses contentRect. ...
...esizeObserverEntry.contentBoxSize property -- if so, it uses that to get the sizing data it needs. If not, it uses contentRect. const resizeObserver = new ResizeObserver(entries => { for (let entry of entries) { if(entry.contentBoxSize) { h1Elem.style.fontSize = Math.max(1.5, entry.contentBoxSize.inlineSize/200) + 'rem'; pElem.style.fontSize = Math.max(1, entry.contentBoxSize.inlineSize/600) + 'rem'; } else { h1Elem.style.fontSize = Math.max(1.5, entry.contentRect.width/200) + 'rem'; pElem.style.fontSize = Math.max(1, entry.contentRect.width/600) + 'rem'; } } }); resizeObserver.observe(divElem); Specifications Specification Status Comment Resize ObserverThe definition of 'contentRect' in that specification. Editor's Dra...
ResizeObserverEntry - Web APIs
le. This uses a simple feature detection test to see if the browser supports the newer contentBoxSize property -- if so, it uses that to get the sizing data it needs. If not, it uses the older contentRect property. ...
...contentBoxSize property -- if so, it uses that to get the sizing data it needs. If not, it uses the older contentRect property. const resizeObserver = new ResizeObserver(entries => { for (let entry of entries) { if(entry.contentBoxSize) { h1Elem.style.fontSize = Math.max(1.5, entry.contentBoxSize.inlineSize/200) + 'rem'; pElem.style.fontSize = Math.max(1, entry.contentBoxSize.inlineSize/600) + 'rem'; } else { h1Elem.style.fontSize = Math.max(1.5, entry.contentRect.width/200) + 'rem'; pElem.style.fontSize = Math.max(1, entry.contentRect.width/600) + 'rem'; } } }); resizeObserver.observe(divElem); Specifications Specification Status Comment Resize ObserverThe definition of 'ResizeObserverEntry' in that specification. Editor's...
SVGAnimatedPathData - Web APIs
animatedPathSegList SVGPathSegList Provides access to the current animated contents of the 'd' attribute in a form which matches one-for-one with SVG's syntax. If the given attribute or property is being animated, contains the current animated value of the attribute or pro...
...lue of the attribute or property, and both the object itself and its contents are read only. normalizedPathSegList SVGPathSegList Provides access to the base (i.e., static) contents of the 'd' attribute in a form where all path data commands are expressed in terms of the following subset of SVGPathSeg types: SVG_PATHSEG_MOVETO_ABS (M), SVG_PATHSEG_LINETO_ABS (L), SVG_PATHSEG_CURVETO_CUBIC_ABS (C) and SVG_PATHSEG_CLOSEPATH (z). pathSegList SVGPathSegList Provides access to the base (i.e., static) contents of the 'd' attribute in a form which matches one-for-one with SVG's syntax. Thus, if the d attribute has an "absolute moveto (M)" and an "absolute arcto (A)" command, then pathSegList will have ...
Using the Screen Capture API - Web APIs
navigator.mediaDevices.getDisplayMedia(displayMediaOptions); dumpOptionsInfo(); } catch(err) { console.error("Error: " + err); } } After clearing the contents of the log in order to get rid of any leftover text from the previous attempt to connect, startCapture() calls getDisplayMedia(), passing into it the constraints object defined by displayMediaOptions. Using await, the following line of code does not get executed until after the promise returned by getDisplayMedia() resolves. Upon resolution, the promise returns a MediaStream, which will stream the contents of the screen, window, or other region selected by the user. The stream is connected to the <video> element by storing the returned MediaStream into the element's srcObject. The dumpOptionsInfo() function--which we will ...
..., clicking "Start Capture" will present the user agent's interface for selecting a screen, window, or tab to share. Security In order to function when Feature Policy is enabled, you will need the display-capture permission. This can be done using the Feature-Policy HTTP header or--if you're using the Screen Capture API in an <iframe>, the <iframe> element's allow attribute. ...
SecurityPolicyViolationEvent - Web APIs
s configured to be treated by the user agent. This will be "enforce" or "report". SecurityPolicyViolationEvent.documentURIRead only A USVString representing the URI of the document or worker in which the violation was found. SecurityPolicyViolationEvent.effectiveDirectiveRead only A DOMString representing the directive whose enforcement uncovered the violation. SecurityPolicyViolationEvent.lineNumberRead only The line number in the document or worker at which the violation occurred. SecurityPolicyViolationEvent.originalPolicyRead only A DOMString containing the policy whose enforcement uncovered the violation. SecurityPolicyViolationEvent.referrerRead only A USVString representing the referrer of the resources whose policy was violated. This will be a URL or null. SecurityPolic...
...ment uncovered the violation. SecurityPolicyViolationEvent.referrerRead only A USVString representing the referrer of the resources whose policy was violated. This will be a URL or null. SecurityPolicyViolationEvent.sampleRead only A DOMString representing a sample of the resource that caused the violation, usually the first 40 characters. This will only be populated if the resource is an inline script, event handler, or style -- external resources causing a violation will not generate a sample. SecurityPolicyViolationEvent.sourceFileRead only A USVString representing the URI of the document or worker in which the violation was found. SecurityPolicyViolationEvent.statusCodeRead only A number representing the HTTP status code of the document or worker in which the violation occurred...
Selection.modify() - Web APIs
Web › API › Selection › modify
ection The direction in which to adjust the current selection. You can specify "forward" or "backward" to adjust in the appropriate direction based on the language at the selection point. If you want to adjust in a specific direction, you can specify "left" or "right". granularity The distance to adjust the current selection or cursor position. You can move by "character", "word", "sentence", "line", "paragraph", "lineboundary", "sentenceboundary", "paragraphboundary", or "documentboundary". Note: Gecko does not implement "sentence", "paragraph", "sentenceboundary", "paragraphboundary", or "documentboundary". WebKit and Blink do. Note: Starting in Gecko 5.0, the "word" granularity no longer includes the following space, regardless of the default platform behavior. This makes the behavio...
...ibero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus.</p> <label for="granularity">Granularity:</label> <select id="granularity"> <option value="character">Character</option> <option value="word">Word</option> <option value="sentence">Sentence</option> <option value="line">Line</option> <option value="paragraph">Paragraph</option> <option value="lineboundary">Line Boundary</option> <option value="sentenceboundary">Sentence Boundary</option> <option value="paragraphboundary">Paragraph Boundary</option> <option value="documentboundary">Document Boundary</option> </select> <br><br> <button>Extend selection</button> JavaScript let select = document.query...
Service Worker API - Web APIs
They will also allow access to push notifications and background sync APIs. Service worker concepts and usage A service worker is an event-driven worker registered against an origin and a path. ...
...ivation can happen sooner using ServiceWorkerGlobalScope.skipWaiting() and existing pages can be claimed by the active worker using Clients.claim(). You can listen for the InstallEvent; a standard action is to prepare your service worker for usage when this fires, for example by creating a cache using the built in storage API, and placing assets inside it that you'll want for running your app offline. There is also an activate event. The point where this event fires is generally a good time to clean up old caches and other things associated with the previous version of your service worker. Your service worker can respond to requests using the FetchEvent event. You can modify the response to these requests in any way you want, using the FetchEvent.respondWith method. Note: Because oninstal...
SourceBuffer.abort() - Web APIs
tion has not yet completed) a user "scrubs" the video seeking to a new point in time. In this case you would want to manually call abort() on the source buffer to stop the decoding of the current buffer, then fetch and append the newly requested segment that relates to the current new position of the video. ...
...y call abort() on the source buffer to stop the decoding of the current buffer, then fetch and append the newly requested segment that relates to the current new position of the video. You can see something similar in action in Nick Desaulnier's bufferWhenNeeded demo -- in line 48, an event listener is added to the playing video so a function called seek() is run when the seeking event fires. ...
SpeechGrammar.src - Web APIs
Web › API › SpeechGrammar › src
om within in the SpeechGrammar object. Syntax var myGrammar = speechGrammarInstance.src; Value A DOMString representing the grammar. ...
... Specifications Specification Status Comment Web Speech APIThe definition of 'src' in that specification. Draft ...
SpeechGrammar.weight - Web APIs
yntax var myGrammarWeight = speechGrammarInstance.weight; Value A float representing the weight of the grammar, in the range 0.0-1.0. ...
... Specifications Specification Status Comment Web Speech APIThe definition of 'weight' in that specification. Draft ...
SpeechGrammar - Web APIs
m within in the SpeechGrammar object instance. SpeechGrammar.weight Optional Sets and returns the weight of the SpeechGrammar object. ...
... Specifications Specification Status Comment Web Speech APIThe definition of 'SpeechGrammar' in that specification. Draft ...
SpeechGrammarList.item() - Web APIs
the SpeechGrammarList using array syntax. Syntax var myFirstGrammar = speechGrammarListInstance[0]; Returns A SpeechGrammar object. ...
... Specifications Specification Status Comment Web Speech APIThe definition of 'item()' in that specification. Draft ...
SpeechRecognition - Web APIs
The SpeechRecognition interface of the Web Speech API is the controller interface for the recognition service; this also handles the SpeechRecognitionEvent sent from the recognition service. Note: On some browsers, like Chrome, using Speech Recognition on a web page involves a server-based recognition engine. Your audio is sent to a web service for recognition processing, so it won't work offline. Constructor SpeechRecognition.SpeechRecognition() Creates a new SpeechRecognition object. Properties SpeechRecognition also inherits properties from its parent interface, EventTarget. SpeechRecognition.grammars Returns and sets a collection of SpeechGrammar objects that represent the grammars that will be understood by the current SpeechRecognition. SpeechRecognition.lang Returns ...
...handler fires, we extract the color that was spoken from the event object, and then set the background color of the <html> element to that color. ...
VTTRegion - Web APIs
Web › API › VTTRegion
VTTRegion interface--part of the API for handling WebVTT (text tracks on media presentations)--describes a portion of the video to render a VTTCue onto. Constructor VTTRegion() Returns a newly created VTTRegion object. Properties VTTRegion.id A DOMString that identifies the region. VTTRegion.width A double representing the width of the region, as a percentage of the video. VTTRegion.lines A double representing the height of the region, in number of lines. VTTRegion.regionAnchorX A double representing the region anchor X offset, as a percentage of the region. VTTRegion.regionAnchorY A double representing the region anchor Y offset, as a percentage of the region. VTTRegion.viewportAnchorX A double representing the viewport anchor X offset, as a percentage of the video. VTTR...
...Region.viewportAnchorX A double representing the viewport anchor X offset, as a percentage of the video. VTTRegion.viewportAnchorY A double representing the viewport anchor Y offset, as a percentage of the video. VTTRegion.scroll An enum representing how adding new cues will move existing cues. Examples var region = new VTTRegion(); region.width = 50; // Use 50% of the video width region.lines = 4; // Use 4 lines of height. region.viewportAnchorX = 25; // Have the region start at 25% from the left. var cue = new VTTCue(2, 3, 'Cool text to be displayed'); cue.region = region; // This cue will be drawn only within this region. Specifications Specification Status Comment WebVTT: The Web Video Text Tracks Format Candidate Recommendation ...
WEBGL_compressed_texture_s3tc - Web APIs
Recommendation Initial definition. ...
... Recommendation Initial definition. ...
WebGLRenderingContext.compressedTexImage[23]D() - Web APIs
Recommendation Initial definition for WebGL. OpenGL ES 2.0The definition of 'glCompressedTexImage2D' in that specification. Standard Man page of the (similar) Open...
... Recommendation Initial definition for WebGL. OpenGL ES 2.0The definition of 'glCompressedTexImage2D' in that specification. Standard Man page of the (similar) OpenGL ES 2.0 API. OpenGL ES 3.0The definition of 'glCompresse...
WebGLRenderingContext.getFramebufferAttachmentParameter() - Web APIs
gl.FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE A GLint indicating the number of bits in the alpha component of the attachment. gl.FRAMEBUFFER_ATTACHMENT_BLUE_SIZE A GLint indicating the number of bits in the blue component of the attachment. gl.FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING A GLenum indicating the encoding of components of the specified attachment. Either gl.LINEAR or gl.SRGB. gl.FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE A GLenum indicating the format of the components of the specified attachment. Either gl.FLOAT, gl.INT, gl.UNSIGNED_INT, gl.SIGNED_NORMALIZED, or gl.UNSIGNED_NORMALIZED. gl.FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE A GLint indicating the number of bits in the depth component of the attachment. gl.FRAMEBUFFER_ATTACHMENT...
...achment. gl.FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE A GLint indicating the number of bits in the stencil component of the attachment. gl.FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER A GLint indicating the number of the texture layer which contains the attached image. ext.FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT A GLenum indicating the framebuffer color encoding. Either gl.LINEAR or ext.SRGB_EXT. ext.FRAMEBUFFER_ATTACHMENT_TEXTURE_NUM_VIEWS_OVR A GLsizei indicating the number of views of the framebuffer object attachment. ext.FRAMEBUFFER_ATTACHMENT_TEXTURE_BASE_VIEW_INDEX_OVR A GLint indicating the base view index of the framebuffer object attachment. Exceptions A gl.INVALID_ENUM error is thrown if target is not gl.FRAMEBUFFER, gl.DRAW_...
WebGLRenderingContext.getParameter() - Web APIs
ny gl.getParameter(pname); Parameters pname A GLenum specifying which parameter value to return. See below for possible values. Return value Depends on the parameter. Parameter names WebGL 1 You can query the following pname parameters when using a WebGLRenderingContext. ...
... binding to the default framebuffer. See also bindFramebuffer. gl.FRONT_FACE GLenum gl.CW or gl.CCW. See also frontFace. gl.GENERATE_MIPMAP_HINT GLenum gl.FASTEST, gl.NICEST or gl.DONT_CARE. See also hint. ...
WebGLRenderingContext.texParameter[fi]() - Web APIs
ional texture. gl.TEXTURE_2D_ARRAY: A two-dimensional array texture. The pname parameter is a Glenum specifying the texture parameter to set. The param parameter is a GLfloat or GLint specifying the value for the specified parameter pname. pname Description param Available in WebGL 1 gl.TEXTURE_MAG_FILTER Texture magnification filter gl.LINEAR (default value), gl.NEAREST. gl.TEXTURE_MIN_FILTER Texture minification filter gl.LINEAR, gl.NEAREST, gl.NEAREST_MIPMAP_NEAREST, gl.LINEAR_MIPMAP_NEAREST, gl.NEAREST_MIPMAP_LINEAR (default value), gl.LINEAR_MIPMAP_LINEAR. gl.TEXTURE_WRAP_S Wrapping function for texture coordinate s gl.REPEAT (default value),gl.CLAMP_TO_EDGE, gl.MIRRORED_REPEAT. gl.TEXTURE_...
...RE_MAX_LOD Texture maximum level-of-detail value Any float values. gl.TEXTURE_MIN_LOD Texture minimum level-of-detail value Any float values. gl.TEXTURE_WRAP_R Wrapping function for texture coordinate r gl.REPEAT (default value), gl.CLAMP_TO_EDGE, gl.MIRRORED_REPEAT. Return value None. Examples gl.texParameterf(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR); gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR_MIPMAP_NEAREST); Specifications Specification Status Comment WebGL 1.0The definition of 'texParameter[fi]' in that specification. Recommendation Initial definition for WebGL. OpenGL ES 2.0The definition of 'glTexParameter' in that specification. Standard Man page of the (similar) O...
WebGLRenderingContext - Web APIs
ext.getParameter() Returns a value for the passed parameter name. WebGLRenderingContext.getError() Returns error information. WebGLRenderingContext.hint() Specifies hints for certain behaviors. The interpretation of these hints depend on the implementation. WebGLRenderingContext.isEnabled() Tests whether a specific WebGL capability is enabled or not for this context. WebGLRenderingContext.lineWidth() Sets the line width of rasterized lines. WebGLRenderingContext.pixelStorei() Specifies the pixel storage modes WebGLRenderingContext.polygonOffset() Specifies the scale factors and units to calculate depth values. WebGLRenderingContext.sampleCoverage() Specifies multi-sample coverage parameters for anti-aliasing effects. WebGLRenderingContext.stencilFunc() Sets the both front and ...
... by specifying its position and size in pixels. In the first canvas, we get the desired result. In the second, the square has the wrong shape, size, and position. ...
Color masking - Web APIs
values on the screen. By limiting the color channels that are written by each drawing command, you can use each channel, for example, to store a different grayscale image. Alternatively, you may use the RGB components for color, but the alpha component for some custom pixel data of your invention. Finally, color masking teaches us that WebGL is not only a state machine, it is also a graphics pipeline. This means that graphics operations in WebGL are done in a certain order, where the output of each operation serves as the input of the next. So, for example, clearing operation sets the value of each pixel to the chosen clear color. Masking occurs later in the pipeline, and modifies the pixel color value, so the final result on the screen is that of the clear color, tinted by the color mask. ...
...lor masking.</p> <canvas>Your browser does not seem to support HTML5 canvas.</canvas> <button id="red-toggle">On</button> <button id="green-toggle">On</button> <button id="blue-toggle">On</button> body { text-align : center; } canvas { display : block; width : 280px; height : 210px; margin : auto; padding : 0; border : none; background-color : black; } button { display : inline-block; font-family : serif; font-size : inherit; font-weight : 900; color : white; margin : auto; padding : 0.6em 1.2em; } #red-toggle { background-color : red; } #green-toggle { background-color : green; } #blue-toggle { background-color : blue; } window.addEventListener("load", function setupAnimation (evt) { "use strict" window.removeEventListener(evt.type, setupAnimati...
Matrix math for the web - Web APIs
a 3D point only needs three values (x, y, and z), and the transformation matrix is a 4x4 value matrix, we need to add a fourth dimension to the point. By convention, this dimension is called the perspective, and is represented by the letter w. For a typical position, setting w to 1 will make the math work out. After adding the w component to the point, notice how neatly the matrix and the point line up: [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1] [4, 3, 2, 1] // Point at [x, y, z, w] The w component has some additional uses that are out of scope for this article. Check out the WebGL model view projection article for a look into how it comes in handy. Multiplying a matrix and a point In our example code we have defined a function to multiply a matrix and a point -- multiplyMatr...
...id='move-me' class='transformable'> <h2>Move me with a matrix</h2> <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit...</p> </div> Finally, for each of the examples we will generate a 4x4 matrix, then update the <div>'s style to have a transform applied to it, set to a matrix3d. Bear in mind that even though the matrix is made up of 4 rows and 4 columns, it collapses into a single line of 16 values. Matrices are always stored in one-dimensional lists in JavaScript. // Create the matrix3d style property from a matrix array function matrixArrayToCssMatrix(array) { return 'matrix3d(' + array.join(',') + ')'; } // Grab the DOM element let moveMe = document.getElementById('move-me'); // Returns a result like: "matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 50, 100, 0, 1);" let m...
WebGL: 2D and 3D graphics for the web - Web APIs
Web › API › WebGL API
s EXT_blend_minmax EXT_color_buffer_float EXT_color_buffer_half_float EXT_disjoint_timer_query EXT_float_blend EXT_frag_depth EXT_sRGB EXT_shader_texture_lod EXT_texture_compression_bptc EXT_texture_compression_rgtc EXT_texture_filter_anisotropic KHR_parallel_shader_compile OES_element_index_uint OES_fbo_render_mipmap OES_standard_derivatives OES_texture_float OES_texture_float_linear OES_texture_half_float OES_texture_half_float_linear OES_vertex_array_object OVR_multiview2 WEBGL_color_buffer_float WEBGL_compressed_texture_astc WEBGL_compressed_texture_atc WEBGL_compressed_texture_etc WEBGL_compressed_texture_etc1 WEBGL_compressed_texture_pvrtc WEBGL_compressed_texture_s3tc WEBGL_compressed_texture_s3tc_srgb WEBGL_debug_renderer_info WEBGL_debug_shaders WEBGL...
...WebGL calculations and in CSS3 transforms. Resources Raw WebGL: An introduction to WebGL A talk by Nick Desaulniers that introduces the basics of WebGL. This is a great place to start if you've never done low-level graphics programming. Khronos WebGL site The main web site for WebGL at the Khronos Group. WebGL Fundamentals A basic tutorial with fundamentals of WebGL. WebGL playground An online tool for creating and sharing WebGL projects. Good for quick prototyping and experimenting. WebGL Academy An HTML/JavaScript editor with tutorials to learn basics of webgl programming. WebGL Stats A site with statistics about WebGL capabilities in browsers on different platforms. Libraries glMatrix is a JavaScript matrix and vector library for high-performance WebGL apps. PhiloGL is a Web...
Introduction to the Real-time Transport Protocol (RTP) - Web APIs
ection.getSenders(). RTCRtpReceiver RTCRtpReceivers provide the ability to inspect and obtain information about incoming MediaStreamTrack data. A connection's receivers can be obtained by calling RTCPeerConnection.getReceivers(). RTCRtpTransceiver An RTCRtpTransceiver is a pair of one RTP sender and one RTP receiver which share an SDP mid attribute, which means they share the same SDP media m-line (representing a bidirectional SRTP stream). These are returned by the RTCPeerConnection.getTransceivers() method, and each mid and transceiver share a one-to-one relationship, with the mid being unique for each RTCPeerConnection. Leveraging RTP to implement a "hold" feature Because the streams for an RTCPeerConnection are implemented using RTP and the interfaces above, you can take advantage o...
...od below is called. It accepts as input a MediaStream containing the audio to play while the call is on hold. async function enableHold(audioStream) { try { await audioTransceiver.sender.replaceTrack(audioStream.getAudioTracks()[0]); audioTransceiver.receiver.track.enabled = false; audioTransceiver.direction = "sendonly"; } catch(err) { /* handle the error */ } } The three lines of code within the try block perform the following steps: Replace their outgoing audio track with a MediaStreamTrack containing hold music. Disable the incoming audio track. Switch the audio transceiver into send-only mode. This triggers renegotiation of the RTCPeerConnection by sending it a negotiationneeded event, which your code responds to generating an SDP offer using RTCPeerConnecti...
A simple RTCDataChannel sample - Web APIs
First, we call RTCPeerConnection.createOffer() method to create an SDP (Session Description Protocol) blob describing the connection we want to make. This method accepts, optionally, an object with constraints to be met for the connection to meet your needs, such as whether the connection should support audio, video, or both. In our simple example, we don't ...
... First, we call RTCPeerConnection.createOffer() method to create an SDP (Session Description Protocol) blob describing the connection we want to make. This method accepts, optionally, an object with constraints to be met for the connection to meet your needs, such as whether the connection should support audio, video, or both. In our simple example, we don't have any...
Viewpoints and viewers: Simulating cameras in WebXR - Web APIs
e WebGL or the WebXR API that represents the viewer that you can simply rotate and move around to automatically change what's seen on the screen. In this guide we show how use WebGL to simulate camera movements without having a camera to move. These techniques can be used in any WebGL (or WebXR) project. Animating 3D graphics is an area of software development that brings together multiple disciplines in computer science, mathematics, art, graphic design, kinematics, anatomy, physiology, physics, and cinematography. Since we don't have a real camera, we imagine one, reproducing the effect of having a camera, without actually having the ability to move the user around the scene. There are a few articles about the fundamental math, geometry, and other concepts behind WebGL and WebXR which may ...
...ated within the player's avatar's head, facing in the same direction as the avatar's eyes. This way, the view presented on the player's screen or headset is what their avatar would be seeing. In some third-person games, the camera is located a short distance behind the player's avatar or vehicle, showing them from behind as they move through the game world. This is used in a lot of multiplayer online role-playing games, certain shooter games, and so forth. Popular examples include World of Warcraft, Tomb Raider, and Fortnite. This category also includes games where the camera is placed just over the player's shoulder. Some 3D games offer the ability to change your point of view, such as to look out the various windows of an aircraft in a flight simulator, or to see the views from all the sec...
Fundamentals of WebXR - Web APIs
up and down Yaw: looking left and right Roll: tilting left and right In all of these cases, the viewer remains in the same location in space while pivoting on one or more of the three axes to alter the direction in which they're looking. A system with two degrees of freedom can sense when the user looks left and right or up and down, but can't report any other kind of movement. A typical baseline headset offers three degrees of freedom, recognizing rotation around all three axes. This is often referred to by the shorthand 3DoF. Freedom of translational movement The other three degrees of freedom are translational, providing the ability to sense movement through space: forward and backward, left and right, up and down. Support for all six degrees of freedom is referred to as 6DoF. <<<...
.... Your frame drawing code will have to redraw every pixel of each view during each frame in order to avoid the potential of artifacts being left behind. Some platforms may provide previously-cleared frames to you, while others may optimize performance by not erasing the framebuffers in order to avoid having to touch each pixel twice per frame. There are two VR session modes available in WebXR: inline and immersive. The former, specified by the session mode string inline, presents the rendered scene within the context of a document in a web browser, and doesn't require special XR hardware to view. The immersive session mode is indicated using the session mode immersive-vr. This session mode requires an XR device such as a headset, and replaces the entire world with the rendered scene using the...
Geometry and reference spaces in WebXR - Web APIs
ng is optimized for stability around the user's current position, so the native origin may drift as needed to accommodate that need. XRReferenceSpace viewer A tracking space whose native origin tracks the viewer's position and orientation. This is used for environments in which the user can physically move around, and is supported by all instances of XRSession, both immersive and inline, though it's most useful for inline sessions. It's particularly useful when determining the distance between the viewer and an input, or when working with offset spaces. Otherwise, typically, one of the other reference space types will be used more often. XRReferenceSpace The remainder of this guide explores how to select the right reference space for your app's needs. Defining spatia...
... don't support the avatar's vertical position changing. The primary reference space types The viewer reference space corresponds to the viewer's position in space; it's used by the XRViewerPose returned by the XRFrame method getViewerPose(). It's not typically used directly otherwise. The only real exception is that you are likely to use the viewer reference space when performing the XR scene inline within web content. The local reference space is typically used to describe a relatively small area, such as a single room. It is not only always available when using an immersive session mode (immersive-vr or immersive-ar), but is always included among the optional features when requesting a new session; thus, every session created by navigator.xr.requestSession() supports the local reference s...
WebXR permissions and security - Web APIs
d has focus. The user's intent to enter immersive VR mode is well understood; see User intent below for details. If all of that is true, the promise returned by requestSession() is resolved, and the new XRSession object is passed into the fulfillment handler. Otherwise, an appropriate exception is thrown, such as SecurityError if the document doesn't have permission to enter immersive mode. Inline presentation When you request an XRSession with the mode set to inline, and any features are required or requested, the browser will only allow the session to be created if the call to requestSession() was made by code which is executing expressly due to user intent. Specifically: If the requestSession() call isn't coming from within the handler executed in response to a user event, and is n...
...ment handler. If the document making the request isn't the one which is responsible for the script, the request is denied. If the document making the request isn't trustworthy, the request is denied and false is returned through the promise's fulfillment routine. A trustworthy document is one which is both responsible and active, and which currently has focus. If the user's intent to open an inline XR presentation is not well understood, the request is denied. Understanding of the user's intent may be either implicit or explicit. Note: Additional requirements may be put into effect due to the specific features requested by the options object when calling requestSession(). User intent User intent is the concept of whether or not an action being performed by code is being performed beca...
Spaces and reference spaces: Spatial tracking in WebXR - Web APIs
e viewer in order to place the virtual camera and render the scene. The only way to obtain a pose that adapts positional information from one space to another is through the XRFrame object received by your frame rendering callback function specified when you called the XRSession method requestAnimationFrame(). ...
...fSpace with one whose coordinates and orientation have had the transform halfMeterTransform applied. With no orientation data included in the transform, the orientation of aRefSpace is unaffected. Converting between WebXR session types Another common reason you may need to convert positional information from one reference space to another is when it's necessary to change the session type from inline to immersive-vr or back. This commonly happens when your user interface provides a way to preview the scene inline within the context of a web page, with a button or other control to switch to immersive mode. Since most users would prefer that you maintain the same viewer position and facing direction while performing this transition, you can use the XRFrame method getViewerPose() to obtain the ...
Using the Web Storage API - Web APIs
make use of this technology. Basic concepts Storage objects are simple key-value stores, similar to objects, but they stay intact through page loads. The keys and the values are always strings (note that, as with objects, integer keys will be automatically converted to strings). You can access these values like an object, or with the Storage.getItem() and Storage.setItem() methods. These three lines all set the (same) colorSetting entry: localStorage.colorSetting = '#a4509b'; localStorage['colorSetting'] = '#a4509b'; localStorage.setItem('colorSetting', '#a4509b'); Note: It's recommended to use the Web Storage API (setItem, getItem, removeItem, key, length) to prevent the pitfalls associated with using plain objects as key-value stores. The two mechanisms within Web Storage are as foll...
...Next, we set the values displayed in the form elements to those values, so that they keep in sync when you reload the page. Finally, we update the styles/decorative image on the page, so your customization options come up again on reload. Setting values in storage Storage.setItem() is used both to create new data items, and (if the data item already exists) ...
Using Web Workers - Web APIs
nt named error which implements the ErrorEvent interface. The event doesn't bubble and is cancelable; to prevent the default action from taking place, the worker can call the error event's preventDefault() method. The error event has the following three fields that are of interest: message A human-readable error message. filename The name of the script file in which the error occurred. lineno The line number of the script file on which the error occurred. Spawning subworkers Workers may spawn more workers if they wish. So-called sub-workers must be hosted within the same origin as the parent page. Also, the URIs for subworkers are resolved relative to the parent worker's location rather than that of the owning page. This makes it easier for workers to keep track of where their d...
...orkers, which may then perform those tasks on multiple-processor cores. Other types of worker In addition to dedicated and shared web workers, there are other types of worker available: ServiceWorkers essentially act as proxy servers that sit between web applications, and the browser and network (when available). They are intended to (amongst other things) enable the creation of effective offline experiences, intercepting network requests and taking appropriate action based on whether the network is available and updated assets reside on the server. They will also allow access to push notifications and background sync APIs. Chrome Workers are a Firefox-only type of worker that you can use if you are developing add-ons and want to use workers in extensions and have access to js-ctypes in ...
WheelEvent.deltaMode - Web APIs
DOM_DELTA_PAGE 0x02 The delta values are specified in pages. ...
... DOM_DELTA_PAGE 0x02 The delta values are specified in pages. ...
Window.getComputedStyle() - Web APIs
the <p>. HTML <p>Hello</p> CSS p { width: 400px; margin: 0 auto; padding: 20px; font: 2rem/2 sans-serif; text-align: center; background: purple; color: white; } JavaScript let para = document.querySelector('p'); let compStyles = window.getComputedStyle(para); para.textContent = 'My computed font-size is ' + compStyles.getPropertyValue('font-size') + ',\nand my computed line-height is ' + compStyles.getPropertyValue('line-height') + '.'; Result Description The returned object is the same CSSStyleDeclaration type as the object returned from the element's style property. However, the two objects have different purposes: The object from getComputedStyle is read-only, and should be used to inspect the element's style -- including those set by a <style> el...
....defaultView object. In nearly all cases, this is needless, as getComputedStyle exists on the window object as well. It's likely the defaultView pattern was a combination of folks not wanting to write a testing spec for window and making an API that was also usable in Java. Use with pseudo-elements getComputedStyle can pull style info from pseudo-elements (such as ::after, ::before, ::marker, ::line-marker -- see the pseudo-element spec). <style> h3::after { content: ' rocks!'; } </style> <h3>Generated content</h3> <script> var h3 = document.querySelector('h3'); var result = getComputedStyle(h3, ':after').content; console.log('the generated content is: ', result); // returns ' rocks!' </script> Notes The returned CSSStyleDeclaration object contains active values for CS...
WindowOrWorkerGlobalScope.setInterval() - Web APIs
nIdx = 0, sPart = "", aSheets = [], aMap = []; this.rate = nRate || 100; this.play = function () { if (bTyping) { return; } if (bStart) { var aItems = document.querySelectorAll(sSelector); if (aItems.length === 0) { return; } for (var nItem = 0; nItem < aItems.length; nItem++) { aSheets.push(new Sheet(aItems[nItem])); /* Uncomment the following line if you have previously hidden your elements via CSS: */ // aItems[nItem].style.visibility = "visible"; } bStart = false; } nIntervId = setInterval(typewrite, this.rate); bTyping = true; }; this.pause = function () { clearInterval(nIntervId); bTyping = false; }; this.terminate = function () { oCurrent.nodeValue += sPart; sPart = ""; f...
...15); /* default frame rate is 100: */ var oTWExample2 = new Typewriter('#controls'); /* you can also change the frame rate value modifying the "rate" property; for example: */ // oTWExample2.rate = 150; onload = function () { oTWExample1.play(); oTWExample2.play(); }; </script> <style type="text/css"> span.intLink, a, a:visited { cursor: pointer; color: #000000; text-decoration: underline; } #info { width: 180px; height: 150px; float: right; background-color: #eeeeff; padding: 4px; overflow: auto; font-size: 12px; margin: 4px; border-radius: 5px; /* visibility: hidden; */ } </style> </head> <body> <p id="copyleft" style="font-style: italic; font-size: 12px; text-align: center;">CopyLeft 2012 by <a href="https://developer.mozilla.org/" target="_blank">Mozilla...
WorkerGlobalScope.dump() - Web APIs
lows you to write a message to stdout -- i.e. in your terminal, in Firefox only. This is the same as Firefox's window.dump, but for workers. Syntax dump('My message\n'); Parameters A DOMString containing the message you want to send. Returns Void. ...
...rminal, you first have to run an instance of Firefox started from your command line/terminal. For example, on Mac OS X you'd run it using something like this (assuming you are inside the Applications folder): ./Firefox.app/Contents/MacOS/firefox-bin -profile /tmp -no-remote Now go into about:config and enable the browser.dom.window.dump.enabled pref. Next, run a worker containing the following line: dump('test\n'); This should result in a "test" message being output to the terminal. Specifications This method does not appear in any specification. ...
WorkerGlobalScope.navigator - Web APIs
r; Value A WorkerNavigator object. ...
... Specifications Specification ...
WritableStream.WritableStream() - Web APIs
err); } }, queuingStrategy); sendMessage("Hello, world.", writableStream); You can find the full code in our Simple writer example. Backpressure Because of how backpressure is supported in the API, its implementation in code may be less than obvious. To see how backpressure is implemented look for three things. The highWaterMark property, which is set when creating the counting strategy (line 35), sets the maximum amount of data that the WritableStream instance will handle in a single write() operation. In this example, it's the maximum amount of data that can be sent to defaultWriter.write() (line 11). The defaultWriter.ready property returns a promise that resolves when the sink (the first property of the WritableStream constructor) is done writing data. The data source can wither ...
...ximum amount of data that the WritableStream instance will handle in a single write() operation. In this example, it's the maximum amount of data that can be sent to defaultWriter.write() (line 11). The defaultWriter.ready property returns a promise that resolves when the sink (the first property of the WritableStream constructor) is done writing data. The data source can wither write more data (line 11) or call close() (line 24). Calling close() too early can prevent data from being written. This is why the example calls defaultWriter.ready twice (lines 9 and 22). The Promise returned by the sink's write() method (line 40) tells the WritableStream and its writer when to resolve defaultWriter.ready. Specifications Specification Status Comment StreamsThe definition...
WritableStream - Web APIs
err); } }, queuingStrategy); sendMessage("Hello, world.", writableStream); You can find the full code in our Simple writer example. Backpressure Because of how backpressure is supported in the API, its implementation in code may be less than obvious. To see how backpressure is implemented look for three things. The highWaterMark property, which is set when creating the counting strategy (line 35), sets the maximum amount of data that the WritableStream instance will handle in a single write() operation. In this example, it's the maximum amount of data that can be sent to defaultWriter.write() (line 11). The defaultWriter.ready property returns a promise that resolves when the sink (the first property of the WritableStream constructor) is done writing data. The data source can either ...
...ximum amount of data that the WritableStream instance will handle in a single write() operation. In this example, it's the maximum amount of data that can be sent to defaultWriter.write() (line 11). The defaultWriter.ready property returns a promise that resolves when the sink (the first property of the WritableStream constructor) is done writing data. The data source can either write more data (line 9) or call close() (line 24). Calling close() too early can prevent data from being written. This is why the example calls defaultWriter.ready twice (lines 9 and 22). The Promise returned by the sink's write() method (line 40) tells the WritableStream and its writer when to resolve defaultWriter.ready. Specifications Specification Status Comment StreamsThe definition ...
Sending and Receiving Binary Data - Web APIs
om the specified URL, returning it to the caller. function load_binary_resource(url) { var req = new XMLHttpRequest(); req.open('GET', url, false); //XHR binary charset opt by Marcus Granado 2006 [http://mgran.blogspot.com] req.overrideMimeType('text\/plain; charset=x-user-defined'); req.send(null); if (req.status != 200) return ''; return req.responseText; } The magic happens in line 5, which overrides the MIME type, forcing the browser to treat it as plain text, using a user-defined character set. This tells the browser not to parse it, and to let the bytes pass through unprocessed. var filestream = load_binary_resource(url); var abyte = filestream.charCodeAt(x) & 0xff; // throw away high-order byte (f7) The example above fetches the byte at offset x within the loaded bin...
... here. Submitting forms and uploading files Please, read this paragraph. Firefox-specific examples This example transmits binary content asynchronously, using the POST method, and Firefox's non-standard sendAsBinary(). var req = new XMLHttpRequest(); req.open("POST", url, true); // set headers and mime-type appropriately req.setRequestHeader("Content-Length", 741); req.sendAsBinary(aBody); Line 4 sets the Content-Length header to 741, indicating that the data is 741 bytes long. Obviously you need to change this value based on the actual size of the data being sent. Line 5 uses the sendAsBinary() method to initiate the request. Note: This non-standard sendAsBinary method is considered deprecated as of Gecko 31 (Firefox 31 / Thunderbird 31 / SeaMonkey 2.28) and will be removed soon. Th...
XRPermissionDescriptor.mode - Web APIs
The mode property of the XRPermissionDescriptor dictionary is a string taken from the XRSessionMode enumerated type, specifying which Web XR session mode (inline, immersive-vr, or immersive-ar) the described permissions will be used for. Syntax xrPermissionDescriptor = { mode: xrSessionMode, requiredFeatures: reqFeatureList, optionalFeatures: optFeatureList }; xrPermissionDescriptor.mode = xrSessionMode; xrMode = xrPermissionDescriptor.mode; Value A DOMString whose value is one of the strings found in the XRSessionMode enumerated type: immersive-ar The session's output will be given exclusive access to the immersive device, but the rendered content will be blended with the real-world environment. The session's environmentBlendMode indicates the method to be used to blend...
...h is not yet stable and should not be used other than for testing and experimentation. immersive-vr Indicates that the rendered session will be displayed using an immersive XR device in VR mode; it is not intended to be overlaid or integrated into the surrounding environment. The environmentBlendMode is expected to be opaque if possible, but might be additive if the hardware requires it. inline The output is presented inline within the context of an element in a standard HTML document, rather than occupying the full visual space. Inline sessions can be presented in either mono or stereo mode, and may or may not have viewer tracking available. Inline sessions don't require special hardware and should be avalable on any user agent offering WebXR API support. Usage notes Examples The ...
XRRenderState - Web APIs
The XRRenderState interface of the WebXR Device API contains configurable values which affect how the imagery generated by an XRSession gets composited. These properties include the range of distances from the viewer within which content should be rendered, the vertical field of view (for inline presentations), and a reference to the XRWebGLLayer being used as the target for rendering the scene prior to it being presented on the XR device's display or displays. When you apply changes using the XRSession method updateRenderState(), the specified changes take effect after the current animation frame has completed, but before the next one begins. Properties The followiing properties are available on XRRenderState objects. baseLayer Read only The XRWebGLLayer from which the b...
...play beyond which rendering of the scene no longer takes place. This, essentially, specifies the maximum distance the user can see. depthNear Read only The distance, in meters, of the near clip plane from the viewer. The near clip plane is the plane, parallel to the display, at which rendering of the scene begins. Any closer to the viewer than this, and no portions of the scene are drawn. inlineVerticalFieldOfView Read only The default vertical field of view, defined in radians, to use when the session is in inline mode. null for all immersive sessions. Specifications Specification Status Comment WebXR Device APIThe definition of 'XRRenderState' in that specification. Working Draft Initial definition. ...
XRSession.requestAnimationFrame() - Web APIs
session. This can be used to obtain the poses of the viewer and the scene itself, as well as other information needed to render a frame of an AR or VR scene. Return value An integer value which serves as a unique, non-zero ID or handle you may pass to cancelAnimationFrame() if you need to remove the pending animation frame request. ...
...n with "inline" mode so that it can be displayed in an HTML element (without the need for a separate AR or VR device). Note: A real application should check that the device and the User Agent support WebXR API at all and then that they both support the desired session type via XR.isSessionSupported(). ...
XRSession.updateRenderState() - Web APIs
place between the distances specified by depthNear and depthFar. This is 1000 meters (1 kilometer) by default. depthNear Optional A floating-point value indicating the distance in meters from the viewer to a plane parallel to the display surface to be the near clip plane. No part of the scene on the viewer's side of this plane will be rendered. This is 0.1 meters (10 centimeters) by default. inlineVerticalFieldOfView Optional A floating-point value indicating the default field of view, in radians, to be used when computing the projection matrix for an inline XRSession. The projection matrix calculation also takes into account the output canvas's aspect ratio. This property must not be specified for immersive sessions, so the value is null by default for immersive sessions. The default valu...
... may throw any of the following exceptions. These are true exceptions, since this method does not return a promise. InvalidStateError This may occur for one of the following reasons: The XRSession has already ended, so you cannot change its render state. The baseLayer specified in newState was created by an XRSession other than the one on which updateRenderState() was called. The inlineVerticalFieldOfView property was set, but the session is immersive and therefore does not allow this property to be used. Examples This example creates a WebGL context that is compatible with an immersive XR device and then uses it to create an XRWebGLLayer. updateRenderState() is then called to associate the new XRWebGLLayer. function onXRSessionStarted(xrSession) { let glCanvas = docum...
XRSessionMode - Web APIs
h is not yet stable and should not be used other than for testing and experimentation. immersive-vr Indicates that the rendered session will be displayed using an immersive XR device in VR mode; it is not intended to be overlaid or integrated into the surrounding environment. The environmentBlendMode is expected to be opaque if possible, but might be additive if the hardware requires it. inline The output is presented inline within the context of an element in a standard HTML document, rather than occupying the full visual space. Inline sessions can be presented in either mono or stereo mode, and may or may not have viewer tracking available. Inline sessions don't require special hardware and should be avalable on any user agent offering WebXR API support. Usage notes The XRSessionM...
...R.isSessionSupported() to determine whether or not the specified session type is supported and available to be used, and by requestSession() to attempt to open a new WebXR session. The immersive-ar mode supports all the same features and reference spaces that immersive-vr does, since both are immersive sessions. Browsers may support either or both of these modes, but if WebXR is available, the inline mode is always supported. Specifications Specification Status Comment WebXR Device APIThe definition of 'XRSessionMode' in that specification. Working Draft Initial definition. WebXR Augmented Reality ModuleThe definition of 'XRSessionMode: immersive-ar' in that specification. Editor's Draft The immersive-ar value added ...
XRSystem: requestSession() - Web APIs
Syntax var sessionPromise = xr.requestSession(sessionMode, sessionInit) Parameters sessionMode A DOMString whose value is one of those included in the XRSessionMode enum. ...
...h is not yet stable and should not be used other than for testing and experimentation. immersive-vr Indicates that the rendered session will be displayed using an immersive XR device in VR mode; it is not intended to be overlaid or integrated into the surrounding environment. The environmentBlendMode is expected to be opaque if possible, but might be additive if the hardware requires it. inline The output is presented inline within the context of an element in a standard HTML document, rather than occupying the full visual space. Inline sessions can be presented in either mono or stereo mode, and may or may not have viewer tracking available. Inline sessions don't require special hardware and should be avalable on any user agent offering WebXR API support. sessionInit Optional A XRS...
Using the link role - Accessibility
t, or make you explicitly agree to allowing popups form the domain it exists on. ...
... domain it exists on. ...
ARIA: grid role - Accessibility
mily: "Helvetica Neue", sans-serif; } table { margin: 0; border-collapse: collapse; font-variant-numeric: tabular-nums; } tbody th, tbody td { padding: 5px; } tbody td { border: 1px solid #000; text-align: right; color: #767676; } tbody td[role="gridcell"] { color: #000; } tbody td[role="gridcell"]:hover, tbody td[role="gridcell"]:focus { background-color: #f6f6f6; outline: 3px solid blue; } } JavaScript var selectables = document.querySelectorAll('table td[role="gridcell"]'); selectables[0].setAttribute('tabindex', 0); var trs = document.querySelectorAll('table tbody tr'), row = 0, col = 0, maxrow = trs.length - 1, maxcol = 0; Array.prototype.forEach.call(trs, function(gridrow, i){ Array.prototype.forEach.call(gridrow.querySelectorAll('td'...
...ional Rows ... ...
Accessibility
king sure the correct HTML elements are used for the correct purpose at all times. This article looks in detail at how HTML can be used to ensure maximum accessibility. CSS and JavaScript accessibility best practices CSS and JavaScript, when used properly, also have the potential to allow for accessible web experiences ... or they can significantly harm accessibility if misused. This article outlines some CSS and JavaScript best practices that should be considered to ensure even complex content is as accessible as possible. WAI-ARIA basics Following on from the previous article, sometimes making complex UI controls that involve unsemantic HTML and dynamic JavaScript-updated content can be difficult. WAI-ARIA is a technology that can help with such problems by adding in further semantics th...
...s how. Mobile accessibility With web access on mobile devices being so popular, and popular platforms such as iOS and Android having fully-fledged accessibility tools, it is important to consider the accessibility of your web content on these platforms. This article looks at mobile-specific accessibility considerations. Other documentation Understanding the Web Content Accessibility Guidelines This set of articles provides quick explanations to help you understand the steps that need to be taken to conform to the recommendations outlined in the W3C Web Content Accessibility Guidelines 2.0 (WCAG 2.0 or just WCAG, for the purposes of this writing). Keyboard-navigable JavaScript widgets Until now, web developers who want to make their styled <div> and <span> based widgets accessib...
::after (:after) - CSS: Cascading Style Sheets
Web › CSS › ::after
/* Add an arrow after links */ a::after { content: "->"; } Note: The pseudo-elements generated by ::before and ::after are contained by the element's formatting box, and thus don't apply to replaced elements such as <img>, or to <br> elements. Syntax /* CSS3 syntax */ ::after /* CSS2 syntax */ :after Note: CSS3 introduced the ::after notation (with two colons) to distinguish pseudo-classes from pseudo-elements. ...
... widget created in some other way (such as with details and summary elements) is likely to be more appropriate. HTML <p>Here we have some <span tabindex="0" data-descr="collection of words and punctuation">text</span> with a few <span tabindex="0" data-descr="small popups that appear when hovering">tooltips</span>. ...
::before (:before) - CSS: Cascading Style Sheets
Web › CSS › ::before
/* Add a heart before links */ a::before { content: "<3"; } Note: The pseudo-elements generated by ::before and ::after are contained by the element's formatting box, and thus don't apply to replaced elements such as <img>, or to <br> elements. ...
... Working Draft No significant changes to the previous specification. CSS Animations Working Draft Allows animations on properties defined on pseudo-elements. Selectors Level 3The definition of '::before...
::grammar-error - CSS: Cascading Style Sheets
The ::grammar-error CSS pseudo-element represents a text segment which the user agent has flagged as grammatically incorrect. ...
... Working Draft Initial definition. ...
:only-child - CSS: Cascading Style Sheets
d to have a parent. Beginning with Selectors Level 4, this is no longer required. ...
...th Selectors Level 4, this is no longer required. ...
Detecting CSS animation support - CSS: Cascading Style Sheets
- and with Chrome it'll be WebkitAnimation and -webkit-. Notice browsers don't make it easy with the switching between camelCase and hyphen-ation. Animating using the correct syntax for different browsers Now that you know if CSS animation is supported or not, we can animate. ...
... each attribute as it's constructed. This variable, once constructed, contains the complete description of all the keyframes needed by our animation sequence. The next task is to actually add the keyframes to the page's CSS. The first thing to do is look to see if there's already a style sheet on the document; if so, we simply insert the keyframe description into that stylesheet; this is done in lines 13-15. If there isn't already a style sheet, a new <style> element is created, and its content is set to the value of keyframes. Then the new <style> element is inserted into the document's <head>, thereby adding the new style sheet to the document. View on JSFiddle ...
Using multiple backgrounds - CSS: Cascading Style Sheets
ndividual properties thereof except for background-color. That is, the following background properties can be specified as a list, one per background: background, background-attachment, background-clip, background-image, background-origin, background-position, background-repeat, background-size. ...
...nd-repeat, background-size. ...
Box alignment in Flexbox - CSS: Cascading Style Sheets
The first item overrides the align-items values set on the group by setting align-self to center. The axes and flex-direction Flexbox respects the writing mode of the document, therefore if you are working in English and set justify-content to flex-end this will align the items to the end of the flex container. If you are working with flex-direction set to row, this alignment will be in the inline direction. However, in Flexbox you can change the main axis by setting flex-direction to column. In this case, justify-content will align items in the block direction. Therefore it is easiest to think about the main and cross axis when working in Flexbox like so: The main axis = direction set by flex-direction = alignment via justify-content The cross axis = runs across the main axis = align...
...e available for the auto margin, the item behaves in the same way as all the other flex items and shrinks to try to fit into space. The gap properties row-gap column-gap gap Creating fixed size gaps between items On the main axis, the column-gap property will create fixed size gaps between adjacent items. On the cross axis the row-gap property will create spacing between adjacent flex lines, therefore flex-wrap must also be set to wrap for this to have any effect. Reference CSS Properties justify-content align-content place-content justify-items align-items place-items align-self row-gap column-gap gap Glossary Entries Cross axis Main axis Guides Alignment in flexbox External Resources Box alignment cheatsheet CSS Grid, Flexbox and Box Alignment ...
Mastering margin collapsing - CSS: Cascading Style Sheets
are equal), a behavior known as margin collapsing. Note that the margins of floating and absolutely positioned elements never collapse. Margin collapsing occurs in three basic cases: Adjacent siblings The margins of adjacent siblings are collapsed (except when the latter sibling needs to be cleared past floats). No content separating parent and descendants If there is no border, padding, inline part, block formatting context created, or clearance to separate the margin-top of a block from the margin-top of one or more of its descendant blocks; or no border, padding, inline content, height, min-height, or max-height to separate the margin-bottom of a block from the margin-bottom of one or more of its descendant blocks, then those margins collapse. The collapsed margin ends up outside the...
... Some things to note: More complex margin collapsing (of more than two margins) occurs when the above cases are combined. ...
Flow Layout and Overflow - CSS: Cascading Style Sheets
th values in which case the first is used for overflow-x and therefore the horizontal direction, and the second for overflow-y and the vertical direction. In the below example, I have only specified overflow-y: scroll so we do not get the unwanted horizontal scrollbar. Flow Relative Properties In the guide to Writing Modes and Flow Layout, we looked at the newer properties of block-size and inline-size which make more sense when working with different writing modes than tying our layout to the physical dimensions of the screen. The Level 3 Overflow Module also includes flow relative properties for overflow - overflow-block and overflow-inline. These correspond to overflow-x and overflow-y but the mapping depends on the writing mode of the document. These properties currently do not have i...
...verflow-y but the mapping depends on the writing mode of the document. These properties currently do not have implementations in browsers, so you will need to use the physical properties at the present time and adjust for your writing mode. Indicating Overflow In the Level 3 Overflow specification we have some properties which can help improve the way content looks in an overflow situation. Inline-Axis Overflow The text-overflow property deals with text overflowing in the inline direction. It takes one of two values clip, in which case content is clipped when it overflows, this is the initial value and therefore the default behaviour. We also have ellipsis which renders an ellipsis, which may be replaced with a better character for the language or writing mode in use. Block-Axis Overfl...
CSS Fragmentation - CSS: Cascading Style Sheets
It also occurs when a block spans more than one column inside a column layout container, or spans a page break when printed. Each piece of the rendering for the element is called a fragment. ...
...It also occurs when a block spans more than one column inside a column layout container, or spans a page break when printed. Each piece of the rendering for the element is called a fragment. ...
CSS Grid Layout - CSS: Cascading Style Sheets
s are either possible or easier with CSS grid than they were with tables. For example, a grid container's child elements could position themselves so they actually overlap and layer, similar to CSS positioned elements. 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. Items have been placed onto the grid using line-based placement. * {box-sizing: border-box;} .wrapper { max-width: 940px; margin: 0 auto; } .wrapper > div { border: 2px solid rgb(233,171,88); border-radius: 5px; background-color: rgba(233,171,88,.5); padding: 1em; color: #d9480f; } HTML <div class="wrapper"> <div class="one">One</div> <div class="two">Two</div> <div class="three">Three</div> <div class="four">Four</...
... CSS properties grid-template-columns grid-template-rows grid-template-areas grid-template grid-auto-columns grid-auto-rows grid-auto-flow grid grid-row-start grid-column-start grid-row-end grid-column-end grid-row grid-column grid-area row-gap column-gap gap CSS functions repeat() minmax() fit-content() CSS data types <flex> Glossary entries Grid Grid Lines Grid Tracks Grid Cell Grid Area Gutters Grid Axis Grid row Grid column Guides Basic concepts of Grid Layout Relationship of Grid Layout to other layout methods Layout using line-based placement Grid template areas Layout using named grid lines Auto-placement in CSS Grid Layout Box alignment in CSS Grid Layout CSS Grid, Logical Values and Writing Modes CSS Grid Layout and ac...
CSS Overflow - CSS: Cascading Style Sheets
ntent of a box extends past one or more of the box's edges. Ink overflow and scrollable overflow There are two types of overflow that you might encounter in CSS. The first is described as ink overflow. This is the overflow of painting effects which do not affect layout or otherwise extend the scrollable overflow region, such as box shadows, border images, text decoration, overhanging glyphs, outlines, etc. The overflow that we sometimes need to manage in CSS is described as scrollable overflow. This is the content appearing outside of the box for which scrolling mechanisms need to be provided. The overflow properties are how we can control what happens when content overflows a box. Basic example The following interactive example shows how changing the value of the overflow property, chan...
...anging the value of the overflow property, changes how the overflow of a fixed height box is dealt with. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Reference CSS properties overflow overflow-block overflow-inline overflow-x overflow-y text-overflow block-overflow line-clamp max-lines continue Non-standard properties -webkit-line-clamp Specifications Specification Status Comment CSS Overflow Module Level 3The definition of 'overflow' in that specification. Working Draft Changed syntax to allow one or two keywords instead of only one ...
CSS values and units - CSS: Cascading Style Sheets
d keywords are text values defined by the specification for that property. These keywords are also CSS Identifiers and are therefore used without quotes. When viewing CSS property value syntax in a CSS specification or the MDN property page, allowable keywords will be listed in the following form. The following values are the pre-defined keyword values allowed for float. left | right | none | inline-start | inline-end Such values are used without quotes: .box { float: left; } CSS-wide values In addition to the pre-defined keywords that are part of the specification for a property, all CSS properties accept the CSS-wide property values initial, inherit, and unset, which explicitly specify defaulting behaviors. The initial keyword represents the value specified as the property's init...
... nominal height of capital letters) of the element's font. ch Average character advance of a narrow glyph in the element's font, as represented by the "0" (ZERO, U+0030) glyph. ic Average character advance of a full width glyph in the element's font, as represented by the "?" (CJK water ideograph, U+6C34) glyph. rem Font size of the root element. lh Line height of the element. rlh Line height of the root element. vw 1% of viewport's width. vh 1% of viewport's height. vi 1% of viewport's size in the root element's inline axis. vb 1% of viewport's size in the root element's block axis. vmin 1% of viewport's smaller dimension. vmax 1% of viewport's larger dimension. ...
Layout and the containing block - CSS: Cascading Style Sheets
re computed from the element's containing block. Identifying the containing block The process for identifying the containing block depends entirely on the value of the element's position property: If the position property is static, relative, or sticky, the containing block is formed by the edge of the content box of the nearest ancestor element that is either a block container (such as an inline-block, block, or list-item element) or establishes a formatting context (such as a table container, flex container, grid container, or the block container itself). If the position property is absolute, the containing block is formed by the edge of the padding box of the nearest ancestor element that has a position value other than static (fixed, absolute, relative, or sticky). If the position p...
... height: 160px; background: lightgray; } p { width: 50%; /* == 400px * .5 = 200px */ height: 25%; /* == 160px * .25 = 40px */ margin: 5%; /* == 400px * .05 = 20px */ padding: 5%; /* == 400px * .05 = 20px */ background: cyan; } Example 2 In this example, the paragraph's containing block is the <body> element, because <section> is not a block container (because of display: inline) and doesn't establish a formatting context. <body> <section> <p>This is a paragraph!</p> </section> </body> body { background: beige; } section { display: inline; background: lightgray; } p { width: 50%; /* == half the body's width */ height: 200px; /* Note: a percentage would be 0 */ background: cyan; } Example 3 In this example, the paragraph's containing b...
Shorthand properties - CSS: Cascading Style Sheets
on: background: #000 url(images/bg.gif) no-repeat left top; (The shorthand form is actually the equivalent of the longhand properties above plus background-attachment: scroll and, in CSS3, some additional properties.) See background for more detailed information, including CSS3 properties. Font properties The following declarations ... font-style: italic; font-weight: bold; font-size: .8em; line-height: 1.2; font-family: Arial, sans-serif; ... can be shortened to the following: font: italic bold .8em/1.2 Arial, sans-serif; This shorthand declaration is actually equivalent to the longhand declarations above plus font-variant: normal and font-size-adjust: none (CSS2.0 / CSS3), font-stretch: normal (CSS3). Border properties With borders, the width, color, and style can be simplified in...
... used, and actual values. Definitions of value syntax, shorthand properties and replaced elements. ...
CSS Tutorials - CSS: Cascading Style Sheets
Web › CSS › Tutorials
all, with a short description. They are grouped by complexity so that you can choose the most appropriate for your level. Editor's note: We should look at using "difficulty level" tags on the tutorial/guide pages so that difficulty-based lists can be automatically built. Beginner-level CSS tutorials Getting started This guide is aimed at complete beginners: You haven't written one single line of CSS? -- this is for you. It explains the fundamental concepts of the language and guides you in writing basic stylesheets. Using multiple backgrounds Backgrounds are fundamental for nice styling: CSS allows you to set several of them on each box. This tutorial explains how they interact and how to achieve nice effects. Scaling background images CSS allows you to resize images used as an el...
...ween several styles and to control the way this transition happens. CSS Transforms Transforms allow you to change the position of elements by modifying their coordinate space: it allows for translating, rotating, and deforming them in the 2D or 3D spaces. CSS Gradients Gradients are images that transition smoothly from one color to another. There are several types of gradients allowed in CSS: linear or radial, repeating or not. This tutorial describes how to use them. Advanced-level CSS tutorials CSS also got new features allowing you to create complex layouts. Though the simplest way to achieve such layout, they are more complex to use for people without too much experience. CSS multi-column layouts CSS3 introduces a new layout allowing you to easily define multiple columns in an e...
all - CSS: Cascading Style Sheets
Web › CSS › all
: the text that follows it is beneath it. all:unset <blockquote id="quote">Lorem ipsum dolor sit amet, consectetur adipiscing elit.</blockquote> Phasellus eget velit sagittis. body { font-size: small; background-color: #F0F0F0; color:blue; } blockquote { background-color: skyblue; color: red; } blockquote { all: unset; } The <blockquote> doesn't use the browser default styling: it is an inline element now (initial value), its background-color is transparent (initial value), but its font-size is still small (inherited value) and its color is blue (inherited value). all:initial <blockquote id="quote">Lorem ipsum dolor sit amet, consectetur adipiscing elit.</blockquote> Phasellus eget velit sagittis. body { font-size: small; background-color: #F0F0F0; color:blue; } blockquote { backg...
... its color is blue (inherited value). all:initial <blockquote id="quote">Lorem ipsum dolor sit amet, consectetur adipiscing elit.</blockquote> Phasellus eget velit sagittis. body { font-size: small; background-color: #F0F0F0; color:blue; } blockquote { background-color: skyblue; color: red; } blockquote { all: initial; } The <blockquote> doesn't use the browser default styling: it is an inline element now (initial value), its background-color is transparent (initial value), its font-size is normal (initial value) and its color is black (initial value). all:inherit <blockquote id="quote">Lorem ipsum dolor sit amet, consectetur adipiscing elit.</blockquote> Phasellus eget velit sagittis. body { font-size: small; background-color: #F0F0F0; color:blue; } blockquote { background-color:...
backdrop-filter - CSS: Cascading Style Sheets
sl( <hue>, <percentage>, <percentage>, <alpha-value>? )<hsla()> = hsla( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsla( <hue>, <percentage>, <percentage>, <alpha-value>? ...
... CSS .box { background-color: rgba(255, 255, 255, 0.3); border-radius: 5px; font-family: sans-serif; text-align: center; line-height: 1; -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); max-width: 50%; max-height: 50%; padding: 20px 40px; } html, body { height: 100%; width: 100%; } body { background-image: url(https://picsum.photos/id/1080/6858/4574), linear-gradient(rgb(219, 166, 166), rgb(0, 0, 172)); background-position: center center; background-repeat: no-repeat; background-size: cover; } .container { align-items: center; display: flex; justify-content: center; height: 100%; width: 100%; } HTML <div class="container"> <div class="box"> <p>backdrop-filter: blur(10px)</p> </div> </div> Result Specifications ...
background-clip - CSS: Cascading Style Sheets
in z-ordering). padding-box The background extends to the outside edge of the padding. No background is drawn beneath the border. content-box The background is painted within (clipped to) the content box. text The background is painted within (clipped to) the foreground text. Formal definition Initial valueborder-boxApplies toall elements. ...
...ackground extends behind the border.</p> <p class="padding-box">The background extends to the inside edge of the border.</p> <p class="content-box">The background extends only to the edge of the content box.</p> <p class="text">The background is clipped to the foreground text.</p> CSS p { border: .8em darkviolet; border-style: dotted double; margin: 1em 0; padding: 1.4em; background: linear-gradient(60deg, red, yellow, red, yellow, red); font: 900 1.2em sans-serif; text-decoration: underline; } .border-box { background-clip: border-box; } .padding-box { background-clip: padding-box; } .content-box { background-clip: content-box; } .text { background-clip: text; -webkit-background-clip: text; color: rgba(0,0,0,.2); } Result Specifications Specification ...
background-color - CSS: Cascading Style Sheets
y concerns It is important to ensure that the contrast ratio between the background color and the color of the text placed over it is high enough that people experiencing low vision conditions will be able to read the content of the page. Color contrast ratio is determined by comparing the luminance of the text and background color values. In order to meet current Web Content Accessibility Guidelines (WCAG), a ratio of 4.5:1 is required for text content and 3:1 for larger text such as headings. Large text is defined as 18.66px and bold or larger, or 24px or larger. WebAIM: Color Contrast Checker MDN Understanding WCAG, Guideline 1.4 explanations Understanding Success Criterion 1.4.3 | W3C Understanding WCAG 2.0 Formal definition Initial valuetransparentApplies toall elements. It als...
...or text content and 3:1 for larger text such as headings. Large text is defined as 18.66px and bold or larger, or 24px or larger. WebAIM: Color Contrast Checker MDN Understanding WCAG, Guideline 1.4 explanations Understanding Success Criterion 1.4.3 | W3C Understanding WCAG 2.0 Formal definition Initial valuetransparentApplies toall elements. ...
background-position - CSS: Cascading Style Sheets
ter of the container) It's worth mentioning that if your background-size is equal to the container size for a given axis, then a percentage position for that axis will have no effect because the "container-image difference" will be zero. You will need to offset using absolute values. Formal definition Initial value0% 0%Applies toall elements. ...
...n't be transitioned between two values containing different numbers of <position> values, for example background-position: 10px 10px; and background-position: 20px 20px, 30px 30px; (see bug 1390446). Firefox's new parallel CSS engine (also known as Quantum CSS or Stylo, planned for release in Firefox 57) fixes this. See also background-position-x background-position-y background-position-inline background-position-block Using multiple backgrounds transform-origin ...
background-repeat - CSS: Cascading Style Sheets
. They will then compress to 225px. no-repeat The image is not repeated (and hence the background image painting area will not necessarily be entirely covered). The position of the non-repeated background image is defined by the background-position CSS property. Formal definition Initial valuerepeatApplies toall elements. ...
...ions Specification Status Comment CSS Backgrounds and Borders Module Level 3The definition of 'background-repeat' in that specification. Candidate Recommendation Adds support for multiple background images, the two-value syntax allowing distinct repetition behavior for the horizontal and vertical directions, the space and round keywords, and for backgrounds on inline-level elements by precisely defining the background painting area. CSS Level 2 (Revision 1)The definition of 'background-repeat' in that specification. Recommendation No significant changes. CSS Level 1The definition of 'background-repeat' in that specification. Recommendation Initial definition. ...
background-size - CSS: Cascading Style Sheets
y a width value (for example, background-size: 50%). Rendering of <gradient>s in such cases changed in Firefox 8, and at present is generally inconsistent across browsers, which do not all implement rendering in full accordance with the CSS3 background-size specification and with the CSS3 Image Values gradient specification. ...
... to use a pixel dimension and an auto dimension with a <gradient>, because it's impossible to replicate rendering in versions of Firefox prior to 8, and in browsers not implementing Firefox 8's rendering, without knowing the exact size of the element whose background is being specified. Formal definition Initial valueauto autoApplies toall elements. ...
<blend-mode> - CSS: Cascading Style Sheets
xel among the layers to which it is applied, a blend mode takes the colors of the foreground and the background, perfoms a calculation on them, and returns a new color value. Changes between blend modes are not interpolated. Any change occurs immediately. Examples Blend mode comparison In the following example, we have a <div> with two background images set on it -- a Firefox logo on top of a linear gradient. Below it we have a provided a <select> menu that allows you to change the background-blend-mode applied to the <div>, allowing you to compare the different blend mode effects. HTML <div></div> <p>Choose a blend-mode:</p> <select> <option selected>normal</option> <option>multiply</option> <option>screen</option> <option>overlay</option> <option>darken</option> <option>lig...
... <option>soft-light</option> <option>difference</option> <option>exclusion</option> <option>hue</option> <option>saturation</option> <option>color</option> <option>luminosity</option> </select> CSS div { width: 300px; height: 300px; background: url(https://media.prod.mdn.mozit.cloud/attachments/2020/07/29/17350/3b4892b7e820122ac6dd7678891d4507/firefox.png) no-repeat center, linear-gradient(to bottom, blue, orange); } JavaScript const selectElem = document.querySelector('select'); const divElem = document.querySelector('div'); selectElem.addEventListener('change', () => { divElem.style.backgroundBlendMode = selectElem.value; }); Result Specifications Specification Status Comment Compositing and Blending Level 1The definition of '<blen...
border-block - CSS: Cascading Style Sheets
start and end in the block dimension at once. The physical borders to which it maps depends on the element's writing mode, directionality, and text orientation. It corresponds to the border-top and border-bottom or border-right, and border-left properties depending on the values defined for writing-mode, direction, and text-orientation. ...
... dimension at once. The physical borders to which it maps depends on the element's writing mode, directionality, and text orientation. It corresponds to the border-top and border-bottom or border-right, and border-left properties depending on the values defined for writing-mode, direction, and text-orientation. The borders in the other dimension can be set with border-inline, which sets border-inline-start, and border-inline-end. Constituent properties This property is a shorthand for the following CSS properties: border-block-color border-block-style border-block-width Syntax Values The border-block is specified with one or more of the following, in any order: <'border-width'> The width of the border. See border-width. <'border-style'> The line style of the border. See bo...
border-collapse - CSS: Cascading Style Sheets
initial; border-collapse: unset; The border-collapse property is specified as a single keyword, which may be chosen from the list below. Values collapse Adjacent cells have shared borders (the collapsed-border table rendering model). separate Adjacent cells have distinct borders (the separated-border table rendering model). ...
... <tr><td class="ed">Edge</td> <td class="tr">EdgeHTML</td></tr> <tr><td class="sa">Safari</td> <td class="wk">Webkit</td></tr> <tr><td class="ch">Chrome</td> <td class="bk">Blink</td></tr> <tr><td class="op">Opera</td> <td class="bk">Blink</td></tr> </tbody> </table> CSS .collapse { border-collapse: collapse; } .separate { border-collapse: separate; } table { display: inline-table; margin: 1em; border: dashed 5px; } table th, table td { border: solid 3px; } .fx { border-color: orange blue; } .gk { border-color: black red; } .ed { border-color: blue gold; } .tr { border-color: aqua; } .sa { border-color: silver blue; } .wk { border-color: gold blue; } .ch { border-color: red yellow green blue; } .bk { border-color: navy blue teal aqua; } .op { border-color: re...
border-width - CSS: Cascading Style Sheets
e same width to all four sides. When two values are specified, the first width applies to the top and bottom, the second to the left and right. When three values are specified, the first width applies to the top, the second to the left and right, the third to the bottom. When four values are specified, the widths apply to the top, right, bottom, and left in that order (clockwise). Values <line-width> Defines the width of the border, either as an explicit nonnegative <length> or a keyword. If it's a keyword, it must be one of the following values: thin A thin border medium A medium border thick A thick border Note: Because the specification doesn't define the exact thickness de...
... length or 0 if border-left-style is none or hiddenborder-right-width: the absolute length or 0 if border-right-style is none or hiddenborder-top-width: the absolute length or 0 if border-top-style is none or hiddenAnimation typeas each of the properties of the shorthand:border-bottom-width: a lengthborder-left-width: a lengthborder-right-width: a lengthborder-top-width: a length Formal syntax <line-width>{1,4}where <line-width> = <length> | thin | medium | thick Examples A mix of values and lengths HTML <p id="sval"> one value: 6px wide border on all 4 sides</p> <p id="bival"> two different values: 2px wide top and bottom border, 10px wide right and left border</p> <p id="treval"> three different values: 0.3em top, 9px bottom, and zero width right and left</p> <p id="fourval...
box-flex - CSS: Cascading Style Sheets
Web › CSS › box-flex
lways. This attribute does not have a corresponding CSS property. A trick to make all content elements in a containing box the same size, is to give them all a fixed size (e.g. height: 0), and the same box-flex value greater than zero (e.g. -moz-box-flex: 1). ...
... corresponding CSS property. A trick to make all content elements in a containing box the same size, is to give them all a fixed size (e.g. height: 0), and the same box-flex value greater than zero (e.g. -moz-box-flex: 1). ...
box-pack - CSS: Cascading Style Sheets
Web › CSS › box-pack
epends on the box's orientation and direction: Normal Reverse Horizontal left right Vertical top bottom The edge opposite to the start is designated the end. If the packing is set using the element's pack attribute, then the style is ignored. ...
... direction: Normal Reverse Horizontal left right Vertical top bottom The edge opposite to the start is designated the end. If the packing is set using the element's pack attribute, then the style is ignored. ...
box-shadow - CSS: Cascading Style Sheets
HTML <blockquote><q>You may shoot me with your words,<br/> You may cut me with your eyes,<br/> You may kill me with your hatefulness,<br/> But still, like air, I'll rise.</q> <p>&mdash; Maya Angelou</p> </blockquote> CSS blockquote { padding: 20px; box-shadow: inset 0 -3em 3em rgba(0,0,0,0.1), 0 0 0 2px rgb(255,255,255), 0...
...The shadows are drawn back to front, so the first shadow sits on top of subsequent shadows. When the border-radius is set to 0, as is the default, the corners of the shadow will be, well, corners. Had we put in a border-radius of any other value, the corners would have been rounded. We added a margin the size of the widest box-shadow to ensure the shadow doesn't overl...
caption-side - CSS: Cascading Style Sheets
le's horizontal layout. The CSS 2.1 specification notes that the CSS 2 specification described a different behavior for the bottom value, which will be reintroduced by this value in a future specification. ...
... layout. The CSS 2.1 specification notes that the CSS 2 specification described a different behavior for the bottom value, which will be reintroduced by this value in a future specification. ...
clamp() - CSS: Cascading Style Sheets
Web › CSS › clamp
ibute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Note that using clamp() for font sizes, as in these examples, allows you to set a font-size that grows with the size of the viewport, but doesn't go below a minimum font-size or above a maximum font-size. It has the same effect as the code in Fluid Typography but in one line, and without the use of media queries. Syntax The clamp() function takes three comma separated expressions as its parameter, in the order of minimum value, preferred value, maximum value. The minimum value is the smallest (most negative) value. This is the lower bound in the range of allowed values. If the preferred value is less than this value, the minimum value will be used. The preferred ...
...e tortor at rhoncus. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Nam non felis quis sem lobortis sodales vel id libero. Phasellus sit amet placerat lorem. </p> CSS html { font-family: sans-serif; } body { margin: 0 auto; width: min(1000px, calc(70% + 100px)); } h1 { letter-spacing: 2px; font-size: clamp(1.8rem, 2.5vw, 2.8rem); } p { line-height: 1.5; font-size: max(1.2rem, 1.2vw); } Specifications Specification Status Comment CSS Values and Units Module Level 4The definition of 'clamp()' in that specification. Editor's Draft Initial definition. ...
color-adjust - CSS: Cascading Style Sheets
r override the behavior, but each user agent is allowed to decide for itself how to handle color-adjust in any given situation. ...
... linear-gradient() function atop a black background color to have a dark blue gradient behind medium red text. For whatever reason, this is the desired appearance in any rendering environment, including on paper, so we also use color-adjust: exact to tell the browser not to make color or style adjustments to the box when rendering it. ...
color - CSS: Cascading Style Sheets
Web › CSS › color
ncerns It is important to ensure that the contrast ratio between the color of the text and the background the text is placed over is high enough that people experiencing low vision conditions will be able to read the content of the page. Color contrast ratio is determined by comparing the luminosity of the text and background color values. ...
... Color contrast ratio is determined by comparing the luminosity of the text and background color values. In order to meet current Web Content Accessibility Guidelines (WCAG), a ratio of 4.5:1 is required for text content and 3:1 for larger text such as headings. Large text is defined as 18.66px and bold or larger, or 24px or larger. WebAIM: Color Contrast Checker MDN Understanding WCAG, Guideline 1.4 explanations Understanding Success Criterion 1.4.3 | W3C Understanding WCAG 2.0 Formal definition Initial valueVaries from one browser to anotherApplies toall elements. It also applies to ::first-letter and ::first-line.InheritedyesComputed valueIf the value is translucent, the computed value will be the rgba() corresponding one. If it isn't, it will be the rgb() corresponding one. The tr...
column-rule-color - CSS: Cascading Style Sheets
The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Syntax /* <color> values */ column-rule-color: red; column-rule-color: rgb(192, 56, 78); column-rule-color: transparent; column-rule-color: hsla(0, 100%, 50%, 0.6); /* Global values */ column-rule-color: inherit; column-rule-color: initial; column-rule-color: unset; The column-rule-color property is specified as a single <color> value. Values <color> The color of the rule that separates columns. ...
...entage>, <alpha-value>? )<hsla()> = hsla( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsla( <hue>, <percentage>, <percentage>, <alpha-value>? )where <alpha-value> = <number> | <percentage><hue> = <number> | <angle> Examples Setting a blue column rule HTML <p>This is a bunch of text split into three columns. The `column-rule-color` property is used to change the color of the line that is drawn between columns. Don't you think that's wonderful?</p> CSS p { column-count: 3; column-rule-style: solid; column-rule-color: blue; } Result Specifications Specification Status Comment CSS Multi-column Layout ModuleThe definition of 'column-rule-color' in that specification. Working Draft Initial definition. ...
column-rule-style - CSS: Cascading Style Sheets
The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
.... The styling must be interpreted as in the collapsing border model. Formal definition Initial valuenoneApplies tomulticol elementsInheritednoComputed valueas specifiedAnimation typediscrete Formal syntax <'border-style'> Examples Setting a dashed column rule HTML <p>This is a bunch of text split into three columns. The `column-rule-style` property is used to change the style of the line that is drawn between columns. Don't you think that's wonderful?</p> CSS p { column-count: 3; column-rule-style: dashed; } Result Specifications Specification Status Comment CSS Multi-column Layout ModuleThe definition of 'column-rule-style' in that specification. Working Draft Initial definition. ...
column-rule-width - CSS: Cascading Style Sheets
The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Syntax /* Keyword values */ column-rule-width: thin; column-rule-width: medium; column-rule-width: thick; /* <length> values */ column-rule-width: 1px; column-rule-width: 2.5em; /* Global values */ column-rule-width: inherit; column-rule-width: initial; column-rule-width: unset; The column-rule-width property is specified as a single <'border-width'> value. ...
...hick keywords. Formal definition Initial valuemediumApplies tomulticol elementsInheritednoComputed valuethe absolute length; 0 if the column-rule-style is none or hiddenAnimation typea length Formal syntax <'border-width'> Examples Setting a thick column rule HTML <p>This is a bunch of text split into three columns. The `column-rule-width` property is used to change the width of the line that is drawn between columns. Don't you think that's wonderful?</p> CSS p { column-count: 3; column-rule-style: solid; column-rule-width: thick; } Result Specifications Specification Status Comment CSS Multi-column Layout ModuleThe definition of 'column-rule-width' in that specification. Working Draft Initial definition. ...
Computed value - CSS: Cascading Style Sheets
The computed value of a CSS property is the value that is transferred from parent to child during inheritance. It is calculated from the specified value by: Handling the special values inherit, initial, unset, and revert. Doing the computation needed to reach the value described in the "Computed value" line in the property's definition table. The computation needed to reach a property's computed value typically involves converting relative values (such as those in em units or percentages) to absolute values. For example, if an element has specified values font-size: 16px and padding-top: 2em, then the computed value of padding-top is 32px (double the font size). However, for some properties (those where percentages are relative to something that may require layout to determine, such as...
...alues font-size: 16px and padding-top: 2em, then the computed value of padding-top is 32px (double the font size). However, for some properties (those where percentages are relative to something that may require layout to determine, such as width, margin-right, text-indent, and top), percentage-specified values turn into percentage-computed values. Additionally, unitless numbers specified on the line-height property become the computed value, as specified. The relative values that remain in the computed value become absolute when the used value is determined. Note: The getComputedStyle() DOM API returns the resolved value, which may either be the computed value or the used value, depending on the property. Specifications Specification Status Comment CSS Level ...
flex-wrap - CSS: Cascading Style Sheets
Web › CSS › flex-wrap
The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. See Using CSS flexible boxes for more properties and information. ...
...es for more properties and information. Syntax flex-wrap: nowrap; /* Default value */ flex-wrap: wrap; flex-wrap: wrap-reverse; /* Global values */ flex-wrap: inherit; flex-wrap: initial; flex-wrap: unset; The flex-wrap property is specified as a single keyword chosen from the list of values below. Values The following values are accepted: nowrap The flex items are laid out in a single line which may cause the flex container to overflow. The cross-start is either equivalent to start or before depending on the flex-direction value. This is the default value. wrap The flex items break into multiple lines. The cross-start is either equivalent to start or before depending flex-direction value and the cross-end is the opposite of the specified cross-start. wrap-reverse Behaves the sa...
font-family - CSS: Cascading Style Sheets
rface sans-serif font. This is example ui-sans-serif text. ui-monospace The default user interface monospace font. This is example ui-monospace text. ui-rounded The default user interface font that has rounded features. This is example ui-rounded text. math This is for the particular stylistic concerns of representing mathematics: superscript and subscript, brackets that cross several lines, nesting expressions, and double struck glyphs with distinct meanings. This is some example math text: ax2 + bx + c = 0. emoji Fonts that are specifically designed to render emoji. This is some example emoji text: ??. fangsong A particular style of Chinese characters that are between serif-style Song and cursive-style Kai forms. This style is often used for government documents. This is ...
...re invalid: font-family: Goudy Bookletter 1911, sans-serif; font-family: Red/Black, sans-serif; font-family: "Lucida" Grande, sans-serif; font-family: Ahem!, sans-serif; font-family: test@foo, sans-serif; font-family: #POUND, sans-serif; font-family: Hawaii 5-0, sans-serif; Formal definition Initial valuedepends on user agentApplies toall elements. ...
font-variant-caps - CSS: Cascading Style Sheets
igned for use with lowercase letters. When used in all uppercase titling sequences they can appear too strong. Titling capitals are designed specifically for this situation. Accessibility concerns Large sections of text set with a font-variant value of all-small-caps or all-petite-caps may be difficult for people with cognitive concerns such as Dyslexia to read. ...
...is situation. Accessibility concerns Large sections of text set with a font-variant value of all-small-caps or all-petite-caps may be difficult for people with cognitive concerns such as Dyslexia to read. MDN Understanding WCAG, Guideline 1.4 explanations W3C Understanding WCAG 2.1 Formal definition Initial valuenormalApplies toall elements. ...
font-weight - CSS: Cascading Style Sheets
400 100 400 700 100 500 700 100 600 900 400 700 900 400 800 900 700 900 900 700 Common weight name mapping The numerical values 100 to 900 roughly correspond to the following common weight names (see the OpenType specification): Value Common weight name 100 Thin (Hairline) 200 Extra Light (Ultra Light) 300 Light 400 Normal (Regular) 500 Medium 600 Semi Bold (Demi Bold) 700 Bold 800 Extra Bold (Ultra Bold) 900 Black (Heavy) 950 Extra Black (Ultra Black) Variable fonts Most fonts have a particular weight which corresponds to one of the numbers in Commo...
... let sampleText = document.querySelector('.sample'); function update() { weightLabel.textContent = `font-weight: ${weightInput.value};`; sampleText.style.fontWeight = weightInput.value; } weightInput.addEventListener('input', update); update(); Accessibility concerns People experiencing low vision conditions may have difficulty reading text set with a font-weight value of 100 (Thin/Hairline) or 200 (Extra Light), especially if the font has a low contrast color ratio. MDN Understanding WCAG, Guideline 1.4 explanations Understanding Success Criterion 1.4.8 | W3C Understanding WCAG 2.0 Formal definition Initial valuenormalApplies toall elements. It also applies to ::first-letter and ::first-line.InheritedyesComputed valuethe keyword or the numerical value as specified, with bold...
hanging-punctuation - CSS: Cascading Style Sheets
The hanging-punctuation CSS property specifies whether a punctuation mark should hang at the start or end of a line of text. Hanging punctuation may be placed outside the line box. /* Keyword values */ hanging-punctuation: none; hanging-punctuation: first; hanging-punctuation: last; hanging-punctuation: force-end; hanging-punctuation: allow-end; /* Two keywords */ hanging-punctuation: first force-end; hanging-punctuation: first allow-end; hanging-punctuation: first last; hanging-punctuation: last force-end; hanging-punctuation: last allow-end; /* Three keywords */ hanging-punctuation: first force-end last; hanging-punctuation: first allow-end last; /* Global values */ hanging-punctuation: inherit; hanging-punctuation: initial; hanging-punctuation: unset; Syntax The hanging-punctuation...
...alue syntax uses one of the following: first together with any one of last, allow-end, or force-end last together with any one of first, allow-end, or force-end Three-value syntax uses one of the following: first, allow-end, and last first, force-end, and last Values none No character hangs. first An opening bracket or quote at the start of the first formatted line of an element hangs. last A closing bracket or quote at the end of the last formatted line of an element hangs. force-end A stop or comma at the end of a line hangs. allow-end A stop or comma at the end of a line hangs if it does not otherwise fit prior to justification. Formal definition Initial valuenoneApplies toall elementsInheritedyesComputed valueas specifiedAnimation typediscrete ...
<image> - CSS: Cascading Style Sheets
Web › CSS › image
ot provide any special information on background images to assistive technology. This is important primarily for screen readers, as a screen reader will not announce its presence and therefore convey nothing to its users. If the image contains information critical to understanding the page's overall purpose, it is better to describe it semantically in the document. ...
...y nothing to its users. If the image contains information critical to understanding the page's overall purpose, it is better to describe it semantically in the document. ...
letter-spacing - CSS: Cascading Style Sheets
s. For text styled with a very large negative value, the letters will overlap each other to the point where the word(s) may be unrecognizable. Legible letter-spacing must be determined on a case-by-case basis, as different font families have different character widths. There is no one value that can ensure all font families automatically maintain their legibility. ...
...se basis, as different font families have different character widths. There is no one value that can ensure all font families automatically maintain their legibility. MDN Understanding WCAG, Guideline 1.4 explanations Understanding Success Criterion 1.4.8 | W3C Understanding WCAG 2.0 Formal definition Initial valuenormalApplies toall elements. ...
max-block-size - CSS: Cascading Style Sheets
max-block-size CSS property specifies the maximum size of an element in the direction opposite that of the writing direction as specified by writing-mode. That is, if the writing direction is horizontal, then max-block-size is equivalent to max-height; if the writing direction is vertical, max-block-size is the same as max-width. The other dimension's maximum length is specified using the max-inline-size property. This is useful because the max-width is always used for horizontal sizes and max-height is always used for vertical sizes, and if you need to set lengths based on the size of your text content, you need to be able to do so with the writing direction in mind. Any time you would normally use max-height or max-width, you should instead use max-block-size to set the maximum "height" ...
... horizontal sizes and max-height is always used for vertical sizes, and if you need to set lengths based on the size of your text content, you need to be able to do so with the writing direction in mind. Any time you would normally use max-height or max-width, you should instead use max-block-size to set the maximum "height" of the content (even though this may not be a vertical value) and max-inline-size to set the maximum "width" of the content (although this may instead be vertical rather than horizontal). See the Example in writing-mode, which shows the different writing modes in action. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and s...
max-width - CSS: Cascading Style Sheets
Web › CSS › max-width
sic minimum max-width. fit-content(<length-percentage>) Uses the fit-content formula with the available space replaced by the specified argument, i.e. min(max-content, max(min-content, argument)). Accessibility concerns Ensure that elements set with a max-width are not truncated and/or do not obscure other content when the page is zoomed to increase text size. ...
...max(min-content, argument)). Accessibility concerns Ensure that elements set with a max-width are not truncated and/or do not obscure other content when the page is zoomed to increase text size. ...
min() - CSS: Cascading Style Sheets
Web › CSS › min
'-' ] <calc-product> ]*where <calc-product> = <calc-value> [ '*' <calc-value> | '/' <number> ]*where <calc-value> = <number> | <dimension> | <percentage> | ( <calc-sum> ) Accessibility concerns When using min() to set a maximum font size, ensure that the font can still be scaled at least 200% for readability (without assistive technology like a zoom function). MDN Understanding WCAG, Guideline 1.4 explanations Understanding Success Criterion 1.4.4 | W3C Understanding WCAG 2.0 Examples Setting a maximum size for a label and input Another use case for CSS functions is to set a maximum size on responsive form controls: enabling the width of labels and inputs to shrink as the width of the form shrinks. Let's look at some CSS: input, label { padding: 2px; box-sizing: border-box; ...
...ions Understanding Success Criterion 1.4.4 | W3C Understanding WCAG 2.0 Examples Setting a maximum size for a label and input Another use case for CSS functions is to set a maximum size on responsive form controls: enabling the width of labels and inputs to shrink as the width of the form shrinks. Let's look at some CSS: input, label { padding: 2px; box-sizing: border-box; display: inline-block; width: min(40%, 400px); background-color: pink; } form { margin: 4px; border: 1px solid black; padding: 4px; } Here, the form itself, along with the margin, border, and padding, will be 100% of its parent's width. We declare the input and label to be the lesser of 40% of the form width up to the padding or 400px wide, whichever is smaller. In other words, the widest that the l...
offset-anchor - CSS: Cascading Style Sheets
<length-percentage> ] [ top | center | bottom | <length-percentage> ]? | [ [ left | right ] <length-percentage> ] && [ [ top | bottom ] <length-percentage> ] ]where <length-percentage> = <length> | <percentage> Examples Setting various offset-anchor values In the following example, we have three <div> elements nested in <section> elements. Each <div> is given the same offset-path (a horizontal line 200 pixels long) and animated to move along it. The three are then given different background-color and offset-anchor values. Each <section> has been styled with a linear gradient to give it a horizontal line running through its center, to give you a visual display of where the <div>'s offset paths are running. This allows you to see what effect the different offset-anchor values have -- the f...
...points to move along the path, respectively. ...
opacity - CSS: Cascading Style Sheets
Web › CSS › opacity
ortant to ensure that the contrast ratio between the color of the text and the background the text is placed over is high enough that people experiencing low vision conditions will be able to read the content of the page. Color contrast ratio is determined by comparing the luminosity of the opacity-adjusted text and background color values. ...
...ratio is determined by comparing the luminosity of the opacity-adjusted text and background color values. In order to meet current Web Content Accessibility Guidelines (WCAG), a ratio of 4.5:1 is required for text content and 3:1 for larger text such as headings. Large text is defined as 18.66px and bold or larger, or 24px or larger. ...
orphans - CSS: Cascading Style Sheets
Web › CSS › orphans
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. /* <integer> values */ orphans: 2; orphans: 3; /* Global values */ orphans: inherit; orphans: initial; orphans: unset; In typography, an orphan is the first line of a paragraph that appears alone at the bottom of a page. (The paragraph continues on a following page.) Syntax Values <integer> The minimum number of lines that can stay by themselves at the bottom of a fragment before a fragmentation break. The value must be positive. ...
...It is used to demonstrate how orphans work.</p> <p>This is the third paragraph. ...
overscroll-behavior-y - CSS: Cascading Style Sheets
scrolling area is reached. See overscroll-behavior for a full explanation. /* Keyword values */ overscroll-behavior-y: auto; /* default */ overscroll-behavior-y: contain; overscroll-behavior-y: none; /* Global values */ overscroll-behavior-y: inherit; overscroll-behavior-y: initial; overscroll-behavior-y: unset; Initial valueautoApplies tonon-replaced block-level elements and non-replaced inline-block elementsInheritednoComputed valueas specifiedAnimation typediscrete Syntax The overscroll-behavior-y property is specified as a keyword chosen from the list of values below. Values auto The default scroll overflow behavior occurs as normal. contain Default scroll overflow behavior is observed inside the element this value is set on (e.g. "bounce" effects or refreshes), but no scrol...
...nside the element this value is set on (e.g. "bounce" effects or refreshes), but no scroll chaining occurs to neighbouring scrolling areas, e.g. underlying elements will not scroll. none No scroll chaining occurs to neighbouring scrolling areas, and default scroll overflow behavior is prevented. Formal definition Initial valueautoApplies tonon-replaced block-level elements and non-replaced inline-block elementsInheritednoComputed valueas specifiedAnimation typediscrete Formal syntax contain | none | auto Examples Preventing an underlying element from scrolling vertically .messages { height: 220px; overflow: auto; overscroll-behavior-y: contain; } See overscroll-behavior for a full example and explanation. Specifications Specification Status Comment ...
paint() - CSS: Cascading Style Sheets
Web › CSS › paint
with a PaintWorklet. Syntax paint(workletName, parameters) where: workletName The name of the registered worklet. parameters Optional additional parameters to pass to the paintWorklet Examples You can pass additional arguments via the CSS paint() function. ...
...paint(workletName, parameters) where: workletName The name of the registered worklet. parameters Optional additional parameters to pass to the paintWorklet Examples You can pass additional arguments via the CSS paint() function. ...
<position> - CSS: Cascading Style Sheets
ed in the background-position and offset-anchor properties. Note: The final position described by the <position> value does not need to be inside the element's box. Syntax The <position> data type is specified with one or two keywords, with optional offsets. The keyword values are center, top, right, bottom, and left. Each keyword represents either an edge of the element's box or the center line between two edges. Depending on the context, center represents either the center between the left and right edges, or the center between the top and bottom edges. If specified, an offset can be either a relative <percentage> value or an absolute <length> value. Positive values are offset towards the right or the bottom, whichever is appropriate. Negative values are offset in the opposite directi...
...ntage> ] ] ] Note: The background-position property also accepts a three-value syntax. This is not allowed in other properties that use <position>. Interpolation When animated, a point's abscissa and ordinate values are interpolated independently. However, because the speed of the interpolation is determined by a single timing function for both coordinates, the point will move in a straight line. Examples Valid positions center left center top right 8.5% bottom 12vmin right -6px 10% 20% 8rem 14px Invalid positions left right bottom top 10px 15px 20px 15px Specifications Specification Status Comment CSS Values and Units Module Level 3The definition of '<position>' in that specification. Candidate Recommendation Relists links to both definitions...
radial-gradient() - CSS: Cascading Style Sheets
value, the gradient's ending shape is sized so that it exactly meets the farthest corner of the box from its center. Note: Early implementations of this function included other keywords (cover and contain) as synonyms of the standard farthest-corner and closest-side, respectively. Use the standard keywords only, as some implementations have already dropped those older variants. ...
...Including two stop positions is equivalent to declaring two color stops with the same color at the two positions. <color-hint> Th color-hint is an interpolation hint defining how the gradient progresses between adjacent color stops. ...
scroll-snap-align - CSS: Cascading Style Sheets
The scroll-snap-align property specifies the box's snap position as an alignment of its snap area (as the alignment subject) within its snap container's snapport (as the alignment container). The two values specify the snapping alignment in the block axis and inline axis, respectively. If only one value is specified, the second value defaults to the same value. Syntax /* Keyword values */ scroll-snap-align: none; scroll-snap-align: start end; /* when two values set first is block, second inline */ scroll-snap-align: center; /* Global values */ scroll-snap-align: inherit; scroll-snap-align: initial; scroll-snap-align: unset; Values none The box does not define a snap position in that axis. start The start alignment of this box's scroll snap area, within the scroll container's snappo...
...ainer's snapport is a snap position in this axis. end The end alignment of this box's scroll snap area, within the scroll container's snapport is a snap position in this axis. center The center alignment of this box's scroll snap area, within the scroll container's snapport is a snap position in this axis. Safari currently has the two value syntax in the wrong order, the first value being inline the second block. See bug #191865. Formal definition Initial valuenoneApplies toall elementsInheritednoComputed valueas specifiedAnimation typediscrete Formal syntax [ none | start | end | center ]{1,2} Specifications Specification Status Comment CSS Scroll Snap Module Level 1The definition of 'scroll-snap-align' in that specification. Candidate Recommendation...
scroll-snap-destination - CSS: Cascading Style Sheets
...
... ...
scroll-snap-points-x - CSS: Cascading Style Sheets
...
... ...
scroll-snap-points-y - CSS: Cascading Style Sheets
...
... ...
scroll-snap-stop - CSS: Cascading Style Sheets
fiedAnimation typediscrete Formal syntax normal | always Examples Snapping in different axes This example is duplicated from scroll-snap-type with minor variances. ...
...; } /* scroll-snap */ .x.mandatory-scroll-snapping { scroll-snap-type: x mandatory; } .y.mandatory-scroll-snapping { scroll-snap-type: y mandatory; } .x.proximity-scroll-snapping { scroll-snap-type: x proximity; } .y.proximity-scroll-snapping { scroll-snap-type: y proximity; } .container > div { text-align: center; scroll-snap-align: center; flex: none; } .x.container > div { line-height: 128px; font-size: 64px; width: 100%; height: 128px; } .y.container > div { line-height: 256px; font-size: 128px; width: 256px; height: 256px; } /* appearance fixes */ .y.container > div:first-child { line-height: 1.3; font-size: 64px; } /* coloration */ .container > div:nth-child(even) { background-color: #87EA87; } .container > div:nth-child(odd) { background-colo...
scrollbar-width - CSS: Cascading Style Sheets
.1.1 (Keyboard) has been in place for a long time to advise on basic keyboard accessibility, and this should include scrolling of content areas. And introduced in WCAG 2.1, criterion 2.5.5 (Target Size) advises that touch targets should be at least 44px in width and height (although the problem is compounded on high-resolution screens; thorough testing is advised). ...
... advise on basic keyboard accessibility, and this should include scrolling of content areas. And introduced in WCAG 2.1, criterion 2.5.5 (Target Size) advises that touch targets should be at least 44px in width and height (although the problem is compounded on high-resolution screens; thorough testing is advised). ...
text-combine-upright - CSS: Cascading Style Sheets
/* fits up to 4 consecutive digits horizontally inside vertical text */ /* Global values */ text-combine-upright: inherit; text-combine-upright: initial; text-combine-upright: unset; Syntax Values none There is no special processing. all Attempts to typeset all consecutive characters within the box horizontally, such that they take up the space of a single character within the vertical line of the box. digits <integer>? Attempts to display a sequence of consecutive ASCII digits (U+0030-U+0039) that has as many or fewer characters than the specified integer, such that it takes up the space of a single character within the vertical line box. If the integer is omitted, it computes to 2. Integers outside the range of 2-4 are invalid. Formal definition Initial valuenoneApplies tonon...
... digits <integer>? Attempts to display a sequence of consecutive ASCII digits (U+0030-U+0039) that has as many or fewer characters than the specified integer, such that it takes up the space of a single character within the vertical line box. If the integer is omitted, it computes to 2. Integers outside the range of 2-4 are invalid. Formal definition Initial valuenoneApplies tonon-replaced inline elementsInheritedyesComputed valuespecified keyword, plus integer if 'digits'Animation typediscrete Formal syntax none | all | [ digits <integer>? ] Examples Digits The digits value requires less markup than the all value when digits are being combined, but it is currently not very widely supported by browsers. HTML <p lang="ja" class="exampleText">??20?4?16??</p> CSS .exampleText { w...
text-orientation - CSS: Cascading Style Sheets
It only affects text in vertical mode (when writing-mode is not horizontal-tb). It is useful for controlling the display of languages that use vertical script, and also for making vertical table headers. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. ...
...haracters of vertical scripts naturally. Default value. upright Lays out the characters of horizontal scripts naturally (upright), as well as the glyphs for vertical scripts. Note that this keyword causes all characters to be considered as left-to-right: the used value of direction is forced to be ltr. sideways Causes characters to be laid out as they would be horizontally, but with the whole line rotated 90? clockwise. sideways-right An alias to sideways that is kept for compatibility purposes. use-glyph-orientation On SVG elements, this keyword leads to use the value of the deprecated SVG properties glyph-orientation-vertical and glyph-orientation-horizontal. Formal definition Initial valuemixedApplies toall elements, except table row groups, rows, column groups, and columnsInheri...
text-shadow - CSS: Cascading Style Sheets
ified as two or three <length> values, followed optionally by a <color> value. The first two <length> values are the <offset-x> and <offset-y> values. The third, optional, <length> value is the <blur-radius>. The<color> value is the shadow's color. When more than one shadow is given, shadows are applied front-to-back, with the first-specified shadow on top. This property applies to both ::first-line and ::first-letter pseudo-elements. Values <color> Optional. The color of the shadow. It can be specified either before or after the offset values. If unspecified, the color's value is left up to the user agent, so when consistency across browsers is desired you should define it explicitly. <offset-x> <offset-y> Required. These <length> values specify the shadow's distance from the text. <...
...re 0, the shadow is placed directly behind the text, although it may be partly visible due to the effect of <blur-radius>. <blur-radius> Optional. This is a <length> value. The higher the value, the bigger the blur; the shadow becomes wider and lighter. If not specified, it defaults to 0. Formal definition Initial valuenoneApplies toall elements. ...
touch-action - CSS: Cascading Style Sheets
an-down" is valid). pinch-zoom Enable multi-finger panning and zooming of the page. This may be combined with any of the pan- values. Accessibility concerns A declaration of touch-action: none; may inhibit operating a browser's zooming capabilities. This will prevent people experiencing low vision conditions from being able to read and understand page content. ...
...ation of touch-action: none; may inhibit operating a browser's zooming capabilities. This will prevent people experiencing low vision conditions from being able to read and understand page content. ...
perspective() - CSS: Cascading Style Sheets
presenting the distance from the user to the z=0 plane. If it is 0 or a negative value, no perspective transform is applied. Cartesian coordinates on R2 Homogeneous coordinates on RP2 Cartesian coordinates on R3 Homogeneous coordinates on RP3 This transformation applies to the 3D space and can't be represented on the plane. This transformation is not a linear transformation in R3, and can't be represented using a Cartesian-coordinate matrix. 10000100001000-1/d1 Examples HTML <p>Without perspective:</p> <div class="no-perspective-box"> <div class="face front">A</div> <div class="face top">B</div> <div class="face left">C</div> </div> <p>With perspective (9cm):</p> <div class="perspective-box-far"> <div class="face front">A</di...
...e (9cm):</p> <div class="perspective-box-far"> <div class="face front">A</div> <div class="face top">B</div> <div class="face left">C</div> </div> <p>With perspective (4cm):</p> <div class="perspective-box-closer"> <div class="face front">A</div> <div class="face top">B</div> <div class="face left">C</div> </div> CSS .face { position: absolute; width: 100px; height: 100px; line-height: 100px; font-size: 100px; text-align: center; } p + div { width: 100px; height: 100px; transform-style: preserve-3d; margin-left: 100px; } .no-perspective-box { transform: rotateX(-15deg) rotateY(30deg); } .perspective-box-far { transform: perspective(9cm) rotateX(-15deg) rotateY(30deg); } .perspective-box-closer { transform: perspective(4cm) rotateX(-15deg) rotateY(30...
transform - CSS: Cascading Style Sheets
Web › CSS › transform
examples and send us a pull request. If the property has a value different than none, a stacking context will be created. In that case, the element will act as a containing block for any position: fixed; or position: absolute; elements that it contains. Only transformable elements can be transformed. That is, all elements whose layout is governed by the CSS box model except for: non-replaced inline boxes, table-column boxes, and table-column-group boxes. Syntax /* Keyword values */ transform: none; /* Function values */ transform: matrix(1.0, 2.0, 3.0, 4.0, 5.0, 6.0); transform: matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1); transform: perspective(17px); transform: rotate(0.5turn); transform: rotate3d(1, 2.0, 3.0, 10deg); transform: rotateX(10deg); transform: rotateY(10deg); ...
... you need to include such animations on your website, you should provide a control to allow users to turn off animations, preferrably site-wide. Also, consider making use of the prefers-reduced-motion media feature -- use it to write a media query that will turn off animations if the user has reduced animation specified in their system preferences. ...
url() - CSS: Cascading Style Sheets
Web › CSS › url()
} @import url("https://www.example.com/style.css"); @namespace url(http://www.w3.org/1999/xhtml); Relative URLs, if used, are relative to the URL of the styl...
...rs above 0x7e. Double quotes cannot occur inside double quotes and single quotes cannot occur inside single quotes unless escaped. The following are all valid and equivalent: <css_property>: url("https://example.com/image.png") <css_property>: url('https://example.com/image.png') <css_property>: url(https://example.com/image.png) path References the ID of an SVG shape -- circle, ellipse, line, path, polygon, polyline, or rect -- using the shape's geometry as the path. <url-modifier> In the future, the url() function may support specifying a modifier, an identifier or a functional notation, which alters the meaning of the URL string.This is not supported and not fully defined in the specification. Formal syntax url( <string> <url-modifier>* ) Examples content property HTM...
Used value - CSS: Cascading Style Sheets
The used values of shorthand properties (e.g., background) are consistent with those of their component properties (e.g., background-color or background-size) and with position and float. ...
...e', updateAllUsedWidths); Result Difference from computed value CSS 2.0 defined only computed value as the last step in a property's calculation. Then, CSS 2.1 introduced the distinct definition of used value. An element could then explicitly inherit a width/height of a parent, whose computed value is a percentage. For CSS properties that don't depend on layout (e.g., display, font-size, or line-height), the computed values and used values are the same. The following are the CSS 2.1 properties that do depend on layout, so they have a different computed value and used value: (taken from CSS 2.1 Changes: Specified, computed, and actual values): background-position bottom, left, right, top height, width margin-bottom, margin-left, margin-right, margin-top min-height, min-width paddi...
width - CSS: Cascading Style Sheets
Web › CSS › width
nsic minimum width. fit-content(<length-percentage>) Uses the fit-content formula with the available space replaced by the specified argument, i.e. min(max-content, max(min-content, <length-percentage>)). Accessibility concerns Ensure that elements set with a width aren't truncated and don't obscure other content when the page is zoomed to increase text size. ...
...max(min-content, <length-percentage>)). Accessibility concerns Ensure that elements set with a width aren't truncated and don't obscure other content when the page is zoomed to increase text size. ...
word-spacing - CSS: Cascading Style Sheets
yled with a large negative value, the words will overlap each other to the point where the the beginning and end of each word is unrecognizable. Legible word-spacing must be determined on a case-by-case basis, as different font families have different character widths. There is no one value that can ensure all font families automatically maintain their legibility. ...
...ase basis, as different font families have different character widths. There is no one value that can ensure all font families automatically maintain their legibility. MDN Understanding WCAG, Guideline 1.4 explanations Understanding Success Criterion 1.4.8 | W3C Understanding WCAG 2.0 Formal definition Initial valuenormalApplies toall elements. ...
zoom - CSS: Cascading Style Sheets
Web › CSS › zoom
om out. ...
...This property originated in Internet Explorer. ...
Live streaming web audio and video - Developer guides
s case, we are using static media to describe media that is represented by a file, whether it be an mp3 or WebM file. This file sits on a server and can be delivered -- like most other files -- to the browser. This is often known as a progressive download. Live streamed media lacks a finite start and end time as rather than a static file, it is a stream of data that the server passes on down the line to the browser and is often adaptive (see below). Usually, we require different formats and special server-side software to achieve this. Adaptive streaming One of the main priorities for live streaming is to keep the player synchronized with the stream: adaptive streaming is a technique for doing this in the case of low bandwidth. The idea is that the data transfer rate is monitored and if it ...
...e Streaming DASH Adaptive Streaming for HTML 5 Video Dynamic Adaptive Streaming over HTTP (MPEG-DASH) MPEG-DASH Media Source Demo DASH Reference Client Dynamic Streaming over HTTP The State of MPEG-DASH Deployment Look, no plugins: Live streaming to the browser using Media Source Extensions and MPEG-DASH Media Source Extensions (W3C) Icecast SHOUTcast GStreamer Streaming GStreamer Pipelines Via HTTP Streaming media using GStreamer on the web GStreamer and Raspberry Pi Acceptance of Media Source Extensions as W3C Candidate Recommendation will accelerate adoption of dash.js Comparison of Streaming Media Systems Mozilla Hacks - Streaming Media on demand with Media Source Extensions ...
Video player styling basics - Developer guides
and the element should fully contain the image. Simple :hover and :focus states are then set for each button that simply alters the opacity of the button: .controls button:hover, .controls button:focus { opacity:0.5; } To obtain appropriate button images, a set of free common control set icons was downloaded from the web. Each image was then converted to a base64 encoded string (using an online base64 image encoder), since the images are quite small, the resultant encoded strings are quite short. Since some buttons have dual functionality, e.g. play/pause, and mute/unmute, these buttons have different states that need to be styled. As mentioned earlier, a `data-state` variable is used to indicate which state such buttons are currently in. For example, the play/pause button has the fol...
...efined colour for styling the progress bar's background colour as it increases. As mentioned in the previous article, there is a fallback provided for browsers that do not support the <progress> element; this also needs to be styled appropriately: .controls progress[data-state="fake"] { background:#e6e6e6; height:65%; } .controls progress span { width:0%; height:100%; display:inline-block; background-color:#2a84cd; } A .data-state class is also used here when a <progress> element is being "faked"; when it's in this state the background colour needs to be set. The internal <span> element used as the actual progressing part of the faked progress bar has its width initially set to 0% (it is updated via JavaScript) and it also has its background colour set. There are some ...
Constraint validation - Developer guides
patternMismatch constraint violation min range, number A valid number The value must be greater than or equal to the value. rangeUnderflow constraint violation date, month, week A valid date datetime, datetime-local, time A valid date and time max range, number A valid number The...
...r number of months week An integer number of weeks datetime, datetime-local, time An integer number of seconds range, number An integer minlength text, search, url, tel, email, password; also on the <textarea> element An integer length The number of characters (code points) must not be less than the value of the attribute, if non-empty. All newlines are normalized to a single character (as opposed to CRLF pairs) for <textarea>. tooShort constraint violation maxlength text, search, url, tel, email, password; also on the <textarea> element An integer length The number of characters (code points) must not exceed the value of the attribute. tooLong constraint violation Constraint validation process Constraint val...
A hybrid approach - Developer guides
ults. We used some elements of responsive web design to give the site a mobile layout, along with user-agent detection to provide mobile-friendly videos and to re-order the demos if the user is on a phone. Feel free to check out the source code on github. We could also be doing more development involving this approach very soon! In fact, one potential path for the main Mozilla site is roughly outlined in the "The Good" section above: Using user-agent detection, route visitors to a landing page for the Firefox version for their device. Every page on the site should look great at a wide variety of resolutions, being built with responsive design in mind. Future plans include exploring serving images based on user-agent. So far there is not much to see for mobile, since things are still in...
...n, a hybrid approach may be your best bet. Decisions like these are at the heart of mobile web development: be specific about what you would like to accomplish, and pick a practical approach while being aware of the tradeoffs. Good luck! Approaches to mobile Web development See the following articles for background and other approaches to developing for mobile platforms. What is mobile-friendliness? Separate sites Responsive design Original document information This article was originally published on 27 June 2011, on the Mozilla Webdev blog as "Approaches to Mobile Web Development Part 4 - A Hybrid Approach", by Jason Grlicky. ...
Mobile Web Development - Developer guides
Web › Guide › Mobile
Designing for mobile devices Mobile devices have quite different hardware characteristics compared with desktop or laptop computers. ...
...g browser-specific features, such as vendor-prefixed CSS properties. If you do need to use these features, check whether other browsers implement their own versions of these features, and target them too. For browsers that don't support these features, provide an acceptable fallback. For example, if you set a gradient as a background for some text using a vendor-prefixed property like -webkit-linear-gradient, it's best to include the other vendor-prefixed versions of the linear-gradient() property. If you don't do that, at least make sure that the default background contrasts with the text: that way, the page will at least be usable in a browser which is not targeted by your linear-gradient rule. See this list of Gecko-specific properties, and this list of WebKit-specific properties, and ...
<h1>–<h6>: The HTML Section Heading elements - HTML: Hypertext Markup Language
h2 External Morphology h3 Head h4 Mouthparts h3 Thorax h4 Prothorax h4 Pterothorax h3 Legs h3 Wings h3 Abdomen When headings are nested, heading levels may be "skipped" when closing a subsection. ...
...othorax h4 Pterothorax h3 Legs h3 Wings h3 Abdomen When headings are nested, heading levels may be "skipped" when closing a subsection. ...
<blink>: The Blinking Text element (obsolete) - HTML: Hypertext Markup Language
Web › HTML › Element › blink
nts the HTMLUnknownElement interface. Example <blink>Why would somebody use this?</blink> Result (toned down!) Specification This element is non-standard and not part of any specification. If you don't believe us, see for yourself in the HTML spec. CSS polyfill If you really do need a polyfill, then you can use the following CSS polyfill. Works in IE10+. ...
...</blink> Result (toned down!) Specification This element is non-standard and not part of any specification. If you don't believe us, see for yourself in the HTML spec. CSS polyfill If you really do need a polyfill, then you can use the following CSS polyfill. Works in IE10+. ...
<center>: The Centered Text element (obsolete) - HTML: Hypertext Markup Language
Web › HTML › Element › center
The container is usually, but isn't required to be, <body>. This tag has been deprecated in HTML 4 (and XHTML 1) in favor of the CSS text-align property, which can be applied to the <div> element or to an individual <p>. For centering blocks, use other CSS properties like margin-left and margin-right and set them to auto (or set margin to 0 auto). DOM interface This element implements the HTMLElement interface. ...
... Implementation note: up to Gecko 1.9.2 inclusive, Firefox implements the HTMLSpanElement interface for this element. Example 1 <center>This text will be centered. <p>So will this paragraph.</p></center> Example 2 (CSS alternative) <div style="text-align:center">This text will be centered. <p>So will this paragraph.</p></div> Example 3 (CSS alternative) <p style="text-align:center">This line will be centered.<br> And so will this line.</p> Note Applying text-align:center to a <div> or <p> element centers the contents of those elements while leaving their overall dimensions unchanged. ...
<input type="file"> - HTML: Hypertext Markup Language
Web › HTML › Element › input › file
html { font-family: sans-serif; } form { width: 580px; background: #ccc; margin: 0 auto; padding: 20px; border: 1px solid black; } form ol { padding-left: 0; } form li, div > p { background: #eee; display: flex; justify-content: space-between; margin-bottom: 10px; list-style-type: none; border: 1px solid black; } form img { height: 64px; order: 1; } form p { line-height: 32px; padding-left: 10px; } form label, form button { background-color: #7F9CCB; padding: 5px 10px; border-radius: 5px; border: 1px ridge black; font-size: 0.8rem; height: auto; } form label:hover, form button:hover { background-color: #2D5BA3; color: white; } form label:active, form button:active { background-color: #0D3F8F; color: white; } This is similar to w...
...px; border-radius: 5px; border: 1px ridge black; font-size: 0.8rem; height: auto; } form label:hover, form button:hover { background-color: #2D5BA3; color: white; } form label:active, form button:active { background-color: #0D3F8F; color: white; } This is similar to what we've seen before -- nothing special to comment on. Next, let's walk through the JavaScript. In the first lines of script, we get references to the form input itself, and the <div> element with the class of .preview. Next, we hide the <input> element -- we do this because file inputs tend to be ugly, difficult to style, and inconsistent in their design across browsers. You can activate the input element by clicking its <label>, so it is better to visually hide the input and style the label like a button, ...
<input type="hidden"> - HTML: Hypertext Markup Language
Web › HTML › Element › input › hidden
ents of type hidden let web developers include data that cannot be seen or modified by users when a form is submitted. For example, the ID of the content that is currently being ordered or edited, or a unique security token. Hidden inputs are completely invisible in the rendered page, and there is no way to make it visible in the page's content. Note: There is a live example below the following line of code -- if it is working correctly, you should see nothing! <input id="prodId" name="prodId" type="hidden" value="xm234jq"> Value A DOMString representing the value of the hidden data you want to pass back to the server. Events None. Supported Common Attributes autocomplete IDL attributes value Methods None. Note: The i...
...5"> This is the content of my excellent blog post. ...
<input type="submit"> - HTML: Hypertext Markup Language
Web › HTML › Element › input › submit
tes value Methods None Value An <input type="submit"> element's value attribute contains a DOMString which is displayed as the button's label. Buttons do not have a true value otherwise. <input type="submit" value="Send Request"> If you don't specify a value, the button will have a default label, chosen by the user agent. ...
...lements. formtarget A string which specifies a name or keyword that indicates where to display the response received after submitting the form. The string must be the name of a browsing context (that is, a tab, window, or <iframe>. A value specified here overrides any target given by the target attribute on the <form> that owns this input. In addition to the actual names of tabs, windows, or inline frames, there are a few special keywords that can be used: _self Loads the response into the same browsing context as the one that contains the form. This will replace the current document with the received data. This is the default value used if none is specified. _blank Loads the response into a new, unnamed, browsing context. This is typically a new tab in the same window as the current ...
<meta>: The Document-level Metadata element - HTML: Hypertext Markup Language
Web › HTML › Element › meta
the risk of having the time interval being too short. People navigating with the aid of assistive technology such as a screen reader may be unable to read through and understand the page's content before being automatically redirected. The abrupt, unannounced updating of the page content may also be disorienting for people experiencing low vision conditions. ...
...People navigating with the aid of assistive technology such as a screen reader may be unable to read through and understand the page's content before being automatically redirected. The abrupt, unannounced updating of the page content may also be disorienting for people experiencing low vision conditions. ...
<nobr>: The Non-Breaking Text element (obsolete) - HTML: Hypertext Markup Language
Web › HTML › Element › nobr
The non-standard, obsolete HTML <nobr> element prevents the text it contains from automatically wrapping across multiple lines, potentially resulting in the user having to scroll horizontally to see the entire width of the text. ...
...solete HTML <nobr> element prevents the text it contains from automatically wrapping across multiple lines, potentially resulting in the user having to scroll horizontally to see the entire width of the text. This element was never standard HTML and was not widely implemented, so you shouldn't use it. ...
<pre>: The Preformatted Text element - HTML: Hypertext Markup Language
Web › HTML › Element › pre
ag omission None, both the starting and ending tag are mandatory. Permitted parents Any element that accepts flow content. Implicit ARIA role No corresponding role Permitted ARIA roles Any DOM interface HTMLPreElement Attributes This element only includes the global attributes. cols Contains the preferred count of characters that a line should have. It was a non-standard synonym of width. To achieve such an effect, use CSS width instead. width Contains the preferred count of characters that a line should have. Though technically still implemented, this attribute has no visual effect; to achieve such an effect, use CSS width instead. wrap Is a hint indicating how the overflow must happen. In modern browser this hint is ig...
...____ < I'm an expert in my field. > --------------------------- \ ^__^ \ (oo)\_______ (__)\ )\/\ ||----w | || || </pre> <figcaption id="cow-caption"> A cow saying, "I'm an expert in my field." The cow is illustrated using preformatted text characters. </figcaption> </figure> MDN Understanding WCAG, Guideline 1.1 explanations H86: Providing text alternatives for ASCII art, emoticons, and leetspeak | W3C Techniques for WCAG 2.0 Specifications Specification Status Comment HTML Living StandardThe definition of '<pre>' in that specification. Living Standard No significant change from HTML5 HTML5The definition of '<pre>' in that specification. Recommendatio...
<s> - HTML: Hypertext Markup Language
Web › HTML › Element › s
Use the <s> element to represent things that are no longer relevant or no longer accurate. However, <s> is not appropriate when indicating document edits; for that, use the <del> and <ins> elements, as appropriate. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Content categories Phrasing content or flow content. Permitted content Phrasing content. Tag omission None, both the starting and ending tag are mandatory. ...
... Implicit ARIA role No corresponding role Permitted ARIA roles Any DOM interface HTMLElement Attributes This element only includes the global attributes. Implementation note: Up to Gecko 1.9.2 inclusive, Firefox implements the HTMLSpanElement interface for this element. Examples <s>Today's Special: Salmon</s> SOLD OUT<br> <span style="text-decoration:line-through;">Today's Special: Salmon</span> SOLD OUT Accessibility concerns The presence of the s element is not announced by most screen reading technology in its default configuration. It can be made to be announced by using the CSS content property, along with the ::before and ::after pseudo-elements. s::before, s::after { clip-path: inset(100%); clip: rect(1px, 1px, 1px, 1px); heigh...
<span> - HTML: Hypertext Markup Language
Web › HTML › Element › span
The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Content categories Flow content, phrasing content. ...
... The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Content categories Flow content, phrasing content. Permitted content Phrasing content. ...
<sub>: The Subscript element - HTML: Hypertext Markup Language
Web › HTML › Element › sub
The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Content categories Flow content, phrasing content, palpable content. Permitted content Phrasing content. Tag omission None, both the starting and ending tag are mandatory. Permitted parents Any element that accepts phrasing content. ...
... HTMLElement Attributes This element only includes the global attributes. Usage notes The <sub> element should be used only for typographical reasons--that is, to change the position of the text to comply with typographical conventions or standards, rather than solely for presentation or appearance purposes. For example, using <sub> to style the name of a company which uses altered baselines in their wordmark would not be appropriate; instead, CSS should be used (likely the vertical-align property, such as vertical-align: sub or, to more precisely control the baseline shift, vertical-align: -25%. Appropriate use cases for <sub> include (but aren't necessarily limited to): Marking up footnote numbers. See Footnote numbers for an example. Marking up the subscript in mathematical ...
<sup>: The Superscript element - HTML: Hypertext Markup Language
Web › HTML › Element › sup
The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Content categories Flow content, phrasing content, palpable content. Permitted content Phrasing content. Tag omission None, both the starting and ending tag are mandatory. Permitted parents Any element that accepts phrasing content. ...
...Element Attributes This element only includes the global attributes. Usage notes The <sup> element should only be used for typographical reasons--that is, to change the position of the text to comply with typographical conventions or standards, rather than solely for presentation or appearance purposes. For example, to style the wordmark of a business or product which uses a raised baseline should be done using CSS (most likely vertical-align) rather than <sup>. This would be done using, for example, vertical-align: super or, to shift the baseline up 50%, vertical-align: 50%. Appropriate use cases for <sup> include (but aren't necessarily limited to): Displaying exponents, such as "x3." It may be worth considering the use of MathML for these, especially in more complex cases. Se...
HTTP caching - HTTP
Web › HTTP › Caching
Private browser caches A private cache is dedicated to a single user. You might have seen "caching" in your browser's settings already. A browser cache holds all documents downloaded via HTTP by the user. This cache is used to make visited documents available for back/forward navigation, saving, viewing-as-source, etc. without requiring an additional trip to the server. It likewise improves offline browsing of cached content. Shared proxy caches A shared cache is a cache that stores responses to be reused by more than one user. For example, an ISP or your company might have set up a web proxy as part of its local network infrastructure to serve many users so that popular resources are reused a number of times, reducing network traffic and latency. Targets of caching operations HTTP cach...
...your company might have set up a web proxy as part of its local network infrastructure to serve many users so that popular resources are reused a number of times, reducing network traffic and latency. Targets of caching operations HTTP caching is optional, but reusing a cached resource is usually desirable. However, common HTTP caches are typically limited to caching responses to GET and may decline other methods. The primary cache key consists of the request method and target URI (oftentimes only the URI is used as only GET requests are caching targets). Common forms of caching entries are: Successful results of a retrieval request: a 200 (OK) response to a GET request containing a resource like HTML documents, images or files. Permanent redirects: a 301 (Moved Permanently) response. E...
Connection management in HTTP/1.x - HTTP
ted by default in modern browsers: Buggy proxies are still common and these lead to strange and erratic behaviors that Web developers cannot foresee and diagnose easily. Pipelining is complex to implement correctly: the size of the resource being transferred, the effective RTT that will be used, as well as the effective bandwidth, have a direct incidence on the improvement provided by the pipeline. Without knowing these, important messages may be delayed behind unimportant ones. The notion of important even evolves during page layout! HTTP pipelining therefore brings a marginal improvement in most cases only. Pipelining is subject to the HOL problem. For these reasons, pipelining has been superseded by a better algorithm, multiplexing, that is used by HTTP/2. By default, HTTP requests...
...ent connection, without waiting for the answer. This avoids latency of the connection. Theoretically, performance could also be improved if two HTTP requests were to be packed into the same TCP message. The typical MSS (Maximum Segment Size), is big enough to contain several simple requests, although the demand in size of HTTP requests continues to grow. Not all types of HTTP requests can be pipelined: only idempotent methods, that is GET, HEAD, PUT and DELETE, can be replayed safely: should a failure happen, the pipeline content can simply be repeated. Today, every HTTP/1.1-compliant proxy and server should support pipelining, though many have limitations in practice: a significant reason no modern browser activates this feature by default. Domain sharding Unless you have a very specific...
Strict-Transport-Security - HTTP
is accessed using HTTP; this is because an attacker may intercept HTTP connections and inject the header or remove it. When your site is accessed over HTTPS with no certificate errors, the browser knows your site is HTTPS capable and will honor the Strict-Transport-Security header. An example scenario You log into a free WiFi access point at an airport and start surfing the web, visiting your online banking service to check your balance and pay a couple of bills. Unfortunately, the access point you're using is actually a hacker's laptop, and they're intercepting your original HTTP request and redirecting you to a clone of your bank's site instead of the real thing. Now your private data is exposed to the hacker. Strict Transport Security resolves this problem; as long as you've accessed you...
...time for that site, so sites can refresh this information and prevent the timeout from expiring. Should it be necessary to disable Strict Transport Security, setting the max-age to 0 (over a https connection) will immediately expire the Strict-Transport-Security header, allowing access via http. Preloading Strict Transport Security Google maintains an HSTS preload service. By following the guidelines and successfully submitting your domain, browsers will never connect to your domain using an insecure connection. While the service is hosted by Google, all browsers have stated an intent to use (or actually started using) the preload list. However, it is not part of the HSTS specification and should not be treated as official. Information regarding the HSTS preload list in Chrome : https://w...
Link prefetching FAQ - HTTP
with a relation type of next or prefetch are prefetched. However, if there is sufficient interest, we may expand link prefetching support to include prefetching <a> tags, which include a relation type of next or prefetch in the future. Doing so would probably help content providers avoid the problem of stale prefetching links. Is link prefetching standards compliant? Yes, link prefetching as outlined in this document does not violate any existing web standards. In fact, the HTML 4.01 specification explicitly allows for the definition of new link relation types (see Section 6.12: Link types). However, the exact mechanism employed by Mozilla is not yet standardized. An Internet-Draft is in the works. Standardization of this technique is part of the scope of HTML 5, see the current working dra...
... Yes, we send the following header along with each prefetch request: X-moz: prefetch Of course, this request header is not at all standardized, and it may change in future Mozilla releases. Chrome uses "X-Purpose: prefetch" or "Purpose: prefetch" header. Is there a preference to disable link prefetching? Yes, there is a hidden preference that you can set to disable link prefetching. Add this line to your prefs.js file located in your profile directory (or make the appropriate change via about:config): user_pref("network.prefetch-next", false); However, the theory is that if link prefetching needs to be disabled then there must be something wrong with the implementation. We would rather improve the implementation if it does not work correctly, than expect users to locate and tweak some ...
Proxy Auto-Configuration (PAC) file - HTTP
d in the PAC file defines the function: function FindProxyForURL(url, host) { // ... } Syntax function FindProxyForURL(url, host) Parameters url The URL being accessed. The path and query components of https:// URLs are stripped. In Chrome (versions 52 to 73), you can disable this by setting PacHttpsUrlStrippingEnabled to false in policy or by launching with the --unsafe-pac-url command-line flag (in Chrome 74, only the flag works, and from 75 onward, there is no way to disable path-stripping; as of Chrome 81, path-stripping does not apply to HTTP URLs, but there is interest in changing this behavior to match HTTPS); in Firefox, the preference is network.proxy.autoconfig_url.include_path. host The hostname extracted from the URL. This is only for convenience; it is the same string ...
... weekdayRange() dateRange() timeRange() Logging utility alert() There was one associative array (object) already defined, because at the time JavaScript code was unable to define it by itself: ProxyConfig.bindings Note: pactester (part of the pacparser package) was used to test the following syntax examples. The PAC file is named proxy.pac Command line: pactester -p ~/pacparser-master/tests/proxy.pac -u http://www.mozilla.org (passes the host parameter www.mozilla.org and the url parameter http://www.mozilla.org) isPlainHostName() Syntax isPlainHostName(host) Parameters host The hostname from the URL (excluding port number). Description True if and only if there is no domain name in the hostname (no dots). Examples isPlainHostNam...
Deprecated and obsolete features - JavaScript
from your code. RegExp properties the following properties are deprecated. This does not affect their use in replacement strings: Property Description $1-$9 Parenthesized substring matches, if any. Warning: Using these properties can result in problems, since browser extensions can modify them. Avoid them! $_ See input. $* See multiline. $& See lastMatch. $+ See lastParen. $` See leftContext. $' See rightContext. input The string against which a regular expression is matched. lastMatch The last matched characters. lastParen The last parenthesized substring match, if any. leftContext The substring preceding the most recent match. ...
...perties of RegExp instances, no longer of the RegExp object: Property Description global Whether or not to test the regular expression against all possible matches in a string, or only against the first. ignoreCase Whether or not to ignore case while attempting a match in a string. lastIndex The index at which to start the next match. multiline Whether or not to search in strings across multiple lines. source The text of the pattern. RegExp methods The compile() method is deprecated. The valueOf method is no longer specialized for RegExp. Use Object.valueOf(). Function properties The caller and arguments properties are deprecated, because they leak the function caller. Instead of the arguments property, yo...
arguments.callee - JavaScript
cifically Function.caller. Why is this? Well, at any point in time you can find the deepest caller of any function on the stack, and as I said above looking at the call stack has one single major effect: it makes a large number of optimizations impossible, or much much more difficult. ...
...it is not possible to inline f. Basically it means that any call site that may have been trivially inlinable accumulates a large number of guards: function f(a, b, c, d, e) { return a ? b * c : d * e; } If the JavaScript interpreter cannot guarantee that all the provided arguments are numbers at the point that the call is made, it needs to either insert checks for all the arguments before the inlined code, or it cannot inline the function. Now in this particular case a smart interpreter should be able to rearrange the checks to be more optimal and not check any values that would not be used. However in many cases that's just not possible and therefore it becomes impossible to inline. Examples Using arguments.callee in an anonymous recursive function A recursive function must be able to re...
EvalError() constructor - JavaScript
The EvalError constructor creates a new error regarding the global eval() function. This exception is not thrown by JavaScript anymore, however the EvalError object remains for compatibility. Syntax new EvalError([message[, fileName[, lineNumber]]]) Parameters message Optional. Human-readable description of the error fileName Optional. The name of the file containing the code that caused the exception lineNumber Optional. The line number of the code that caused the exception Examples EvalError is not used in the current ECMAScript specification and will thus not be thrown by the runtime. However, the object itself remains for backwards compatibility with earlier versions of the specification. Creating an EvalError try { throw new EvalError('Hello', 'someFile.js', 10); } ca...
...f remains for backwards compatibility with earlier versions of the specification. Creating an EvalError try { throw new EvalError('Hello', 'someFile.js', 10); } catch (e) { console.log(e instanceof EvalError); // true console.log(e.message); // "Hello" console.log(e.name); // "EvalError" console.log(e.fileName); // "someFile.js" console.log(e.lineNumber); // 10 console.log(e.columnNumber); // 0 console.log(e.stack); // "@Scratchpad/2:2:9\n" } Specifications Specification ECMAScript (ECMA-262)The definition of 'NativeError constructor' in that specification. ...
EvalError - JavaScript
ew EvalError object. Instance properties EvalError.prototype.message Error message. Although ECMA-262 specifies that EvalError should provide its own message property, in SpiderMonkey, it inherits Error.prototype.message. EvalError.prototype.name Error name. Inherited from Error. EvalError.prototype.fileName Path to file that raised this error. Inherited from Error. EvalError.prototype.lineNumber Line number in file that raised this error. Inherited from Error. EvalError.prototype.columnNumber Column number in line that raised this error. Inherited from Error. EvalError.prototype.stack Stack trace. Inherited from Error. Examples EvalError is not used in the current ECMAScript specification and will thus not be thrown by the runtime. However, the object itself remains for bac...
...f remains for backwards compatibility with earlier versions of the specification. Creating an EvalError try { throw new EvalError('Hello', 'someFile.js', 10); } catch (e) { console.log(e instanceof EvalError); // true console.log(e.message); // "Hello" console.log(e.name); // "EvalError" console.log(e.fileName); // "someFile.js" console.log(e.lineNumber); // 10 console.log(e.columnNumber); // 0 console.log(e.stack); // "@Scratchpad/2:2:9\n" } Specifications Specification ECMAScript (ECMA-262)The definition of 'EvalError' in that specification. ...
Function.name - JavaScript
Configurable yes Note that in non-standard, pre-ES2015 implementations the configurable attribute was false as well. JavaScript compressors and minifiers Warning: Be careful when using Function.name and source code transformations, such as those carried out by JavaScript compressors (minifiers) or obfuscators. These tools are often used as part of a JavaScript build pipeline to reduce the size of a program prior to deploying it to production. Such transformations often change a function's name at build-time. Source code such as: function Foo() {}; let foo = new Foo(); if (foo.constructor.name === 'Foo') { console.log("'foo' is an instance of 'Foo'"); } else { console.log('Oops!'); } may be compressed to: function a() {}; let b = new a(); if (b.constructor.
...b.constructor.name === 'Foo') { console.log("'foo' is an instance of 'Foo'"); } else { console.log('Oops!'); } In the uncompressed version, the program runs into the truthy-branch and logs "'foo' is an instance of 'Foo'". Whereas, in the compressed version it behaves differently, and runs into the else-branch. If you rely on Function.name, like in the example above, make sure your build pipeline doesn't change function names, or don't assume a function to have a particular name. Examples Function statement name The name property returns the name of a function statement. function doSomething() {} doSomething.name; // "doSomething" Function constructor name Functions created with the syntax new Function(...) or just Function(...) create Function objects and their name is "anonymous...
Intl.Collator.supportedLocalesOf() - JavaScript
Description Returns an array with a subset of the language tags provided in locales. The language tags returned are those for which the runtime supports a locale in collation that the locale matching algorithm used considers a match, so that it wouldn't have to fall back to the default locale. ...
... supports Indonesian and German but not Balinese in collation, supportedLocalesOf returns the Indonesian and German language tags unchanged, even though pinyin collation is not used with Indonesian and a specialized German for Indonesia is unlikely to be supported. Note the specification of the "lookup" algorithm here -- a "best fit" matcher might decide that Indonesian is an adequate match for Balinese since most Balinese speakers also understand Indonesian, and therefore return the Balinese language tag as well. var locales = ['ban', 'id-u-co-pinyin', 'de-ID']; var options = { localeMatcher: 'lookup' }; console.log(Intl.Collator.supportedLocalesOf(locales, options).join(', ')); // -> "id-u-co-pinyin, de-ID" Specifications Specification ECMAScript Internationalization AP...
Intl.DateTimeFormat.supportedLocalesOf() - JavaScript
Returns an array with a subset of the language tags provided in locales. The language tags returned are those for which the runtime supports a locale in date and time formatting that the locale matching algorithm used considers a match, so that it wouldn't have to fall back to the default locale. Examples Using supportedLocalesOf Assuming a runtime that supports Indonesian and German but not Balinese in date and time formatting, supportedLocalesOf returns the Indonesian and German language tags unchanged, even though pinyin collation is neither relevant to date and time formatting nor used with Indonesian, and a specialized German for Indonesia is unlikely to be supported. Note the specification of the "lookup" algorithm here -- a "best fit" matcher might decide that Indonesian is an adequa...
...time formatting, supportedLocalesOf returns the Indonesian and German language tags unchanged, even though pinyin collation is neither relevant to date and time formatting nor used with Indonesian, and a specialized German for Indonesia is unlikely to be supported. Note the specification of the "lookup" algorithm here -- a "best fit" matcher might decide that Indonesian is an adequate match for Balinese since most Balinese speakers also understand Indonesian, and therefore return the Balinese language tag as well. var locales = ['ban', 'id-u-co-pinyin', 'de-ID']; var options = { localeMatcher: 'lookup' }; console.log(Intl.DateTimeFormat.supportedLocalesOf(locales, options).join(', ')); // -> "id-u-co-pinyin, de-ID" Specifications Specification ECMAScript Internationalizat...
Intl.DisplayNames.supportedLocalesOf() - JavaScript
Returns an array with a subset of the language tags provided in locales. The language tags returned are those for which the runtime supports a locale in date and time formatting that the locale matching algorithm used considers a match, so that it wouldn't have to fall back to the default locale. Examples Using supportedLocalesOf Assuming a runtime that supports Indonesian and German but not Balinese in date and time formatting, supportedLocalesOf returns the Indonesian and German language tags unchanged, even though pinyin collation is neither relevant to date and time formatting nor used with Indonesian, and a specialized German for Indonesia is unlikely to be supported. Note the specification of the "lookup" algorithm here -- a "best fit" matcher might decide that Indonesian is an adequa...
...time formatting, supportedLocalesOf returns the Indonesian and German language tags unchanged, even though pinyin collation is neither relevant to date and time formatting nor used with Indonesian, and a specialized German for Indonesia is unlikely to be supported. Note the specification of the "lookup" algorithm here -- a "best fit" matcher might decide that Indonesian is an adequate match for Balinese since most Balinese speakers also understand Indonesian, and therefore return the Balinese language tag as well. const locales = ['ban', 'id-u-co-pinyin', 'de-ID']; const options = { localeMatcher: 'lookup' }; console.log(Intl.DisplayNames.supportedLocalesOf(locales, options).join(', ')); // -> "id-u-co-pinyin, de-ID" Specifications Specification Intl.DisplayNamesThe d...
Intl.ListFormat.supportedLocalesOf() - JavaScript
Returns an array with a subset of the language tags provided in locales. The language tags returned are those for which the runtime supports a locale in date and time formatting that the locale matching algorithm used considers a match, so that it wouldn't have to fall back to the default locale. Examples Using supportedLocalesOf Assuming a runtime that supports Indonesian and German but not Balinese in date and time formatting, supportedLocalesOf returns the Indonesian and German language tags unchanged, even though pinyin collation is neither relevant to date and time formatting nor used with Indonesian, and a specialized German for Indonesia is unlikely to be supported. Note the specification of the "lookup" algorithm here -- a "best fit" matcher might decide that Indonesian is an adequa...
...time formatting, supportedLocalesOf returns the Indonesian and German language tags unchanged, even though pinyin collation is neither relevant to date and time formatting nor used with Indonesian, and a specialized German for Indonesia is unlikely to be supported. Note the specification of the "lookup" algorithm here -- a "best fit" matcher might decide that Indonesian is an adequate match for Balinese since most Balinese speakers also understand Indonesian, and therefore return the Balinese language tag as well. const locales = ['ban', 'id-u-co-pinyin', 'de-ID']; const options = { localeMatcher: 'lookup' }; console.log(Intl.ListFormat.supportedLocalesOf(locales, options).join(', ')); // -> "id-u-co-pinyin, de-ID" Specifications Specification Intl.ListFormatThe defi...
Intl.NumberFormat.supportedLocalesOf() - JavaScript
ption Returns an array with a subset of the language tags provided in locales. The language tags returned are those for which the runtime supports a locale in number formatting that the locale matching algorithm used considers a match, so that it wouldn't have to fall back to the default locale. Examples Using supportedLocalesOf Assuming a runtime that supports Indonesian and German but not Balinese in number formatting, supportedLocalesOf returns the Indonesian and German language tags unchanged, even though pinyin collation is neither relevant to number formatting nor used with Indonesian, and a specialized German for Indonesia is unlikely to be supported. Note the specification of the "lookup" algorithm here -- a "best fit" matcher might decide that Indonesian is an adequate match for B...
...e in number formatting, supportedLocalesOf returns the Indonesian and German language tags unchanged, even though pinyin collation is neither relevant to number formatting nor used with Indonesian, and a specialized German for Indonesia is unlikely to be supported. Note the specification of the "lookup" algorithm here -- a "best fit" matcher might decide that Indonesian is an adequate match for Balinese since most Balinese speakers also understand Indonesian, and therefore return the Balinese language tag as well. var locales = ['ban', 'id-u-co-pinyin', 'de-ID']; var options = { localeMatcher: 'lookup' }; console.log(Intl.NumberFormat.supportedLocalesOf(locales, options).join(', ')); // -> "id-u-co-pinyin, de-ID" Specifications Specification ECMAScript Internationalizatio...
Intl.PluralRules.supportedLocalesOf() - JavaScript
ion Returns an array with a subset of the language tags provided in locales. The language tags returned are those for which the runtime supports a locale in plural formatting that the locale matching algorithm used considers a match, so that it wouldn't have to fall back to the default locale. Examples Using supportedLocalesOf() Assuming a runtime that supports Indonesian and German but not Balinese in plural formatting, supportedLocalesOf returns the Indonesian and German language tags unchanged, even though pinyin collation is neither relevant to plural formatting nor used with Indonesian, and a specialized German for Indonesia is unlikely to be supported. Note the specification of the lookup algorithm here -- a best fit matcher might decide that Indonesian is an adequate match for Balin...
...atting, supportedLocalesOf returns the Indonesian and German language tags unchanged, even though pinyin collation is neither relevant to plural formatting nor used with Indonesian, and a specialized German for Indonesia is unlikely to be supported. Note the specification of the lookup algorithm here -- a best fit matcher might decide that Indonesian is an adequate match for Balinese since most Balinese speakers also understand Indonesian, and therefore return the Balinese language tag as well. var locales = ['ban', 'id-u-co-pinyin', 'de-ID']; var options = { localeMatcher: 'lookup' }; console.log(Intl.PluralRules.supportedLocalesOf(locales, options).join(', ')); // -> "id-u-co-pinyin, de-ID" Specifications Specification ECMAScript Internationalization API (ECMA-402)The d...
Intl.RelativeTimeFormat.supportedLocalesOf() - JavaScript
Returns an array with a subset of the language tags provided in locales. The language tags returned are those for which the runtime supports a locale in date and time formatting that the locale matching algorithm used considers a match, so that it wouldn't have to fall back to the default locale. Examples Using supportedLocalesOf Assuming a runtime that supports Indonesian and German but not Balinese in date and time formatting, supportedLocalesOf returns the Indonesian and German language tags unchanged, even though pinyin collation is neither relevant to date and time formatting nor used with Indonesian, and a specialized German for Indonesia is unlikely to be supported. Note the specification of the "lookup" algorithm here -- a "best fit" matcher might decide that Indonesian is an adequa...
...time formatting, supportedLocalesOf returns the Indonesian and German language tags unchanged, even though pinyin collation is neither relevant to date and time formatting nor used with Indonesian, and a specialized German for Indonesia is unlikely to be supported. Note the specification of the "lookup" algorithm here -- a "best fit" matcher might decide that Indonesian is an adequate match for Balinese since most Balinese speakers also understand Indonesian, and therefore return the Balinese language tag as well. const locales = ['ban', 'id-u-co-pinyin', 'de-ID']; const options = { localeMatcher: 'lookup' }; console.log(Intl.RelativeTimeFormat.supportedLocalesOf(locales, options).join(', ')); // -> "id-u-co-pinyin, de-ID" Specifications Specification Status Comment ...
JSON - JavaScript
double-quoted strings; trailing commas are forbidden. Numbers Leading zeros are prohibited. A decimal point must be followed by at least one digit. NaN and Infinity are unsupported. Any JSON text is a valid JavaScript expression... ...But only in JavaScript engines that have implemented the proposal to make all JSON text valid ECMA-262. In engines that haven't implemented the proposal, U+2028 LINE SEPARATOR and U+2029 PARAGRAPH SEPARATOR are allowed in string literals and property keys in JSON; but their use in these features in JavaScript string literals is a SyntaxError. Consider this example where JSON.parse() parses the string as JSON and eval executes the string as JavaScript: let code = '"\u2028\u2029"' JSON.parse(code) // evaluates to "\u2028\u2029" in all engines eval(code) ...
...NString : JSON JSONArray = [ ] or [ ArrayElements ] ArrayElements = JSON or ArrayElements , JSON Insignificant whitespace may be present anywhere except within a JSONNumber (numbers must contain no whitespace) or JSONString (where it is interpreted as the corresponding character in the string, or would cause an error). The tab character (U+0009), carriage return (U+000D), line feed (U+000A), and space (U+0020) characters are the only valid whitespace characters. Static methods JSON.parse(text[, reviver]) Parse the string text as JSON, optionally transform the produced value and its properties, and return the value. Any violations of the JSON syntax, including those pertaining to the differences between JavaScript and JSON, cause a SyntaxError to be thrown. The rev...
Promise.prototype.finally() - JavaScript
Return value Returns a Promise whose finally handler is set to the specified function, onFinally. Description The finally() method can be useful if you want to do some processing or cleanup once the promise is settled, regardless of its outcome. The finally() method is very similar to calling .then(onFinally, onFinally) however there are a couple of differences: When creating a function inline, you can pass it once, instead of being forced to either declare it twice, or create a variable for it A finally callback will not receive any argument, since there's no reliable means of determining if the promise was fulfilled or rejected. This use case is for precisely when you do not care about the rejection reason, or the fulfillment value, and so there's no need to provide it. So for examp...
...when console = {} */ }) .finally(function() { isLoading = false; }); Please do not add polyfills on MDN pages. For more details, refer to: https://discourse.mozilla.org/t/mdn-rfc-001-mdn-wiki-pages-shouldnt-be-a-distributor-of-polyfills/24500 Specifications Specification ECMAScript (ECMA-262)The definition of 'Promise.prototype.finally' in that spec...
WebAssembly.CompileError() constructor - JavaScript
The WebAssembly.CompileError() constructor creates a new WebAssembly CompileError object, which indicates an error during WebAssembly decoding or validation. Syntax new WebAssembly.CompileError(message, fileName, lineNumber) Parameters message Optional Human-readable description of the error. fileName Optional The name of the file containing the code that caused the exception. lineNumber Optional The line number of the code that caused the exception. Examples Creating a new CompileError instance The following snippet creates a new CompileError instance, and logs its details to the console: try { throw new WebAssembly.CompileError('Hello', 'someFile', 10); } catch (e) { console.log(e instanceof CompileError); // true console.log(e.message); // "Hello" co...
... ECMAScript (ECMA-262)The definition of 'NativeError constructor' in that...
WebAssembly.CompileError - JavaScript
ompileError.prototype.message Error message. Although ECMA-262 specifies that URIError should provide its own message property, in SpiderMonkey, it inherits Error.prototype.message. WebAssembly.CompileError.prototype.name Error name. Inherited from Error. WebAssembly.CompileError.prototype.fileName Path to file that raised this error. Inherited from Error. WebAssembly.CompileError.prototype.lineNumber Line number in file that raised this error. Inherited from Error. WebAssembly.CompileError.prototype.columnNumber Column number in line that raised this error. Inherited from Error. WebAssembly.CompileError.prototype.stack Stack trace. Inherited from Error. Instance methods WebAssembly.CompileError.prototype.toSource() Returns code that could eval to the same error. Inherited fro...
... ECMAScript (ECMA-262)The definition of 'NativeError' in that specificati...
WebAssembly.LinkError() constructor - JavaScript
The WebAssembly.LinkError() constructor creates a new WebAssembly LinkError object, which indicates an error during module instantiation (besides traps from the start function). Syntax new WebAssembly.LinkError(message, fileName, lineNumber) Parameters message Optional Human-readable description of the error. fileName Optional The name of the file containing the code that caused the exception. lineNumber Optional The line number of the code that caused the exception. Examples Creating a new LinkError instance The following snippet creates a new LinkError instance, and logs its details to the console: try { throw new WebAssembly.LinkError('Hello', 'someFile', 10); } catch (e) { console.log(e instanceof LinkError); // true console.log(e.message); // "Hello"...
... ECMAScript (ECMA-262)The definition of 'NativeError constructors' in that specification...
WebAssembly.LinkError - JavaScript
ebAssembly.LinkError.prototype.message Error message. Although ECMA-262 specifies that URIError should provide its own message property, in SpiderMonkey, it inherits Error.prototype.message. WebAssembly.LinkError.prototype.name Error name. Inherited from Error. WebAssembly.LinkError.prototype.fileName Path to file that raised this error. Inherited from Error. WebAssembly.LinkError.prototype.lineNumber Line number in file that raised this error. Inherited from Error. WebAssembly.LinkError.prototype.columnNumber Column number in line that raised this error. Inherited from Error. WebAssembly.LinkError.prototype.stack Stack trace. Inherited from Error. Instance methods WebAssembly.LinkError.prototype.toSource() Returns code that could eval to the same error. Inherited from Error. ...
... ECMAScript (ECMA-262)The definition of 'NativeError' in that specification. Brow...
WebAssembly.RuntimeError() constructor - JavaScript
The WebAssembly.RuntimeError() constructor creates a new WebAssembly RuntimeError object -- the type that is thrown whenever WebAssembly specifies a trap. Syntax new WebAssembly.RuntimeError(message, fileName, lineNumber) Parameters message Optional Human-readable description of the error. fileName Optional The name of the file containing the code that caused the exception. lineNumber Optional The line number of the code that caused the exception. Examples Creating a new RuntimeError instance The following snippet creates a new RuntimeError instance, and logs its details to the console: try { throw new WebAssembly.RuntimeError('Hello', 'someFile', 10); } catch (e) { console.log(e instanceof RuntimeError); // true console.log(e.message); // "Hello" conso...
... ECMAScript (ECMA-262)The definition of 'NativeError construc...
WebAssembly.RuntimeError - JavaScript
untimeError.prototype.message Error message. Although ECMA-262 specifies that URIError should provide its own message property, in SpiderMonkey, it inherits Error.prototype.message. WebAssembly.RuntimeError.prototype.name Error name. Inherited from Error. WebAssembly.RuntimeError.prototype.fileName Path to file that raised this error. Inherited from Error. WebAssembly.RuntimeError.prototype.lineNumber Line number in file that raised this error. Inherited from Error. WebAssembly.RuntimeError.prototype.columnNumber Column number in line that raised this error. Inherited from Error. WebAssembly.RuntimeError.prototype.stack Stack trace. Inherited from Error. Instance methods WebAssembly.RuntimeError.prototype.toSource() Returns code that could eval to the same error. Inherited fro...
... ECMAScript (ECMA-262)The definition of 'NativeError' in that specificati...
Destructuring assignment - JavaScript
le.log(a); // 3 console.log(b); // 1 const arr = [1,2,3]; [arr[2], arr[1]] = [arr[1], arr[2]]; console.log(arr); // [1,3,2] Parsing an array returned from a function It's always been possible to return an array from a function. Destructuring can make working with an array return value more concise. In this example, f() returns the values [1, 2] as its output, which can be parsed in a single line with destructuring. function f() { return [1, 2]; } let a, b; [a, b] = f(); console.log(a); // 1 console.log(b); // 2 Ignoring some returned values You can ignore return values that you're not interested in: function f() { return [1, 2, 3]; } const [a, , b] = f(); console.log(a); // 1 console.log(b); // 3 const [c] = f(); console.log(c); // 1 You can also ignore all returned values:...
... object literal destructuring assignment without a declaration. {a, b} = {a: 1, b: 2} is not valid stand-alone syntax, as the {a, b} on the left-hand side is considered a block and not an object literal. However, ({a, b} = {a: 1, b: 2}) is valid, as is const {a, b} = {a: 1, b: 2} Your ( ... ) expression needs to be preceded by a semicolon or it may be used to execute a function on the previous line. Assigning to new variable names A property can be unpacked from an object and assigned to a variable with a different name than the object property. const o = {p: 42, q: true}; const {p: foo, q: bar} = o; console.log(foo); // 42 console.log(bar); // true Here, for example, const {p: foo} = o takes from the object o the property named p and assigns it to a local variable named foo. Default...
Strict mode - JavaScript
istyping a variable in an assignment creates a new property on the global object and continues to "work" (although future failure is possible: likely, in modern JavaScript). Assignments, which would accidentally create global variables, instead throw an error in strict mode: 'use strict'; // Assuming no global variable mistypedVariable exists mistypeVariable = 17; // this line throws a ReferenceError due to the // misspelling of variable Second, strict mode makes assignments which would otherwise silently fail to throw an exception. For example, NaN is a non-writable global variable. In normal code assigning to NaN does nothing; the developer receives no failure feedback. In strict mode assigning to NaN throws an exception. Any assignment that ...
...17); console.assert(pair[0] === 42); console.assert(pair[1] === 17); Third, arguments.callee is no longer supported. In normal code arguments.callee refers to the enclosing function. This use case is weak: simply name the enclosing function! Moreover, arguments.callee substantially hinders optimizations like inlining functions, because it must be made possible to provide a reference to the un-inlined function if arguments.callee is accessed. arguments.callee for strict mode functions is a non-deletable property which throws an error when set or retrieved: 'use strict'; var f = function() { return arguments.callee; }; f(); // throws a TypeError "Securing" JavaScript Strict mode makes it easier to write "secure" JavaScript. Some websites now provide ways for users to write JavaScript which...
JavaScript shells - JavaScript
ell enhanced by Perl. Can use Perl modules directly from JavaScript: DBI for database integration, GTK2 for GUI apps, POSIX for system programming, etc. The best of CPAN now for JavaScript programmers. ShellJS - Portable Unix shell commands for Node.js List of JavaScript shells The following JavaScript shells work with Mozilla. Firefox has a built-in JavaScript console, which support multi-line editing. JavaScript Shell (js) - A command line interpreter for JavaScript xpcshell is an XPConnect - enabled shell, sometimes useful for Mozilla development. Babel REPL - A browser-based REPL for experimenting with future JavaScript. ES6Console.com - An open-source JavaScript console to test ECMAScript 2015 code inside the browser. jsconsole.com -- An open-source JavaScript console with the...
...ng with future JavaScript. ES6Console.com - An open-source JavaScript console to test ECMAScript 2015 code inside the browser. jsconsole.com -- An open-source JavaScript console with the ability to easily link to particular expressions JavaScript Shell (web page) - also available as part of the Extension Developer's Extension Jash: JavaScript Shell - a DHTML based shell that gives you command line access to a web page. MozRepl - Connect to Firefox and other Mozilla apps, explore and modify them from the inside, while they're running. Execute JS - (No longer maintained) - Firefox-Extension which provides an enhanced JavaScript-Console, where you can comfortably enter and execute arbitrary JavaScript-Code and modify functions. xqjs - Simple console for Firefox. ...
JavaScript
tion made easy. By adding TogetherJS to your site, your users can help each other out on a website in real-time! Stack Overflow Stack Overflow questions tagged with "JavaScript". JavaScript versions and release notes Browse JavaScript's feature history and implementation status. JSFiddle Edit JavaScript, CSS, HTML and get live results. Use external resources and collaborate with your team online. Plunker Plunker is an online community for creating, collaborating on and sharing your web development ideas. Edit your JavaScript, CSS, HTML files and get live results and file structure. JSBin JS Bin is an open-source collaborative web development debugging tool. Codepen Codepen is another collaborative web development tool used as a live result playground. StackBlitz StackBl...
...er is an online community for creating, collaborating on and sharing your web development ideas. Edit your JavaScript, CSS, HTML files and get live results and file structure. JSBin JS Bin is an open-source collaborative web development debugging tool. Codepen Codepen is another collaborative web development tool used as a live result playground. StackBlitz StackBlitz is another online playground/debugging tool, which can host and deploy full-stack applications using React, Angular, etc. ...
<maction> - MathML
MathML <maction> element provides a possibility to bind actions to (sub-) expressions. The action itself is specified by the actiontype attribute, which accepts several values. To specify which child elements are addressed by the action, you can make use of the selection attribute. Attributes actiontype The action which specifies what happens for this element. Possible values are: statusline: If there is a click on the expression or the reader moves the pointer over it, the message is sent to the browser's status line. The syntax is: <maction actiontype="statusline"> expression message </maction>. toggle: When there is a click on the subexpression, the rendering alternates the display of selected subexpressions. Therefore each click increments the selection value. The syntax is: ...
... expression, a tooltip box with a message is displayed near the expression. The syntax is: <maction actiontype="tooltip"> expression message </maction>. class, id, style Provided for use with stylesheets. href Used to set a hyperlink to a specified URI. mathbackground The background color. You can use #rgb, #rrggbb and HTML color names. mathcolor The text color and also the fraction line color. You can use #rgb, #rrggbb and HTML color names. selection The child element which is addressed by the action. The default value is 1, which is the first child element. Examples The following example uses the "toggle" actiontype: <math> <maction actiontype="toggle"> <mfrac> <mn>6</mn> <mn>8</mn> </mfrac> <mfrac> <mrow> <mn>3</mn> <mo>&sdot;</mo> ...
<math> - MathML
Web › MathML › Element › math
es. mathcolor The text color. You can use #rgb, #rrggbb and HTML color names. display This enumerated attribute specifies how the enclosed MathML markup should be rendered. It can have one of the following values: block, which means that this element will be displayed outside the current span of text, as a block that can be positioned anywhere without changing the meaning of the text; inline, which means that this element will be displayed inside the current span of text, and cannot be moved out of it without changing the meaning of that text. If not present, its default value is inline. mode Deprecated in favor of the display attribute. Possible values are: display (which has the same effect as display="block") and inline. overflow Specifies how an expression behaves if...
...t span of text, and cannot be moved out of it without changing the meaning of that text. If not present, its default value is inline. mode Deprecated in favor of the display attribute. Possible values are: display (which has the same effect as display="block") and inline. overflow Specifies how an expression behaves if it is too long to fit in the allowed width. Possible values are: linebreak (default), scroll, elide, truncate, scale. Examples HTML5 notation <!DOCTYPE html> <html> <head> <title>MathML in HTML5</title> </head> <body> <math> <mrow> <mrow> <msup> <mi>a</mi> <mn>2</mn> </msup> <mo>+</mo> <msup> <mi>b</mi> <mn>2</mn> </msup> </mrow> <mo>=</mo> ...
<mfrac> - MathML
Web › MathML › Element › mfrac
Otherwise, if set to false (which is the default value), numerator and denominator are on top of each other. This attribute is deprecated and will be removed in the future. Use U+2044 (fraction slash) instead. class, id, style Provided for use with stylesheets. ...
...ated and will be removed in the future. Use U+2044 (fraction slash) instead. class, id, style Provided for use with stylesheets. denomalign The alignment of the denominator under the fraction. Possible values are: left, center (default), and right. This attribute is deprecated and will be removed in the future. Use CSS text-align instead. href Used to set a hyperlink to a specified URI. linethickness The thickness of the horizontal fraction line. This attributes accepts any length values. The values medium, thin, and thick are deprecated and will be removed in the future. mathbackground The background color. You can use #rgb, #rrggbb and HTML color names. mathcolor The text color and also the fraction line color. You can use #rgb, #rrggbb and HTML color names. numalign The ...
MathML element reference - MathML
(Operator) <mover> (Overscript) P <mpadded> (Space around content) <mphantom> (Invisible content with reserved space) R <mroot> (Radical with specified index) <mrow> (Grouped sub-expressions) S <ms> (String literal) <mscarries> (Annotations such as carries) <mscarry> (Single carry, child element of <mscarries>) <msgroup> (Grouped rows of <mstack> and <mlongdiv> elements) <msline> (Horizontal lines inside <mstack> elements) <mspace> (Space) <msqrt> (Square root without an index) <msrow> (Rows in <mstack> elements) <mstack> (Stacked alignment) <mstyle> (Style change) <msub> (Subscript) <msup> (Superscript) <msubsup> (Subscript-superscript pair) T <mtable> (Table or matrix) <mtd> (Cell in a table or a matrix) <mtext> (Text) <mtr> (Row in a table or a matrix)...
...al layout <menclose> <merror> <mfenced> <mfrac> <mpadded> <mphantom> <mroot> <mrow> <msqrt> <mstyle> Script and limit elements <mmultiscripts> <mover> <mprescripts> <msub> <msubsup> <msup> <munder> <munderover> <none> Tabular math <maligngroup> <malignmark> <mlabeledtr> <mtable> <mtd> <mtr> Elementary math <mlongdiv> <mscarries> <mscarry> <msgroup> <msline> <msrow> <mstack> Uncategorized elements <maction> Semantic annotations <annotation> <annotation-xml> <semantics> ...
MathML documentation index - MathML
Web › MathML › Index
ges. 3 Examples Beginner, Example, Guide, MathML, NeedsBeginnerUpdate Below you'll find some examples you can look at to help you to understand how to use MathML to display increasingly complex mathematical concepts in Web content. 4 MathML: Deriving the Quadratic Formula Beginner, Education, Example, Guide, HTML5, MathML, NeedsBeginnerUpdate This page outlines the derivation of the Quadratic Formula. 5 Proving the Pythagorean theorem Beginner, Example, Guide, HTML5 Math, Math education, MathML, NeedsBeginnerUpdate We will now prove the Pythagorean theorem: 6 MathML attribute reference MathML, MathML Reference This is an alphabetical list of MathML attributes. More details for each attribute are available on pa...
...ce, MathML:Element, MathML:General Layout Schemata The MathML <mpadded> element is used to add extra padding and to set the general adjustment of position and size of enclosed contents. 24 <mphantom> MathML, MathML Reference, MathML:Element, MathML:General Layout Schemata The MathML <mphantom> element is rendered invisibly, but dimensions (such as height, width, and baseline position) are still kept. 25 <mroot> MathML, MathML Reference, MathML:Element, MathML:General Layout Schemata The MathML <mroot> element is used to display roots with an explicit index. Two arguments are accepted, which leads to the syntax: <mroot> base index </mroot>. 26 <mrow> MathML, MathML Reference, MathML:Element, MathML:General Layout Schemata The ...
Autoplay guide for media and Web Audio APIs - Web media technologies
engages with media frequently, or manually through preferences or other user interface features If the autoplay feature policy is used to grant autoplay support to an <iframe> and its document. Otherwise, the playback will likely be blocked. The exact situations that result in blocking, and the specifics of how sites become whitelisted vary from browser to browser, but the above are good guidelines to go by. For details, see the auto-play policies for Google Chrome and WebKit. Note: Put another way, playback of any media that includes audio is generally blocked if the playback is programmatically initiated in a tab which has not yet had any user interaction. Browsers may additionally choose to block under other circumstances. Autoplay of media elements Now that we've covered what aut...
...view of the page's main functionality. To autoplay videos like these, you have two options: don't have an audio track, or have an audio track but configure the <video> element to mute the audio by default, like this: <video src="/videos/awesomevid.webm" controls autoplay muted> This video element is configured to include the user controls (typically play/pause, scrubbing through the video's timeline, volume control, and muting); also, since the muted attribute is included, the video will autoplay but with the audio muted. The user has the option, however, of re-enabling the audio by clicking on the unmute button in the controls. Browser configuration options Browsers may have preferences that control the way autoplay works, or how autoplay blocking is handled. Here, any such preferences th...
Recommended Web Performance Timings: How long is too long? - Web Performance
Load goal The 'Under a second' is often touted as optimal for load, but what does that mean? A second should be considered a rule in the maximum amount of time to indicate to a user that the request for new content was made and will load, such as the browser displaying the page title and the background color of the page displaying. ...
...ownload speedy. 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. In optimizing for performance, do set an ambitious first load goal, such as 5 seconds over the mobile 3G network and 1.5 seconds on an office T1 line, with even more ambitious page load goals for subsequent page loads, leveraging service workers and caching. There are different suggested times for initially loading the page versus loading additional assets, responding to user interaction, and ensuring smooth animations: Idling goal Browsers are single threaded (though background threads are supported for web workers). This means that user in...
class - SVG: Scalable Vector Graphics
Web › SVG › Attribute › class
ist-of-Ts> (Where T is some type.) A list consists of a separated sequence of values. Unless explicitly described differently, lists within SVG's XML attributes can be either comma-separated (with optional white space before or after the comma), or white space-separated. White space in lists is defined as one or more of the following consecutive characters: "space" (U+0020), "tab" (U+0009), "line feed" (U+000A), "carriage return" (U+000D), and "form-feed" (U+000C). The following is a template for an EBNF grammar describing the <list-of-Ts> syntax: list-of-Ts ::= T | T, list-of-Ts Within the SVG DOM, values of a <list-of-Ts> type are represented by an interface specific for the particular type T. For example, a <list-of-lengths> is represented in the SVG DOM using an S...
...te: <a> <altGlyph> <circle> <clipPath> <defs> <desc> <ellipse> <feBlend> <feColorMatrix> <feComponentTransfer> <feComposite> <feConvolveMatrix> <feDiffuseLighting> <feDisplacementMap> <feFlood> <feGaussianBlur> <feImage> <feMerge> <feMorphology> <feOffset> <feSpecularLighting> <feTile> <feTurbulence> <filter> <font> <foreignObject> <g> <glyph> <glyphRef> <image> <line> <linearGradient> <marker> <mask> <missing-glyph> <path> <pattern> <polygon> <polyline> <radialGradient> <rect> <stop> <svg> <switch> <symbol> <text> <textPath> <title> <tref> <tspan> <use> ...
clip-path - SVG: Scalable Vector Graphics
The clip-path presentation attribute defines or associates a clipping path with the element it is related to. Note: As a presentation attribute clip-path can be used as a CSS property. ...
... or associates a clipping path with the element it is related to. Note: As a presentation attribute clip-path can be used as a CSS property. ...
exponent - SVG: Scalable Vector Graphics
The exponent attribute defines the exponent of the gamma function. ...
...eFuncB>, <feFuncG>, and <feFuncR> html, body, svg { height: 100%; } <svg viewBox="0 0 420 200" xmlns="http://www.w3.org/2000/svg"> <defs> <linearGradient id="gradient" gradientUnits="userSpaceOnUse" x1="0" y1="0" x2="200" y2="0"> <stop offset="0" stop-color="#ff0000" /> <stop offset="0.5" stop-color="#00ff00" /> <stop offset="1" stop-color="#0000ff" /> </linearGradient> </defs> <filter id="componentTransfer1" x="0" y="0" width="100%" height="100%"> <feComponentTransfer> <feFuncR type="gamma" exponent="1"/> <feFuncG type="gamma" exponent="1"/> <feFuncB type="gamma" exponent="1"/> </feComponentTransfer> </filter> <filter id="componentTransfer2" x="0" y="0" width="100%" height="100%"> <feComponentTransfer> <fe...
fill - SVG: Scalable Vector Graphics
Web › SVG › Attribute › fill
nings. For shapes and text it's a presentation attribute that defines the color (or any SVG paint servers like gradients or patterns) used to paint the element; for animation it defines the final state of the animation. As a presentation attribute, it can be applied to any element but it only has an effect on the following eleven elements: <altGlyph>, <circle>, <ellipse>, <path>, <polygon>, <polyline>, <rect>, <text>, <textPath>, <tref>, and <tspan>. For animation five elements are using this attribute: <animate>, <animateColor>, <animateMotion>, <animateTransform>, and <set>. html,body,svg { height:100% } <svg viewBox="0 0 300 100" xmlns="http://www.w3.org/2000/svg"> <!-- Simple color fill --> <circle cx="50" cy="50" r="40" fill="pink" /> <!-- Fill circle with a gradient --> ...
... Note: As a presentation attribute fill can be used as a CSS property. polygon For <polygon>, fill is a presentation attribute that defines the color of the interior of the shape. (Interior is define by the fill-rule attribute) Value <paint> Default value black Animatable Yes Note: As a presentation attribute fill can be used as a CSS property. polyline For <polyline>, fill is a presentation attribute that defines tthe color of the interior of the shape. (Interior is define by the fill-rule attribute) Value <paint> Default value black Animatable Yes Note: As a presentation attribute fill can be used as a CSS property. rect For <rect>, fill is a presentation attribute that defines the color of the re...
font-size - SVG: Scalable Vector Graphics
Note: As a presentation attribute, font-size can be used as a CSS property. See the css font-size property for more information. ...
... Note: As a presentation attribute, font-size can be used as a CSS property. See the css font-size property for more information. ...
in - SVG: Scalable Vector Graphics
Web › SVG › Attribute › in
or re-use as the implicit input into the next filter primitive if that filter primitive provides no value for its in attribute. Workaround for BackgroundImage Instead of using in="BackgroundImage", we need to import one of the images to blend inside the filter itself, using an <feImage> element. HTML <div style="width: 420px; height: 220px;"> <svg style="width:200px; height:200px; display: inline;" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> <defs> <filter id="backgroundMultiply"> <!-- This will not work. --> <feBlend in="BackgroundImage" in2="SourceGraphic" mode="multiply"/> </filter> </defs> <image xlink:href="https://developer.mozilla.org/files/6457/mdn_logo_only_color.png" x="10%" y="10%" width="80%" height="80%"/> <circle...
...is will not work. --> <feBlend in="BackgroundImage" in2="SourceGraphic" mode="multiply"/> </filter> </defs> <image xlink:href="https://developer.mozilla.org/files/6457/mdn_logo_only_color.png" x="10%" y="10%" width="80%" height="80%"/> <circle cx="50%" cy="40%" r="40%" fill="#c00" style="filter:url(#backgroundMultiply);" /> </svg> <svg style="width:200px; height:200px; display: inline;" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> <defs> <filter id="imageMultiply"> <!-- This is a workaround. --> <feImage xlink:href="https://developer.mozilla.org/files/6457/mdn_logo_only_color.png" x="10%" y="10%" width="80%" height="80%"/> <feBlend in2="SourceGraphic" mode="multiply"/> </filter> </defs> <circle cx="50%" cy="40%"...
stroke-opacity - SVG: Scalable Vector Graphics
oke-opacity attribute is a presentation attribute defining the opacity of the paint server (color, gradient, pattern, etc) applied to the stroke of a shape. Note: As a presentation attribute stroke-opacity can be used as a CSS property. ...
...s a presentation attribute defining the opacity of the paint server (color, gradient, pattern, etc) applied to the stroke of a shape. Note: As a presentation attribute stroke-opacity can be used as a CSS property. ...
stroke-width - SVG: Scalable Vector Graphics
The stroke-width attribute is a presentation attribute defining the width of the stroke to be applied to the shape. ...
... The stroke-width attribute is a presentation attribute defining the width of the stroke to be applied to the shape. ...
tableValues - SVG: Scalable Vector Graphics
The tableValues attribute defines a list of numbers defining a lookup table of values for a for a color component transfer function. ...
...eFuncB>, <feFuncG>, and <feFuncR> html, body, svg { height: 100%; } <svg viewBox="0 0 420 200" xmlns="http://www.w3.org/2000/svg"> <defs> <linearGradient id="gradient" gradientUnits="userSpaceOnUse" x1="0" y1="0" x2="200" y2="0"> <stop offset="0" stop-color="#ff0000" /> <stop offset="0.5" stop-color="#00ff00" /> <stop offset="1" stop-color="#0000ff" /> </linearGradient> </defs> <filter id="componentTransfer1" x="0" y="0" width="100%" height="100%"> <feComponentTransfer> <feFuncR type="table" tableValues="0 1"/> <feFuncG type="table" tableValues="0 1"/> <feFuncB type="table" tableValues="0 1"/> </feComponentTransfer> </filter> <filter id="componentTransfer2" x="0" y="0" width="100%" height="100%"> <feComponentTran...
target - SVG: Scalable Vector Graphics
Web › SVG › Attribute › target
nt, or is viewed with a tabbed browser. ...
...l active window or tab is replaced by the linked content, if it exists and can be securely accessed from this document _blank A new un-named window or tab is requested for the display of the linked content, if this document can securely do so. If the user agent does not support multiple windows/tabs, the result is the same as _top. <XML-Name> Specifies the name of the browsing context (tab, inline frame, object, etc.) for display of the linked content. If a context with this name already exists, and can be securely accessed from this document, it is re-used, replacing the existing content. If it does not exist, it is created (the same as '_blank', except that it now has a name). The name must be a valid XML Name [XML11], and should not start with an underscore (U+005F LOW LINE character), ...
vector-effect - SVG: Scalable Vector Graphics
he vector effect to use when drawing an object. Vector effects are applied before any of the other compositing operations, i.e. filters, masks and clips. Note: As a presentation attribute, vector-effect can be used as a CSS property. As a presentation attribute, it can be applied to any element but it has effect only on the following ten elements: <circle>, <ellipse>, <foreignObject>, <image>, <line>, <path>, <polygon>, <polyline>, <rect>, <text>, <textPath> <tspan>, and <use> Usage notes Value none | non-scaling-stroke | non-scaling-size | non-rotation | fixed-position Default value none Animatable Yes none This value specifies that no vector effect shall be applied, i.e. the default rendering behaviour is used which is to first fill the geome...
...h> <tspan>, and <use> Usage notes Value none | non-scaling-stroke | non-scaling-size | non-rotation | fixed-position Default value none Animatable Yes none This value specifies that no vector effect shall be applied, i.e. the default rendering behaviour is used which is to first fill the geometry of a shape with a specified paint, then stroke the outline with a specified paint. non-scaling-stroke This value modifies the way an object is stroked. Normally stroking involves calculating stroke outline of the shape's path in current user coordinate system and filling that outline with the stroke paint (color or gradient). The resulting visual effect of this value is that the stroke width is not dependant on the transformations of the element (inclu...
writing-mode - SVG: Scalable Vector Graphics
See the css writing-mode property for more information. ...
...See the css writing-mode property for more information. ...
xlink:title - SVG: Scalable Vector Graphics
present help text that appears when a user lets a mouse pointer hover over a starting resource. Note: New content should use a <title> child element rather than a xlink:title attribute. These elements are using this attribute: <a>, <altGlyph>, <animate>, <animateColor>, <animateMotion>, <animateTransform>, <color-profile>, <cursor>, <feImage>, <filter>, <font-face-uri>, <glyphRef>, <image>, <linearGradient>, <mpath>, <pattern>, <radialGradient>, <script>, <set>, <textPath>, <tref>, and <use> Usage context Value <anything> Default value None Animatable No <anything> This value specifies the title used to describe the meaning of the link or resource. Specifications Specification Status Comment Scalable Vector Gra...
...t value None Animatable No <anything> This value specifies the title used to describe the meaning of the link or resource. Specifications Specification Status Comment Scalable Vector Graphics (SVG) 2The definition of 'seed' in that specification. Candidate Recommendation Deprecated the attribute and made it only apply to <a>, <image>, <linearGradient>, <pattern>, <radialGradient>, <script>, <textPath>, and <use> Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'seed' in that specification. Recommendation Initial definition ...
xml:space - SVG: Scalable Vector Graphics
Then, it draws all space characters (including leading, trailing and multiple...
...Then, it draws all space characters (including leading, trailing and multiple consecutive space characters). For example, the string "a b" (three spaces between "a" and "b") separates "a" and "b" more than "a b" (one space between "a" and "b"). ...
<animate> - SVG: Scalable Vector Graphics
Web › SVG › Element › animate
g:0; } <svg viewBox="0 0 10 10" xmlns="http://www.w3.org/2000/svg"> <rect width="10" height="10"> <animate attributeName="rx" values="0;5;0" dur="10s" repeatCount="indefinite" /> </rect> </svg> Attributes Animation Attributes Animation timing attributes begin, dur, end, min, max, restart, repeatCount, repeatDur, fill Animation value attributes calcMode, values, keyTimes, keySplines, from, to, by Other Animation attributes Most notably: attributeName, additive, accumulate Animation event attributes Most notably: onbegin, onend, onrepeat Global attributes Core Attributes Most notably: id Styling Attributes class, style Event Attributes Global event attributes, Document element event attributes Usage notes This element implements the SVGAnimateElement interfa...
...ing or disabling animation, as well as using the Reduced Motion Media Query to create a complimentary experience for users who have expressed a preference for no animated experiences. Designing Safer Web Animation For Motion Sensitivity . An A List Apart Article An Introduction to the Reduced Motion Media Query | CSS-Tricks Responsive Design for Motion | WebKit MDN Understanding WCAG, Guideline 2.2 explanations Understanding Success Criterion 2.2.2 | W3C Understanding WCAG 2.0 Specifications Specification Status Comment SVG Animations Level 2The definition of '<animate>' in that specification. Editor's Draft No change Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of '<animate>' in that specification. Recommendation ...
<circle> - SVG: Scalable Vector Graphics
Web › SVG › Element › circle
sing Attributes Most notably: requiredExtensions, systemLanguage Event Attributes Global event attributes, Graphical event attributes Presentation Attributes Most notably: clip-path, clip-rule, color, color-interpolation, color-rendering, cursor, display, 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, transform, vector-effect, visibility ARIA Attributes aria-activedescendant, aria-atomic, aria-autocomplete, aria-busy, aria-checked, aria-colcount, aria-colindex, aria-colspan, aria-controls, aria-current, aria-describedby, aria-details, aria-disabled, aria-dropeffect, aria-errormessage, aria-expanded, aria-flowto, aria-grabb...
...scendant, aria-atomic, aria-autocomplete, aria-busy, aria-checked, aria-colcount, aria-colindex, aria-colspan, aria-controls, aria-current, aria-describedby, aria-details, aria-disabled, aria-dropeffect, aria-errormessage, aria-expanded, aria-flowto, aria-grabbed, aria-haspopup, aria-hidden, aria-invalid, aria-keyshortcuts, aria-label, aria-labelledby, aria-level, aria-live, aria-modal, aria-multiline, aria-multiselectable, aria-orientation, aria-owns, aria-placeholder, aria-posinset, aria-pressed, aria-readonly, aria-relevant, aria-required, aria-roledescription, aria-rowcount, aria-rowindex, aria-rowspan, aria-selected, aria-setsize, aria-sort, aria-valuemax, aria-valuemin, aria-valuenow, aria-valuetext, role Usage notes CategoriesBasic shape element, Graphics element, Shape elementPermit...
<ellipse> - SVG: Scalable Vector Graphics
Web › SVG › Element › ellipse
sing Attributes Most notably: requiredExtensions, systemLanguage Event Attributes Global event attributes, Graphical event attributes Presentation Attributes Most notably: clip-path, clip-rule, color, color-interpolation, color-rendering, cursor, display, 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, transform, vector-effect, visibility ARIA Attributes aria-activedescendant, aria-atomic, aria-autocomplete, aria-busy, aria-checked, aria-colcount, aria-colindex, aria-colspan, aria-controls, aria-current, aria-describedby, aria-details, aria-disabled, aria-dropeffect, aria-errormessage, aria-expanded, aria-flowto, aria-grabb...
...scendant, aria-atomic, aria-autocomplete, aria-busy, aria-checked, aria-colcount, aria-colindex, aria-colspan, aria-controls, aria-current, aria-describedby, aria-details, aria-disabled, aria-dropeffect, aria-errormessage, aria-expanded, aria-flowto, aria-grabbed, aria-haspopup, aria-hidden, aria-invalid, aria-keyshortcuts, aria-label, aria-labelledby, aria-level, aria-live, aria-modal, aria-multiline, aria-multiselectable, aria-orientation, aria-owns, aria-placeholder, aria-posinset, aria-pressed, aria-readonly, aria-relevant, aria-required, aria-roledescription, aria-rowcount, aria-rowindex, aria-rowspan, aria-selected, aria-setsize, aria-sort, aria-valuemax, aria-valuemin, aria-valuenow, aria-valuetext, role Usage notes CategoriesBasic shape element, Graphics element, Shape elementPermit...
<foreignObject> - SVG: Scalable Vector Graphics
age Event Attributes Global event attributes, Graphical event attributes, Document event attributes, Document element event attributes Presentation Attributes Most notably: clip-path, clip-rule, color, color-interpolation, color-rendering, cursor, display, 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, transform, vector-effect, visibility Aria Attributes aria-activedescendant, aria-atomic, aria-autocomplete, aria-busy, aria-checked, aria-colcount, aria-colindex, aria-colspan, aria-controls, aria-current, aria-describedby, aria-details, aria-disabled, aria-dropeffect, aria-errormessage, aria-expanded, aria-flowto, aria-grabb...
...scendant, aria-atomic, aria-autocomplete, aria-busy, aria-checked, aria-colcount, aria-colindex, aria-colspan, aria-controls, aria-current, aria-describedby, aria-details, aria-disabled, aria-dropeffect, aria-errormessage, aria-expanded, aria-flowto, aria-grabbed, aria-haspopup, aria-hidden, aria-invalid, aria-keyshortcuts, aria-label, aria-labelledby, aria-level, aria-live, aria-modal, aria-multiline, aria-multiselectable, aria-orientation, aria-owns, aria-placeholder, aria-posinset, aria-pressed, aria-readonly, aria-relevant, aria-required, aria-roledescription, aria-rowcount, aria-rowindex, aria-rowspan, aria-selected, aria-setsize, aria-sort, aria-valuemax, aria-valuemin, aria-valuenow, aria-valuetext, role Usage notes CategoriesNonePermitted contentAny elements or character data Speci...
<g> - SVG: Scalable Vector Graphics
Web › SVG › Element › g
sing Attributes Most notably: requiredExtensions, systemLanguage Event Attributes Global event attributes, Graphical event attributes Presentation Attributes Most notably: clip-path, clip-rule, color, color-interpolation, color-rendering, cursor, display, 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, transform, vector-effect, visibility Aria Attributes aria-activedescendant, aria-atomic, aria-autocomplete, aria-busy, aria-checked, aria-colcount, aria-colindex, aria-colspan, aria-controls, aria-current, aria-describedby, aria-details, aria-disabled, aria-dropeffect, aria-errormessage, aria-expanded, aria-flowto, aria-grabb...
...scendant, aria-atomic, aria-autocomplete, aria-busy, aria-checked, aria-colcount, aria-colindex, aria-colspan, aria-controls, aria-current, aria-describedby, aria-details, aria-disabled, aria-dropeffect, aria-errormessage, aria-expanded, aria-flowto, aria-grabbed, aria-haspopup, aria-hidden, aria-invalid, aria-keyshortcuts, aria-label, aria-labelledby, aria-level, aria-live, aria-modal, aria-multiline, aria-multiselectable, aria-orientation, aria-owns, aria-placeholder, aria-posinset, aria-pressed, aria-readonly, aria-relevant, aria-required, aria-roledescription, aria-rowcount, aria-rowindex, aria-rowspan, aria-selected, aria-setsize, aria-sort, aria-valuemax, aria-valuemin, aria-valuenow, aria-valuetext, role Usage notes CategoriesContainer element, Structural elementPermitted contentAny ...
<path> - SVG: Scalable Vector Graphics
Web › SVG › Element › path
sing Attributes Most notably: requiredExtensions, systemLanguage Event Attributes Global event attributes, Graphical event attributes Presentation Attributes Most notably: clip-path, clip-rule, color, color-interpolation, color-rendering, cursor, display, 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, transform, vector-effect, visibility ARIA Attributes aria-activedescendant, aria-atomic, aria-autocomplete, aria-busy, aria-checked, aria-colcount, aria-colindex, aria-colspan, aria-controls, aria-current, aria-describedby, aria-details, aria-disabled, aria-dropeffect, aria-errormessage, aria-expanded, aria-flowto, aria-grabb...
...scendant, aria-atomic, aria-autocomplete, aria-busy, aria-checked, aria-colcount, aria-colindex, aria-colspan, aria-controls, aria-current, aria-describedby, aria-details, aria-disabled, aria-dropeffect, aria-errormessage, aria-expanded, aria-flowto, aria-grabbed, aria-haspopup, aria-hidden, aria-invalid, aria-keyshortcuts, aria-label, aria-labelledby, aria-level, aria-live, aria-modal, aria-multiline, aria-multiselectable, aria-orientation, aria-owns, aria-placeholder, aria-posinset, aria-pressed, aria-readonly, aria-relevant, aria-required, aria-roledescription, aria-rowcount, aria-rowindex, aria-rowspan, aria-selected, aria-setsize, aria-sort, aria-valuemax, aria-valuemin, aria-valuenow, aria-valuetext, role Usage notes CategoriesGraphics element, Shape elementPermitted contentAny number...
<rect> - SVG: Scalable Vector Graphics
Web › SVG › Element › rect
sing Attributes Most notably: requiredExtensions, systemLanguage Event Attributes Global event attributes, Graphical event attributes Presentation Attributes Most notably: clip-path, clip-rule, color, color-interpolation, color-rendering, cursor, display, 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, transform, vector-effect, visibility Aria Attributes aria-activedescendant, aria-atomic, aria-autocomplete, aria-busy, aria-checked, aria-colcount, aria-colindex, aria-colspan, aria-controls, aria-current, aria-describedby, aria-details, aria-disabled, aria-dropeffect, aria-errormessage, aria-expanded, aria-flowto, aria-grabb...
...scendant, aria-atomic, aria-autocomplete, aria-busy, aria-checked, aria-colcount, aria-colindex, aria-colspan, aria-controls, aria-current, aria-describedby, aria-details, aria-disabled, aria-dropeffect, aria-errormessage, aria-expanded, aria-flowto, aria-grabbed, aria-haspopup, aria-hidden, aria-invalid, aria-keyshortcuts, aria-label, aria-labelledby, aria-level, aria-live, aria-modal, aria-multiline, aria-multiselectable, aria-orientation, aria-owns, aria-placeholder, aria-posinset, aria-pressed, aria-readonly, aria-relevant, aria-required, aria-roledescription, aria-rowcount, aria-rowindex, aria-rowspan, aria-selected, aria-setsize, aria-sort, aria-valuemax, aria-valuemin, aria-valuenow, aria-valuetext, role Usage notes CategoriesBasic shape element, Graphics element, Shape elementPermit...
<svg> - SVG: Scalable Vector Graphics
Web › SVG › Element › svg
age Event Attributes Global event attributes, Graphical event attributes, Document event attributes, Document element event attributes Presentation Attributes Most notably: clip-path, clip-rule, color, color-interpolation, color-rendering, cursor, display, 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, transform, vector-effect, visibility Aria Attributes aria-activedescendant, aria-atomic, aria-autocomplete, aria-busy, aria-checked, aria-colcount, aria-colindex, aria-colspan, aria-controls, aria-current, aria-describedby, aria-details, aria-disabled, aria-dropeffect, aria-errormessage, aria-expanded, aria-flowto, aria-grabb...
...scendant, aria-atomic, aria-autocomplete, aria-busy, aria-checked, aria-colcount, aria-colindex, aria-colspan, aria-controls, aria-current, aria-describedby, aria-details, aria-disabled, aria-dropeffect, aria-errormessage, aria-expanded, aria-flowto, aria-grabbed, aria-haspopup, aria-hidden, aria-invalid, aria-keyshortcuts, aria-label, aria-labelledby, aria-level, aria-live, aria-modal, aria-multiline, aria-multiselectable, aria-orientation, aria-owns, aria-placeholder, aria-posinset, aria-pressed, aria-readonly, aria-relevant, aria-required, aria-roledescription, aria-rowcount, aria-rowindex, aria-rowspan, aria-selected, aria-setsize, aria-sort, aria-valuemax, aria-valuemin, aria-valuenow, aria-valuetext, role Usage notes CategoriesContainer element, Structural elementPermitted contentAny ...
<symbol> - SVG: Scalable Vector Graphics
Web › SVG › Element › symbol
yling Attributes class, style Event Attributes Global event attributes, Document element event attributes, Graphical event attributes Presentation Attributes Most notably: clip-path, clip-rule, color, color-interpolation, color-rendering, cursor, display, 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, transform, vector-effect, visibility Aria Attributes aria-activedescendant, aria-atomic, aria-autocomplete, aria-busy, aria-checked, aria-colcount, aria-colindex, aria-colspan, aria-controls, aria-current, aria-describedby, aria-details, aria-disabled, aria-dropeffect, aria-errormessage, aria-expanded, aria-flowto, aria-grabb...
...scendant, aria-atomic, aria-autocomplete, aria-busy, aria-checked, aria-colcount, aria-colindex, aria-colspan, aria-controls, aria-current, aria-describedby, aria-details, aria-disabled, aria-dropeffect, aria-errormessage, aria-expanded, aria-flowto, aria-grabbed, aria-haspopup, aria-hidden, aria-invalid, aria-keyshortcuts, aria-label, aria-labelledby, aria-level, aria-live, aria-modal, aria-multiline, aria-multiselectable, aria-orientation, aria-owns, aria-placeholder, aria-posinset, aria-pressed, aria-readonly, aria-relevant, aria-required, aria-roledescription, aria-rowcount, aria-rowindex, aria-rowspan, aria-selected, aria-setsize, aria-sort, aria-valuemax, aria-valuemin, aria-valuenow, aria-valuetext, role Usage notes CategoriesContainer element, Structural elementPermitted contentAny ...
<textPath> - SVG: Scalable Vector Graphics
Web › SVG › Element › textPath
sing Attributes Most notably: requiredExtensions, systemLanguage Event Attributes Global event attributes, Graphical event attributes Presentation Attributes Most notably: clip-path, clip-rule, color, color-interpolation, color-rendering, cursor, display, 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, transform, vector-effect, visibility ARIA Attributes aria-activedescendant, aria-atomic, aria-autocomplete, aria-busy, aria-checked, aria-colcount, aria-colindex, aria-colspan, aria-controls, aria-current, aria-describedby, aria-details, aria-disabled, aria-dropeffect, aria-errormessage, aria-expanded, aria-flowto, aria-grabb...
...scendant, aria-atomic, aria-autocomplete, aria-busy, aria-checked, aria-colcount, aria-colindex, aria-colspan, aria-controls, aria-current, aria-describedby, aria-details, aria-disabled, aria-dropeffect, aria-errormessage, aria-expanded, aria-flowto, aria-grabbed, aria-haspopup, aria-hidden, aria-invalid, aria-keyshortcuts, aria-label, aria-labelledby, aria-level, aria-live, aria-modal, aria-multiline, aria-multiselectable, aria-orientation, aria-owns, aria-placeholder, aria-posinset, aria-pressed, aria-readonly, aria-relevant, aria-required, aria-roledescription, aria-rowcount, aria-rowindex, aria-rowspan, aria-selected, aria-setsize, aria-sort, aria-valuemax, aria-valuemin, aria-valuenow, aria-valuetext, role XLink Attributes xlink:title Usage notes CategoriesText content element, Text ...
<tref> - SVG: Scalable Vector Graphics
Web › SVG › Element › tref
pecific attributes xlink:href DOM Interface This element implements the SVGTRefElement interface. ...
... Recommendation Initial definition ...
<use> - SVG: Scalable Vector Graphics
Web › SVG › Element › use
sing Attributes Most notably: requiredExtensions, systemLanguage Event Attributes Global event attributes, Graphical event attributes Presentation Attributes Most notably: clip-path, clip-rule, color, color-interpolation, color-rendering, cursor, display, 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, transform, vector-effect, visibility ARIA Attributes aria-activedescendant, aria-atomic, aria-autocomplete, aria-busy, aria-checked, aria-colcount, aria-colindex, aria-colspan, aria-controls, aria-current, aria-describedby, aria-details, aria-disabled, aria-dropeffect, aria-errormessage, aria-expanded, aria-flowto, aria-grabb...
...scendant, aria-atomic, aria-autocomplete, aria-busy, aria-checked, aria-colcount, aria-colindex, aria-colspan, aria-controls, aria-current, aria-describedby, aria-details, aria-disabled, aria-dropeffect, aria-errormessage, aria-expanded, aria-flowto, aria-grabbed, aria-haspopup, aria-hidden, aria-invalid, aria-keyshortcuts, aria-label, aria-labelledby, aria-level, aria-live, aria-modal, aria-multiline, aria-multiselectable, aria-orientation, aria-owns, aria-placeholder, aria-posinset, aria-pressed, aria-readonly, aria-relevant, aria-required, aria-roledescription, aria-rowcount, aria-rowindex, aria-rowspan, aria-selected, aria-setsize, aria-sort, aria-valuemax, aria-valuemin, aria-valuenow, aria-valuetext, role XLink Attributes xlink:href, xlink:title Usage notes CategoriesGraphics eleme...
Introduction - SVG: Scalable Vector Graphics
The image and its components can also be transformed, composited together, or filtered to change their appearance completely. SVG came about in 1999 after several competing formats had been submitted to the W3C and failed to be fully ratified. ...
...nt since version 1.5, and that support level has been growing with each release since. Hopefully, along with the tutorial here, MDN can help developers keep up with the differences between Gecko and some of the other major implementations. Before starting you should have a basic understanding of XML or another markup language such as HTML. If you are not too familiar with XML, here are some guidelines to keep in mind: SVG elements and attributes should all be entered in the case shown here since XML is case-sensitive (unlike HTML). Attribute values in SVG must be placed inside quotes, even if they are numbers. SVG is a huge specification. This tutorial attempts to cover the basics. Once you are familiar you should be able to use the Element Reference and the Interface Reference to find ...
SVG fonts - SVG: Scalable Vector Graphics
This bears an id attribute, to enable it to be referenced via a URI (see below). The horiz-adv-x attribute determines how wide a character is on average compared to the path definitions of the single glyphs. The value 1000 sets a reasonable v...
...height="400" ascent="700" descent="300" alphabetic="0" mathematical="350" ideographic="400" hanging="500"> <font-face-src> <font-face-name name="Super Sans Bold"/> </font-face-src> </font-face> <missing-glyph><path d="M0,0h200v200h-200z"/></missing-glyph> <glyph unicode="!" horiz-adv-x="300"><!-- Outline of exclam. pt. glyph --></glyph> <glyph unicode="@"><!-- Outline of @ glyph --></glyph> <!-- more glyphs --> </font> We start with the <font> element. This bears an id attribute, to enable it to be referenced via a URI (see below). The horiz-adv-x attribute determines how wide a character is on average compared to the path definitions of the single glyphs. The value 1000 sets a reasonable value to work with. There are several accompanying attributes that h...
How to fix a website with blocked mixed content - Web security
at if your website works in both of these browsers, it will work equally well in Firefox with mixed content blocking. In any case, the best way to know if something is broken in Firefox is to download the latest Firefox Edition, open different pages on your website with the web console open (enable the "Security" messages) and see if anything related to mixed content is reported. Or use a free online crawler like SSL-check or Missing Padlock, a desktop crawler like HTTPSChecker, or a CLI tool like mcdetect to check your website recursively and find links to insecure content. If nothing is said about mixed content, your website is in good shape: Keep making excellent websites! How to fix your website The best strategy to avoid mixed content blocking is to serve all the content as HTTPS inste...
...ebsite The best strategy to avoid mixed content blocking is to serve all the content as HTTPS instead of HTTP. For your own domain, serve all content as HTTPS and fix your links. Often, the HTTPS version of the content already exists and this just requires adding an "s" to links - http:// to https://. However, in some cases, the path may just be incorrect to the media in question. There are online as well as offline tools (depending on your operating system) such as linkchecker to help resolve this. For other domains, use the site's HTTPS version if available. If HTTPS is not available, you can try contacting the domain and asking them if they can make the content available via HTTPS. ...
Subresource Integrity - Web security
a sha384 hash. Note: An integrity value's "hash" part is, strictly speaking, a cryptographic digest formed by applying a particular hash function to some input (for example, a script or stylesheet file). But it's common to use the shorthand "hash" to mean cryptographic digest, so that's what's used in this article. Tools for generating SRI hashes You can generate SRI hashes from the command-line with openssl using a command invocation such as this: cat FILENAME.js | openssl dgst -sha384 -binary | openssl base64 -A or with shasum using a command invocation such as this: shasum -b -a 384 FILENAME.js | awk '{ print $1 }' | xxd -r -p | base64 Notes: The pipe-through-xxd step takes the hexadecimal output from shasum and converts it to binary. The pipe-through-awk step is necessary b...
...e hexadecimal output from shasum and converts it to binary. The pipe-through-awk step is necessary because shasum will pass the hashed filename in its output to xxd. That can have disastrous consequences if the filename happens to have valid hex characters in it -- because xxd will also decode that and pass it to base64. Additionally, the SRI Hash Generator at https://www.srihash.org/ is an online tool you can use to generate SRI hashes. Cross-Origin Resource Sharing and Subresource Integrity For subresource-integrity verification of a resource served from an origin other than the document in which it's embedded, browsers additionally check the resource using Cross-Origin Resource Sharing (CORS), to ensure the origin serving the resource allows it to be shared with the requesting origin.
WebAssembly Concepts - WebAssembly
are reflected 1:1 in the WebAssembly JavaScript API. Module: Represents a WebAssembly binary that has been compiled by the browser into executable machine code. A Module is stateless and thus, like a Blob, can be explicitly shared between windows and workers (via postMessage()). A Module declares imports and exports just like an ES2015module. Memory: A resizable ArrayBuffer that contains the linear array of bytes read and written by WebAssembly's low-level memory access instructions. Table: A resizable typed array of references (e.g. to functions) that could not otherwise be stored as raw bytes in Memory (for safety and portability reasons). Instance: A Module paired with all the state it uses at runtime including a Memory, Table, and set of imported values. An Instance is like an ES201...
...ntry points: Porting a C/C++ application with Emscripten. Writing or generating WebAssembly directly at the assembly level. Writing a Rust application and targeting WebAssembly as its output. Using AssemblyScript which looks similar to TypeScript and compiles to WebAssembly binary. Let's talk about these options: Porting from C/C++ Two of the many options for creating WASM code are an online wasm assembler or Emscripten. There are a number of online WASM assembler choices, such as: WasmFiddle WasmFiddle++ WasmExplorer These are great resources for people who are trying to figure out where to start, but they lack some of the tooling and optimizations of Emscripten. The Emscripten tool is able to take just about any C/C++ source code and compile it into a .wasm module, plus the...
Compiling from Rust to WebAssembly - WebAssembly
instead: use wasm_bindgen::prelude::*; #[wasm_bindgen] extern { pub fn alert(s: &str); } #[wasm_bindgen] pub fn greet(name: &str) { alert(&format!("Hello, {}!", name)); } This is the contents of our Rust project. It has three main parts; let's talk about them in turn. We give a high-level explanation here, and gloss over some details; to learn more about Rust, please check the free online book The Rust Programming Language. Using wasm-bindgen to communicate between Rust and JavaScript The first part looks like this: use wasm_bindgen::prelude::*; Libraries are called "crates" in Rust. Get it? Cargo ships crates. The third line contains a use command, which imports code from a library into your code. In this case, we're importing everything in the wasm_bindgen::prelude module.
... JavaScript from Rust The next part looks like this: #[wasm_bindgen] extern { pub fn alert(s: &str); } The bit inside the #[ ] is called an "attribute", and it modifies the next statement somehow. In this case, that statement is an extern, which tells Rust that we want to call some externally defined functions. The attribute says "wasm-bindgen knows how to find these functions". The third line is a function signature, written in Rust. It says "the alert function takes one argument, a string named s." As you might suspect, this is the alert function provided by JavaScript. We call this function in the next section. Whenever you want to call JavaScript functions, you can add them to this file, and wasm-bindgen takes care of setting everything up for you. Not everything is supported yet...
Builder - Archive of obsolete content
The Add-on Builder tool was retired on April 1, 2014. The Add-on Builder was a web-based development environment that allowed developers to create add-ons using the SDK APIs, but without needing to use the jpm command line tool. It was retired on April 1, 2014, and the "builder.addons.mozilla.org" domain now redirects to this page. ...
Cross-domain Content Scripts - Archive of obsolete content
...
port - Archive of obsolete content
removeListener("get-first-para", getFirstParagraph); } self.port.on("get-first-para", getFirstParagraph); The result is that the paragraph is only logged the first time the button is clicked. Due to bug 816272 the page-mod's removeListener() function does not prevent the listener from receiving messages that are already queued. This means that if "main.js" sends the message twice in successive lines, and the listener stops listening as soon as it receives the first message, then the listener will still receive the second message. JSON-serializable values The payload for a message can be any JSON-serializable value. When messages are sent their payloads are automatically serialized, and when messages are received their payloads are automatically deserialized, so you don't need to worry abo...
Communicating using "port" - Archive of obsolete content
emoveListener("get-first-para", getFirstParagraph); } self.port.on("get-first-para", getFirstParagraph); The result is that the paragraph is only logged the first time the button is clicked. Due to bug 816272 the page-mod's removeListener() function does not prevent the listener from receiving messages that are already queued. This means that if "main.js" sends the message twice in successive lines, and the listener stops listening as soon as it receives the first message, then the listener will still receive the second message. port.once() Often you'll want to receive a message just once, then stop listening. The port object offers a shortcut to do this: the once() method. This example rewrites the "listener.js" content script in the port.removeListener() example so that it uses once()...
Content Scripts - Archive of obsolete content
.js")] }); If you do this, the scripts can interact directly with each other, just like scripts loaded by the same web page. You can also use contentScript and contentScriptFile together. If you do this, scripts specified using contentScriptFile are loaded before those specified using contentScript. ...
Classes and Inheritance - Archive of obsolete content
Now when JavaScript looks for the method draw on an instance of Circle, it first looks for it on the object itself. When it cannot find the property there, it looks for it on the prototype of Circle. When it cannot find the property there either, it looks for it on Shape, at which point the lookup succeeds. The resulting behavior is what we were aiming for. Inheritance and Instanceof The single line of code we added in the previous section solved the problem with prototypes, but introduced a new problem with the instanceof operator. Consider the following: let circle = Circle(2, 3, 5); circle instanceof Shape; // => false Since instances of Circle inherit from Shape, we definitely want the result of this expression to be true. To understand why it is not, we need to understand how instanc...
SDK and XUL Comparison - Archive of obsolete content
Add-ons built with the SDK can be installed without having to restart Firefox. Although you can write traditional add-ons that are restartless, you can't use XUL overlays in them, so most traditional add-ons would have to be substantially rewritten anyway. User Experience Best Practices The UI components available in the SDK are designed to align with the usability guidelines for Firefox, giving your users a better, more consistent experience. Mobile Support Starting in SDK 1.5, we've added experimental support for developing add-ons on the new native version of Firefox Mobile. See the tutorial on mobile development. Advantages of XUL-based Add-ons User interface flexibility XUL overlays offer a great deal o...
XUL Migration Guide - Archive of obsolete content
Next, we'll look at some of the main tasks involved in migrating: working with content scripts using the SDK's supported APIs how to go beyond the supported APIs when necessary, by: using third party modules using the SDK's low-level APIs getting direct access to XPCOM Finally, we'll walk through a simple example. Should You Migrate? See this comparison of the benefits and limitations of SDK development and XUL development. ...
notifications - Archive of obsolete content
con.png"; notifications.notify({ text: "I have an icon!", iconURL: myIconURL }); This module depends on the underlying system's notification service. If the user's system does not support desktop notifications or if its notifications service is not running: if Firefox was started normally, notifications are logged to Firefox's error console if the user launched Firefox from the command line, notifications are logged to the terminal. Globals Functions notify(options) Displays a transient notification to the user. Parameters options : object Optional options: Name Type title string A string to display as the message's title. text string A string to display as the body of the message. iconURL stri...
page-mod - Archive of obsolete content
ndow.alert("Page matches ruleset");' }); You can specify a number of wildcard forms, for example: var pageMod = require("sdk/page-mod"); pageMod.PageMod({ include: "*.mozilla.org", contentScript: 'window.alert("Matched!");' }); You can specify a set of URLs using a regular expression. The pattern must match the entire URL, not just a subset, and has global, ignoreCase, and multiline disabled. var pageMod = require("sdk/page-mod"); pageMod.PageMod({ include: /.*developer.*/, contentScript: 'window.alert("Matched!");' }); To specify multiple patterns, pass an array of match patterns: var pageMod = require("sdk/page-mod"); pageMod.PageMod({ include: ["*.foo.org", "*.bar.com"], contentScript: 'window.alert("Matched!");' }); See the match-pattern module for ...
page-worker - Archive of obsolete content
access it, there are typically three changes you have to make, if you want to use normal page scripts instead: in the content script: change occurrences of self to addon. For example, self.port.emit("my-event") becomes addon.port.emit("my-event"). in the HTML page itself: add a <script> tag to load the script. So if your content script is saved under data as "my-script.js", you need a line like <script src="my-script.js"></script> in the page header. in the "main.js" file: remove the contentScriptFile option in the Page() constructor. Globals Constructors Page(options) Creates an uninitialized page worker instance. Parameters options : object Optional options: Name Type contentURL string The URL of the content to load in the...
simple-prefs - Archive of obsolete content
type": "integer", "title": "How Many?", "hidden": true } Your add-on's code will still be able to access and modify it, just like any other preference you define. Type-Specific Attributes These are settings that are only applicable to certain preference types. They are documented along with the preference types themselves. Preference Types The setting types map to the inline settings types used by the Add-on Manager. All the inline preferences are supported. Type Description Example Specification bool Displayed as a checkbox and stores a boolean. { "description": "Does it have tentacles?", "type": "bool", "name": "hasTentacles", "value": true, "title": "Tentacles" } boolint Displayed as a ch...
/loader - Archive of obsolete content
p, 'warn: '), error: dump.bind(dump, 'error: ') } } }); evaluate() Evaluates code in the supplied sandbox. If options.source is provided then its value is evaluated, otherwise source is read from the supplied uri. Either way, any exceptions will be reported as from the uri. Optionally more options may be specified: options.encoding: source encoding, defaults to 'UTF-8'. options.line: line number to start count from in stack traces. Defaults to 1. options.version: version of JS used, defaults to '1.8'. // Load script from the given location to a given sandbox: evaluate(sandbox, 'resource://path/to/script.js') // Evaluate `code` as if it was from `foo/bar.js`: evaluate(sandbox, 'foo/bar.js', { source: code, version: '1.7' // You could also use other options described...
console/traceback - Archive of obsolete content
Experimental Functionality similar to Python's traceback module. Usage Tracebacks are stored in JSON format. The stack is represented as an array in which the most recent stack frame is the last element; each element thus represents a stack frame and has the following keys: filename The name of the file that the stack frame takes place in. lineNo The line number is being executed at the stack frame. funcName The name of the function being executed at the stack frame, or null if the function is anonymous or the stack frame is being executed in a top-level script or module. See nsIException for more information. Globals Functions fromException(exception) Attempts to extract the traceback from exception. Parameters exception : exception exc...
core/heritage - Archive of obsolete content
Helper functions for inheritance. Doing inheritance in JavaScript is both verbose and painful. Reading or writing such code requires sharp eye and lot's of discipline, mainly due to code fragmentation and lots of machinery being exposed: // Defining a simple Class function Dog(name) { // Classes are for creating instances, calling them without `new` changes // behavior, which in majority cases you need to handle, so you end up // with additional boilerplate. if (!(this instanceof Dog)) return new Dog(name); this.name = name; }; // To define methods you need to make a dance with a special 'prototype' // property of the constructor function. This is too much machinery exposed. Dog.prototype.type = 'dog'; Dog.prototype.bark = function bark() { return 'Ruff! Ruff!' }; // Subclas...
ui/button/action - Archive of obsolete content
second tab's label -> "window-specific label" console.log(button.state(tabs[1]).label); } Finally, you can pass the button itself into state(). This is an alternative way to set or get the global state. ...
ui/button/toggle - Archive of obsolete content
tab's label -> "window-specific label" console.log(button.state(tabs[1]).label); } Finally, you can pass the button itself into state(). This is an alternative way to set or get the global state. ...
util/match-pattern - Archive of obsolete content
atch-pattern"); var pattern = new MatchPattern(/.*example.*/); The regular expression is subject to restrictions based on those applied to the HTML5 pattern attribute. In particular: The pattern must match the entire value, not just any subset. For example, the pattern /moz.*/ will not match the URL http://mozilla.org. The expression is compiled with the global, ignoreCase, and multiline flags disabled. The MatchPattern constructor will throw an exception if you try to set any of these flags. Example pattern Example matching URLs Example non-matching URLs /.*moz.*/ http://foo.mozilla.org/ http://mozilla.org https://mozilla.org http://foo.com/mozilla http://hemozoon.org mozscheme://foo.org http://foo.org /https:\/\/www...
cfx - Archive of obsolete content
s the staticArgs property of the system module. The default value of --static-args is "{}" (an empty object), so you don't have to worry about checking whether staticArgs exists in system. For example, if your add-on looks like this: var system = require("sdk/system"); console.log(system.staticArgs.foo); And you run cfx like this: cfx run --static-args="{ \"foo\": \"Hello from the command line\" }" Then your console should contain this: info: my-addon: Hello from the command line The --static-args option is recognized by two of the package-specific commands: run and xpi. When used with the xpi command, the JSON is packaged with the XPI's harness options and will therefore be used whenever the program in the XPI is run. ...
cfx to jpm - Archive of obsolete content
The current tool is called jpm, and is based on Node.js. It replaces the old cfx tool. You can use jpm from Firefox 38 onwards. This article highlights the main differences between cfx and jpm. A guide to working with jpm if you're already familiar with cfx. Installation cfx is Python-based and is distributed as a zip file. jpm is Node-js-based and is distributed through npm. So for jpm you don't need Python, but you do need npm. To get new updates of cfx you download and extract a new zip file, while to get the new version of jpm, use npm update. For jpm installation instructions, see the Installation section in the jpm reference. ...
console - Archive of obsolete content
If the add-on has been installed in Firefox, then the messages appear in the Browser Console. If you're developing your add-on using the Extension Auto-installer, then the add-on is installed in Firefox, meaning that messages will appear in the Browser Console. But see the discussion of logging levels: by default, messages logged using log(), info(), trace(), or warn() won't be logged in these situations. ...
package.json - Archive of obsolete content
Reorder package.json The package.json file is simple format. You can describe Keys in any order. But sometimes it should be better reorder it for improve readability. ...
Tools - Archive of obsolete content
de a reference for the SDK's tools: cfx Enables you to test, run, and package add-ons. cfx is is no longer supported as of Firefox 44 and no longer accepted for add-on submission, jpm should now be used instead. cfx to jpm A guide to working with jpm if you're already familiar with cfx. console Enables your add-on to log error, warning or informational messages. jpm jpm is a command-line tool that enables you to test, run, and package add-ons. jpm-mobile The Node-based replacement for cfx --force-mobile. Enables you to run and test add-ons for Firefox Mobile (aka Fennec). jpmignore Use .jpmignore to ignore files from your XPI builds created via jpm. package.json The package.json file contains manifest data for your add-on, providing not only descriptive information ...
Add a Context Menu Item - Archive of obsolete content
g();' + ' self.postMessage(text);' + '});', onMessage: function (selectionText) { console.log(selectionText); } }); Try it: run the add-on, load a web page, select some text and right-click. You should see the new item appear: Click it, and the selection is logged to the console (or the shell, if you're running an instance of Firefox from the command line): info: elephantine lizard Details All this add-on does is to construct a context menu item. You don't need to add it: once you have constructed the item, it is automatically added in the correct context. The constructor in this case takes four options: label, context, contentScript, and onMessage. label The label is just the string that's displayed. context The context describes the circ...
Chrome Authority - Archive of obsolete content
authority restrictions that are enforced upon the running code, increasing the effectiveness of the time spent reviewing the add-on. (until this work is complete, modules may be able to sneak around these restrictions). The manifest is built with a simple regexp-based scanner, not a full Javascript parser. Developers should stick to simple require statements, with a single static string, one per line of code. If the scanner fails to see a require entry, the manifest will not include that entry, and (once the implementation is complete) the runtime code will get an exception. For example, none of the following code will be matched by the manifest scanner, leading to exceptions at runtime, when the require() call is prohibited from importing the named modules: // all of these will fail! var x...
Display a Popup - Archive of obsolete content
t) { console.log(text); text_entry.hide(); }); The content script "get-text.js" looks like this: // When the user hits return, send the "text-entered" // message to main.js. // The message payload is the contents of the edit box. var textArea = document.getElementById("edit-box"); textArea.addEventListener('keyup', function onkeyup(event) { if (event.keyCode == 13) { // Remove the newline. text = textArea.value.replace(/(\r\n|\n|\r)/gm,""); self.port.emit("text-entered", text); textArea.value = ''; } }, false); // Listen for the "show" event being sent from the // main add-on code. It means that the panel's about // to be shown. // // Set the focus to the text area so the user can // just start typing. self.port.on("show", function onShow() { textArea.focus(); }); ...
Getting started (cfx) - Archive of obsolete content
cfx has been deprecated and you should use jpm instead. Use cfx only if you need to work with Firefox 38 or earlier. See: Getting started with jpm cfx to jpm Prerequisites To create add-ons for Firefox using the SDK, you'll first need to follow the instructions to install and activate the SDK. Once you've done that, you'll be looking at a command prompt. Initializing an empty add-on In the command prompt, create a new directory. The directory doesn't have to be under the SDK root: you can create it anywhere you like. ...
List Open Tabs - Archive of obsolete content
n-16.png", onClick: listTabs }); function listTabs() { var tabs = require("sdk/tabs"); for (let tab of tabs) console.log(tab.url); } Note: to get this working, you will need to save an icon for the button to your add-on's "data" directory as "icon-16.png". You can download the icon here: . Run the add-on, load a couple of tabs and click the button. You'll see output in the command line console that looks something like this: info: http://www.mozilla.org/about/ info: http://www.bbc.co.uk/ You don't get direct access to any content hosted in the tab. To access tab content, you need to attach a script to the tab using tab.attach(). This add-on attaches a script to all open tabs. The script adds a red border to the tab's document: require("sdk/ui/button/action").ActionButton({ ...
Developing for Firefox Mobile - Archive of obsolete content
. console.log() output from your add-on is written to the command shell, just as it is in desktop development. However, because there's a lot of other debug output in the shell, it's not easy to follow. The command adb logcat prints adb's log, so you can filter the debug output after running the add-on. For example, on Mac OS X or Linux you can use a command like the one below to filter only the lines of console output: adb logcat | grep console You can experiment with different filter strings on adb logcat to focus in on the lines relevant to you. Running jpm-mobile test is identical: jpm-mobile test --adb /path/to/adb Packaging Mobile Add-ons To package a mobile add-on as an XPI, use the command: jpm xpi Actually installing the XPI on the device is a little tricky. The easiest wa...
Using third-party modules (jpm) - Archive of obsolete content
The current tool is called jpm, and is based on Node.js. It replaces the old cfx tool. You can use jpm from Firefox 38 onwards. This article describes how you can use third-party modules with jpm. To follow this tutorial you'll need to have installed jpm and learned the basic jpm commands. To install menuitem you'll need to have git command. If you have error related to git, check you have latest git command installed. The Add-on SDK is extensible by design: you can use the modules that ship inside Firefox, but you can also create your own modules and make them available for anyone else to use. ...
Localization - Archive of obsolete content
" under your main add-on directory, one file for each locale. The files: use the .properties format are named "xx-YY.properties", where "xx-YY" is the name of the locale in question contain one entry for each string you want to localize, consisting of an identifier for the string and its translation in that locale, in the format identifier=translation need to use UTF-8 without BOM encoding Lines starting with "#" (after optional whitespace) are comments Suppose your add-on contains a single localizable string, represented in English as "Hello!", and you want to supply US English and French French localizations. You'd add two files to the "locale" directory: my-addon/ data lib locale/ en-US.properties fr.properties "en-US.properties" contains this: hell...
Tutorials - Archive of obsolete content
nning unit tests using the SDK's test framework. Chrome authority Get access to the Components object, enabling your add-on to load and use any XPCOM object. Creating event targets Enable the objects you define to emit their own events. Listen for load and unload Get notifications when your add-on is loaded or unloaded by Firefox, and pass arguments into your add-on from the command line. Using third-party modules (jpm) Install and use additional modules which don't ship with the SDK itself. Localization Writing localizable code. Mobile development Develop add-ons for Firefox Mobile on Android. Add-on Debugger Debug your add-on's JavaScript. Putting it together Annotator add-on A walkthrough of a relatively complex add-on. ...
Forms related code snippets - Archive of obsolete content
lapse; background-color: #cccccc; cursor: default; font-family: verdana; font-size: 12px; } table.zdp-calendar th { border: 1px solid #666666; font-weight: bold; background-color: #ff6666; } table.zdp-calendar td { border: 1px solid #666666; text-align: center; } table.zdp-calendar caption { background-color: #333333; padding: 2px; } span.zdp-current-month { display: inline-block; width: auto; height: 16px; padding: 0 2px; line-height: 16px; margin: 0 auto; background-color: #999999; border-radius: 5px; } span.zdp-increase-month, span.zdp-increase-year, span.zdp-decrease-month, span.zdp-decrease-year { display: block; padding: 0 2px; height: 16px; font-weight: bold; background-color: #999999; border-radius: 5px; cursor: pointer; } span.
QuerySelector - Archive of obsolete content
Along the lines of other frameworks such as jQuery or Prototype, shortening the "querySelector" name can be convenient: function $ (selector, el) { if (!el) {el = document;} return el.querySelector(selector); } function $$ (selector, el) { if (!el) {el = document;} return el.querySelectorAll(selector); // Note: the returned object is a NodeList. // If you'd like to convert it to a Array for convenience, use this instead: // return Array.prototype.slice.call(el.querySelectorAll(selector)); } alert($('#myID').id); (Note that while using the Firefox Web Console, the above functions are available automatically.) Both XUL and even XML can be easily made supportable (an alternative approach to the following would be to add ChromeWindow.prototype or Window.prototy...
SVG General - Archive of obsolete content
ing some SVG images. You will also find some general purpose scripting helpers, that should make scripting SVG a little easier. SVG Template Here is a basic markup template to start building an SVG document: <svg xmlns="http://www.w3.org/2000/svg"> <!-- SVG elements go here --> </svg> Note: It is recommended that you do not use DTD's with SVG documents. The tutorial and authoring guidelines have more information. Dynamic scripting helper This little helper script can be used to simplify creation of SVG elements in script. SVG requires you to use setAttributeNS to add attributes to a newly created SVG DOM element. No properties like HTML. SVG IMAGE also requires the use of XLINK for the href attribute, which can be tricky to remember, especially when you're mixing SVG with HTML ...
Code snippets - Archive of obsolete content
Applies to scrollbars in browser and iframe as well. Autocomplete Code used to enable form autocomplete in a browser Boxes Tips and tricks when using boxes as containers Tabbox Removing and manipulating tabs in a tabbox Windows-specific Finding Window Handles (HWND) (Fire...
Extension Versioning, Update and Compatibility - Archive of obsolete content
: b or strong for bolder text i or em for italicized text Formatting in Firefox 4 and later From Firefox 4 the restrictions are relaxed somewhat. The following tags are interpreted normally: h1, h2 and h3 for general headings p, div, pre and blockquote for block formatting ul, ol, li, dl, dt and dd for lists b, i, em, strong, u, q, sub, sup and code for text formatting br and hr for line breaking The head, style and script tags and any of their contents are completely stripped. Other tags aren't included in the result but do have their contents displayed, so the following snippet: <span><q>Text</q></span> Would be rendered exactly the same as: <q>Text</q> Sample File <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.
Chapter 1: Introduction to Extensions - Archive of obsolete content
This document was authored by Hideyuki Emura and was originally published in Japanese for the Firefox Developers Conference Summer 2007. Emura-san is a co-author of Firefox 3 Hacks (O'Reilly Japan, 2008.) Introduction If you're reading this guide, you've probably used Firefox before. Perhaps the first time you looked at Firefox, you may have been surprised to see that it has a much simpler structure than other full-featured browsers, such as Opera or Safari. ...
Adding menus and submenus - Archive of obsolete content
/> <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. The separator is usually displayed as a horizontal line that creates a logical division between different types of menuitem elements, keeping everything more organized. A menubar can hold one or more menu elements. Menus require a menupopup element as a container for its children, which are usually menuitem elements, but can also be menuseparator, or menu in order to have multiple nesting levels: <toolbox> <menubar id="xulschoolhello-menubar"> ...
Adding windows and dialogs - Archive of obsolete content
ert The alert is the simplest form of dialog. All it does is display a text message that the user can read and then click the OK button to dismiss it. We have been using the window.alert function to open alert messages in our examples so far, but that's not the right way to do it. It's OK to use this function if you're just debugging some problem and want to see if the program reaches a specific line of code, or to inspect the value of a variable, but your final extension should not have alert calls anywhere. If you use window.alert, the alert window will have the title [JavaScript Application], indicating that the source of the message is not well defined. The Prompt Service allows better alerts to be displayed. Here's an example of displaying an alert using the Prompt Service: let promp...
Appendix E: DOM Building and Insertion (HTML & XUL) - Archive of obsolete content
ring.quote(href), uneval(otherStuff)] + ")"; } Safely Using Remote HTML In the above cases, we're working with text content that needs to appear in generated DOM. There are cases, however, where we need to safely display formatted HTML sent by a remote server. Fortunately, there is a safe and simple way to do this. For WebExtensions the most simple way is sanitize the output about javaScript inline declaration and other wrong content. For XUL addon based the nsIParserUtils.parseFragment() method will convert a string to a document fragment while removing any scripts or other unsafe content in the process. let { Cc, Ci } = require("chrome"); /** * Safely parse an HTML fragment, removing any executable * JavaScript, and return a document fragment. * * @param {Document} doc The document ...
XPCOM Objects - Archive of obsolete content
this._prefService.QueryInterface(Ci.nsIPrefBranch2); this._prefService.addObserver("somePreferenceName", this, false); this._prefService.QueryInterface(Ci.nsIPrefBranch); This is a common piece of code you'll see when initializing components or JSM that rely on preferences. We use the Preferences Service to get and set preference values, such as the preference value we're getting on the fourth line of code. These methods are in the nsIPrefBranch interface. The getService and createInstance methods allow you to get the component already set to an interface. In many cases you only need to use one interface, and you won't have to worry about QueryInterface. But in this case we need to change the interface to nsIPrefBranch2, which is the one that includes the method that adds a preference obser...
Security best practices in extensions - Archive of obsolete content
Other items are recommendations. The difference will be clearly flagged. This is written from the perspective of a Firefox extension, but most items apply to extensions for other Mozilla-based applications such as Thunderbird or SeaMonkey. ...
Firefox addons developer guide - Archive of obsolete content
ms in the content that need dealing with, but those are already known. These should use the Previous, Next, and PrevNext templates to add quick routes to get from chapter to chapter. See the XUL Reference, for example. Each chapter should be tagged appropriately, based on content, and every chapter should include the tag "Firefox addons developer guide". Instead of using footnotes, we should inline these notes into the body of the article. Apostrophes are being done using curly apostrophes instead of straight ones as is done everywhere else in MDC. The stuff about installing the DOM inspector (https://developer.mozilla.org/En/Firefox_addons_developer_guide/Let%27s_build_a_Firefox_extension#Install_the_DOM_Inspector) is not accurate for Firefox 3 or later, since it's no longer included in ...
Search Extension Tutorial (Draft) - Archive of obsolete content
Changing Default Search Setting from Extensions Many add-ons, for monetization or other reasons, change several search-related settings at install time. While this is generally considered acceptable behavior, considerable care must be taken to avoid violating the Mozilla add-on guidelines or creating an adverse user experience. Due to the large volume of user complaints regarding hidden settings being changed against their will, and not being restored after the add-ons responsible are disabled, Mozilla will take any steps necessary to mitigate the impact of offending add-ons. In particular, changing the location bar search keyword URL in a way which is not automatically reset when the add-on is removed will result in a reset prompt for users. Other settings violations designed to restr...
An Interview With Douglas Bowman of Wired News - Archive of obsolete content
age weight dropped by almost half; Page layout accomplished with simple CSS positioning; Vastly increased accessibility without special coding or user agent detection. Why did you pursue a standards-based redesign of Wired News? As Network Design Manager at Lycos for the last two years, I've been creating and documenting design standards for our network of sites. This includes rules and guidelines applying to everything from headers, footers, page hierarchy, titles, typography, iconography, navigation, and others. So I'm very familiar with standards and the benefits of using them. With the Wired News design process, the scenario was reversed. As I was designing the product, I began discovering a broader set of Web standards, and was quickly swayed by the advantages I could see if we were ...
XML data - Archive of obsolete content
XML document uses <INFO> tags. You want the document's INFO elements to be displayed like HTML paragraphs. In the document's stylesheet, you specify how INFO elements are to be displayed: INFO { display: block; margin: 1em 0; } The most common values for the display property are: block Displayed like HTML's DIV (for headings, paragraphs) inline Displayed like HTML's SPAN (for emphasis within text) Add your own style rules that specify the font, spacing and other details in the same way as for HTML. More details Other values of display display the element like a list item, or like a component of a table. For the full list of display types, see The display property in the CSS Specification. Using CSS alone, t...
Creating a dynamic status bar extension - Archive of obsolete content
ld not have access to the same variable scope. In fact, even the this value would not match, so we couldn't get at the same variables and functions that way. ...
cached - Archive of obsolete content
Read Only. type string The type of event. Read only. canBubble boolean Does the event normally bubble? Read only. ...
checking - Archive of obsolete content
Read Only. type string The type of event. Read only. canBubble boolean Does the event normally bubble? Read only. ...
downloading - Archive of obsolete content
Read Only. ...
error - Archive of obsolete content
Read Only. type string The type of event. Read only. canBubble boolean Does the event normally bubble? Read only. ...
noupdate - Archive of obsolete content
Read Only. type string The type of event. Read only. canBubble boolean Does the event normally bubble? Read only. ...
obsolete - Archive of obsolete content
Read Only. type string The type of event. Read only. canBubble boolean Does the event normally bubble? Read only. ...
progress - Archive of obsolete content
Read Only. type string The type of event. Read only. canBubble boolean Does the event normally bubble? Read only. cancelable boolean Is it possible to cancel the event? Read only. ...
updateready - Archive of obsolete content
Read Only. type string The type of event. Read only. ...
JXON - Archive of obsolete content
"encoding": "ASCII" } Numbers are recognized (integers and decimals): <root><age>12</age><height>1.73</height></root> becomes { "age": 12, "height": 1.73 } Booleans are recognized case insensitive: <root><checked>True</checked><answer>FALSE</answer></root> becomes { "checked": true, "answer": false } Strings are escaped: <root>Quote: &quot; New-line: </root> becomes "Quote: \" New-line:\n" Empty elements will become null: <root><nil/><empty></empty></root> becomes { "nil": null, "empty": null } If all sibling elements have the same name, they become an array <root><item>1</item><item>2</item><item>three</item></root> becomes [1, 2, "three"] Mixed mode text-nodes, comments and attributes get a...
cert_override.txt - Archive of obsolete content
40.1.101.3.4.2.1 00:11:22:33:44:55:66:77:88:99:AA:BB:CC:DD:EE:FF:FF:EE:DD:CC:BB:AA:99:88:77:66:55:44:33:22:11:00 U AAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAA== Fields Fields are separated by a tab character. Each line is terminated by a line feed character (UNIX format). domainname:port : port 443 for HTTPS (SSL) hash algorithm OID SHA1-256: OID.2.16.840.1.101.3.4.2.1 (most used) SHA-384: OID.2.16.840.1.101.3.4.2.2 SHA-512: OID.2.16.840.1.101.3.4.2.3 Certificate fingerprint using previous hash algorithm One or more characters for override type: M : allow mismatches in the hostname U : allow untrusted cert...
Environment variables affecting crash reporting - Archive of obsolete content
pplication to close as well. MOZ_CRASHREPORTER The opposite of MOZ_CRASHREPORTER_DISABLE, force crash reporting on even if disabled in application.ini. You must use this to enable crash reporting on Linux debug builds. Additionally, on Mac OS X, you can set an application default setting to allow Apple's Crash Reporter tool to run alongside the Breakpad crash reporter. Run this on the command line: defaults write org.mozilla.firefox OSCrashReporter 1 Note that you will get two crash dialogs with this setting, one from the OS and one from Mozilla. ...
No Proxy For configuration - Archive of obsolete content
scenarios. In almost all cases, PAC gives better control and flexibility. User interface "No proxy for" is an optional field, part of "Manual proxy configuration". The field is relatively short, but can hold reasonably long (2K+ characters) entries. New profiles contain the values "localhost, 127.0.0.1", by default. Entry points: Preferences | Advanced | Proxies control-click menu for off line-online icon (network plug) Configuration The no proxy list is composed of either domain elements or IPv4 address elements. The elements are separated by either a space (" ") or a comma (","). Note for former-IE users: "*" is supported only at the beginning of domain filters (*.mozilla.org). To block ... put this into "No Proxy for" ...for example use... Limitations ...
ActiveX Control for Hosting Netscape Plug-ins in IE - Archive of obsolete content
is from a command prompt: C:\> set CVSROOT=:pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot C:\> set HOME=\TEMP C:\> cvs login (Logging in to anonymous@cvs-mirror.mozilla.org) CVS password: anonymous C:\> cvs -z3 co mozilla/embedding/browser/activex/src/pluginhostctrl This fetches the source for the control into mozilla\embedding\browser\activex\src\pluginhostctrl. You can also see the code online. Build it It is quite simple to build the control Locate the pluginhostctrl directory: Open pluginhostctrl.dsp Build "Win32 Debug" or another target Open some of the test files under pluginhostctrl\tests in Internet Explorer to verify the control has built and registered correctly. The control currently reads plug-ins from your most current Netscape 4.x and IE installations. There is no su...
Automated testing tips and tricks - Archive of obsolete content
browser on all platforms window.close() of the last open window does not quit the application on Mac http://people.mozilla.com/~davel/scripts/ - look at quit.js and quit.xul install manifest file in appdir/chrome to map chrome://tests/content to directory containing quit.js and quit.xul example: content tests file:///Users/davel/Work/tests/ start app with command line flag -chrome chrome://tests/content/quit.xul How to create a new profile from the command line First, use the -CreateProfile command line flag to add a profile entry to profiles.ini and populate the new profile directory with a prefs.js file firefox-bin -CreateProfile "testprofile ${PROFILE_DIR}/testprofile" Next, start firefox to populate the new profile directo...
How Mozilla finds its configuration files - Archive of obsolete content
...
Other Mozilla customization pages - Archive of obsolete content
At the moment all messages of the program are in german language. This because the program was developped for mozilla configuration in a German administration with about 2000 users. ...
Automatic Mozilla Configurator - Archive of obsolete content
la Configurator:How Thunderbird and Firefox find their configuration files Automatic Mozilla Configurator:Protecting Mozilla's registry.dat file Automatic Mozilla Configurator:Enabling quicklaunch for all users Automatic Mozilla Configurator:Kill the XUL.mfl file for good Automatic Mozilla Configurator:Locked config settings Automatic Mozilla Configurator:Other Mozilla customization pages Online configurator tools: registry.dat mozilla.cfg (locked preferences) ...
Automatically Handle Failed Asserts in Debug Builds - Archive of obsolete content
d values are: 0x5 Automatically ignore 0x4 Automatically retry 0x3 Automatically abort Note that you can also force windbgdlg to prompt, by setting a value of 0xfffffffe. To "comment out" a value, set its value to 0xffffffff. As an example, consider the following failed assertion: ASSERTION: no document: 'mDocument != nsnull', file d:/cvs-1.11.4/mozilla/content/xul/content/src/nsXULElement.cpp, line 3173 (note that I have my source tree in d:/cvs-1.11.4/mozilla) If you have a DWORD in HKCU\Software\mozilla.org\windbgdlg\ named "d:/cvs-1.11.5/mozilla/content/xul/content/src/nsXULElement.cpp," (WITH the comma - matches are whole-word only) and value 0x5, the assert would automatically be ignored. If you also had a DWORD named "3173", it would have no effect here because the handler stops compa...
Bonsai - Archive of obsolete content
a tool that lets you perform queries on the contents of a CVS archive; you can: get a list of checkins, see what checkins have been made by a given person, or on a given CVS branch, or in a particular time period. It also includes tools for looking at checkin logs (and comments); doing diffs between various versions of a file; and finding out which person is responsible for changing a particular line of code ("cvsblame"). Start at the main Bonsai Query page or SeaMonkey Tree control page Here are some example queries that will give you a taste of what Bonsai is capable of: Today's checkins to the Mozilla Source Mainline. Checkins to any branch of XFE by Ramiro between 26-Feb-1998 and 12-May-1998 Differences between revisions 3.1 and 3.3 of the file mozilla/cmd/xfe/forms.c That's a...
Adding the structure - Archive of obsolete content
It can contain both text messages (i.e. "Done" in Mozilla when a document finishes loading) and graphical messa...
Making it into a dynamic overlay and packaging it up for distribution - Archive of obsolete content
content/tinderstatus.css" type="text/css"?> <overlay id="tinderstatusOverlay" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <script type="application/javascript" src="chrome://tinderstatus/content/tinderstatus.js" /> <statusbar id="status-bar"> <statusbarpanel class="statusbarpanel-iconic" id="tinderbox-status" insertbefore="offline-status" status="none"/> </statusbar> </overlay> We also need to change the URLs in the copy of tinderstatus.css: statusbarpanel#tinderbox-status { list-style-image: url("chrome://tinderstatus/content/tb-nostatus.png"); } statusbarpanel#tinderbox-status[status="success"] { list-style-image: url("chrome://tinderstatus/content/tb-success.png"); } statusbarpanel#tinderbox-status[s...
Getting Started - Archive of obsolete content
e a copy of chrome.manifest and place it in \My_Theme and open it up in your text editor. This file is a small manifest file which is used to describe the skin. In the code search for all instances of "My_Theme" and replace them with the name of your theme. The packages section lists which components of the browser you're modifying. If we also had skins for Chatzilla, we would need to add another line resembling the other ones and change it to point to Chatzilla. But this list includes everything that we changed, so just modify the blue text to point to match the name/version that you used in the sections before this. skin global My_Theme jar:chrome/My_Theme.jar!/global/ skin mozapps My_Theme jar:chrome/My_Theme.jar!/mozapps/ skin messenger My_Theme jar:chrome/My_Theme.jar!/messenger/ skin mes...
Creating a hybrid CD - Archive of obsolete content
-v speed=2 dev=0,6,0 ~/party.iso Its also handy to be able to mount an image file to test it. mount ~/party.iso /mnt/cdrom -t iso9660 -o loop=/dev/loop3,blocksize=1024 umount /mnt/cdrom Here is the HFS mapping that I used. The Creator "MOSS" is for Netscape 4.x and "MOZZ" is used for Mozilla. It is used as the creator type for README and other text files because it can handle Unix and Windows linebreaks, but teachtext cannot. # Example filename mapping file used by mkhybrid for hfs # # EXTN XLate CREATOR TYPE Comment .hqx Ascii 'SITx' 'TEXT' "BinHex file" .zip Raw 'SITx' 'ZIP ' "Zip file" .gz Raw 'SITx' 'ZIP ' "gzip file" .tgz Raw 'SITx' 'ZIP ' "tar.gz gzip file" .tar Raw 'SITx' 'TARF' "tar file" .tif Raw '8...
Creating a Skin for Mozilla - Archive of obsolete content
mation Author: Neil Marshall Other Contributors (Suggestions/Corrections): Brent Marshall, CDN (http://themes.mozdev.org), JP Martin, Boris Zbarsky, Asa Dotzler, WeSaySo, David James, Dan Mauch Last Updated Date: Jan 5th, 2003 Copyright Information: Copyright 2002-2003 Neil Marshall, permission given to Devmo to migrate into the wiki April 2005 via email. Original Location: http://www.eightlines.com/neil/mozskin ...
Creating a Skin for Firefox/Getting Started - Archive of obsolete content
Make a copy of contents.rdf, place it in \My_Theme and open it up in your text editor. This file is a small XML Database which is used to describe the skin. In the code, search for all instances of "My_Theme" and replace them with the name of your theme. The packages section lists which components of the browser you're modifying. If we also had skins for Chatzilla, we would need to add another line resembling the other ones and change it to point to Chatzilla. But this list includes everything that we changed, so just modify the blue text to point to match the name/version that you used in the sections before this. <RDF:li resource="urn:mozilla:skin:My_Theme:communicator"/> <RDF:li resource="urn:mozilla:skin:My_Theme:editor"/> <RDF:li resource="urn:mozilla:skin:My_Theme:global"/> <RDF:li r...
Devmo 1.0 Launch Roadmap - Archive of obsolete content
...
Exception logging in JavaScript - Archive of obsolete content
hose in rules 3 and 4 above) will be logged before control returns to the outermost C++ caller. Forcing logging of exceptions in inner JS frames Sometimes you might actually want to see all exceptions from inner JavaScript frames logged (in the call chain above that would be when an exception is unhandled in frame 4). Note that the following will have no effect on the NS_NOINTERFACE exceptions outlined in rules 3 and 4 above - those exceptions will not be reported in any case. There are two ways you can accomplish this. First, you can set the boolean preference dom.report_all_js_exceptions. If this preference is true, all exceptions from inner frames will be logged. Alternatively, you can set the environment variable MOZ_REPORT_ALL_JS_EXCEPTIONS. It doesn't matter what value you set this to (i...
Building Firefox with Rust code - Archive of obsolete content
nd update as new releases become available, or use the ./mach bootstrap command. The build system will generate a special 'rust unified library' crate, compiled to a static library (libgkrust.a) which is in turn linked into XUL, so all public symbols will be available to C++ code. If you have new Rust libraries that code in libxul calls directly, then you should add the appropriate extern crate lines in toolkit/library/rust/shared/lib.rs, and add those libraries (crates) as dependencies in toolkit/library/rust/Cargo.toml. If you want to call code in the "e10s" crate, you would add: extern crate e10s; to toolkit/library/rust/shared/lib.rs; you would also need to specify the path to that crate in the dependencies section of toolkit/library/rust/shared/Cargo.toml: [dependencies] e10s = { pa...
Using microformats - Archive of obsolete content
if debug mode is in use; otherwise, specify false. The default is false. targetArray Optional. If provided, this is an array of microformat objects to which the search results are added. Return value A new array of microformat objects matching the search criteria, or the array specified by microformats with the newly found microformat objects added. getNamesFromNode() Returns a space-delineated list of microformat names that correspond to the specified microformat node. var nameList = Microformats.getNamesFromNode(node); Parameters node The node for which to retrieve a list of microformat names. Return value If the specified node is a microformat, the result is a space-delineated string listing all the microformat names that correspond to the node. If the node isn't a micr...
JavaScript Client API - Archive of obsolete content
engine names). You can also set up a component that registers a weave:service:ready observer and at that time, imports main.js as well as your engine. Also, for me, doing Weave.Engines.register(FooEngine) worked better then doing Weave.FooEngine = FooEngine. Reason for this is, Weave will iterate through the registerEngines preference and try to instantiate each engine it has there before you the line mentioned above ever has a chance to execute.This means the constructor to your engine is not ready when Weave tries to instantiate it. Testing and Debugging your Engine Set observers in the Tracker to tell when your datatype changes, after which the score needs to be set. You can also add api's to the engine, get a handle of the engine by going Weave.Engines.get("Foo") and call it directly. ...
GRE Registration - Archive of obsolete content
la.org/GRE/1.8_1 Version=1.8 GreHome=C:\path\to\installed-dir Feature=Value Feature2=Value2 HKLM/Software/mozilla.org/GRE/1.8_2 Version=1.8 GreHome=C:\path\to\second-installation When installing a GRE via the Mozilla suite GRE installer, the installer will blindly overwrite any previous GRE information in HKLM/Software/mozilla.org/GRE/<version>. When installing a GRE via the command line <tt>xulrunner.exe -register-global</tt>, XULRunner will detect that there is already an installation at HKLM/Software/mozilla.org/GRE/<version> and will try alternate keys <version>_1 _2 until an available key is found. Mac On mac, the only GRE is the libxul framework XUL.framework. This framework is installed either in /Library/Frameworks/XUL.framework/Versions/<version> or in ~/Library/Frame...
HTTP Class Overview - Archive of obsolete content
HttpConnectionInfo identifies a connection nsHttpTransaction implements nsIRequest encapsulates a http request and response parses incoming data nsHttpChunkedDecoder owned by a transaction strips chunked transfer encoding nsHttpRequestHead owns a nsHttpHeaderArray knows how to fill a request buffer nsHttpResponseHead owns a nsHttpHeaderArray knows how to parse response lines performs common header manipulations/calculations nsHttpHeaderArray stores http "<header>:<value>" pairs nsHttpAuthCache stores authentication credentials for http auth domains nsHttpBasicAuth implements nsIHttpAuthenticator generates BASIC auth credentials from user:pass nsHttpDigestAuth implements nsIHttpAuthenticator generates DIGEST auth credentials from user:pass O...
Helper Apps (and a bit of Save As) - Archive of obsolete content
calFileMac. Unix: launch directly via nsIProcess. Security considerations Multiple checks for whether a file is executable (on Windows) to keep from launching such files via ::ShellExecute(). Checks happen in OnStartRequest, in the helper app dialog, and as a last ditch in the launching code. Limitations of nsIMIMEInfo No way to say "do whatever the OS default is." No support for command-line arguments. No support for multiple commands connected by pipes (mostly useful on Unix). Ongoing work Support synchronous dialogs, not just asynchronous ones (fixes many issues related to pre-downloading, content-decoding, etc). Reworking the nsIMIMEService API to improve the quality of the MIMEInfo we get. Reworking the helper app dialog to save user choices better. GNOME integration for ...
Java in Firefox Extensions - Archive of obsolete content
(this works in firefox 3.x, for firefox 4.x use AddonManager.getAddonByID) var extensionPath = Components.classes["@mozilla.org/extensions/manager;1"]. getService(Components.interfaces.nsIExtensionManager). getInstallLocation("test@yoursite"). // guid of extension getItemLocation("test@yoursit...
Clipboard Test - Archive of obsolete content
child):after{content: ","; padding-right: .5em; } .method>.name>.param:not(:last-child):after{content: ","; padding-right: .5em; } .method>.name>.param>.name:after{content: " as "; font-weight: normal; } .method>.params{display: block; color:#555;} .method>.params>.param{display: block; margin-bottom:5px;} .method>.params>.param>.name{font-weight:bold; margin-right:.5em; min-width:80px; display:inline-block;} .method>.params>.param>.description{display:inline-block; width:300px; vertical-align:top;margin-right:30px} .method>.params>.param>.type{display:inline-block; width:100px; vertical-align:top;font-weight:bold;} .method>.params>.param>.type:before{content: "Type "; color: #888; font-weight:normal;} .method>.params>.param>.default{display:inline-block; width:100px; vertical-align:top;font-w...
Measuring add-on startup performance - Archive of obsolete content
This article describes an add-on that is no longer supported. Using about:startup The About Startup add-on provides a much simpler way to measure startup performance. Once installed, it will gather startup data and display it in the about:startup page. The add-on is very lightweight, so it shouldn't have a noticeable negative effect on your baseline and add-on tests. To test with about:startup, you should set up a new Firefox profile, install this add-on, and then open and quit Firefox repeatedly. If you want to match Talos, you should do this 20 times. Then look at the results in the about:startup page. This should provide your baseline numbers. Then repeat the process with both About Startup and your add-on installed. The overhead can be calculated using the same formula. The a...
Message Summary Database - Archive of obsolete content
le than it's been worth, especially when we've threaded incorrectly. Meta Information The nsIDBFolderInfo interface handles the folder meta data. This also supports generic properties. There is a method on nsIMsgDatabase to get the dbFolderInfo. Mork - the Good, the Bad, and the Ugly Mork has a horrible reputation and we're always asked why we don't just replace it with some other db. The bottom line is that we haven't been able to justify the very large cost of doing so because there won't be any benefit to the end-user, at least in the short term. Here are some of the trade-offs: The mork file format is ascii text, but unreadable. If it were binary, there would be less complaints, and it would be smaller. The MDB interfaces are overly complex, and unfamiliar. The Mork code uses a lot of ter...
Mozilla Application Framework in Detail - Archive of obsolete content
Gecko Technologies provide a complete set of resources for efficient development, including full support of web standards, a cross-platform/cross-device user interface language, an extensible architecture and embedding technologies. With its unprecedented power, speed and standards support, the Gecko browser engine represents a major advance for developers. With Gecko, developers seeking a streamlined way to create and distribute web-based services across multiple platforms and devices can write once to W3C standards and their content and web applications will be accessible from across computing platforms and devices. Gecko is based on contributions from mozilla.org, the organization chartered with managing Netscape's open source initiative among thousands of Internet developers and participa...
LIR - Archive of obsolete content
space (result is an address) 6 reti void return an int 7 retq void 64 bit 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-exten...
Porting NSPR to Unix Platforms - Archive of obsolete content
mozilla/nsprpub/pr/src/pthreads, most likely <tt>ptthread.c</tt> and <tt>ptio.c</tt> Testing Your Port We have some unit tests in <tt>mozilla/nsprpub/pr/tests</tt>. First a warning: some of the tests are broken. Further, we don't have documentation of our unit tests, so you often need to resort to read the source code to understand what they do. Some of them respond to the <tt>-h</tt> command line option and print a usage message. <strike>Henry Sobotka of the OS/2 Mozilla porting project has a web page at http://www.axess.com/users/sobotka/n.../warpztjs.html with good documentation of the NSPR unit tests</strike>. Here are my favorite tests. For thread management and synchronization: <tt>cvar -d</tt> <tt>cvar2</tt> <tt>./join -d</tt> <tt>perf</tt> <tt>./switch -d</tt> <tt>intrupt -d...
BlogPosts - Archive of obsolete content
Just Browsing: Mozilla Prism Update ThansCorner: Mozilla Prism - Webrunner with Pazzaz Mozilla Prism - A Revolution in Web Apps ThansCorner: Mozilla WebRunner 0.7 Site Specific Browsers WebRunner Using WebRunner WebRunner + Gears = Offline Desktop Reader WebRunner 0.5 WebRunner 0.5 - Mac Support WebRunner 0.5 - Linux Install WebRunner, Google Reader, and Google Notebook Distraction Free GTD - 32+ web app files for online todo lists Mozilla WebRunner: a one-window, tabless browser with no URL bar WebRunner becomes Prism - A Mozilla Labs Project Mozilla Labs: Prism Alex Faaborg: Prism Mozilla Prism: Bringing Web Apps to the Desktop Everyone should use Site Specific Browsers Mozilla Prism Portable (Spanish) Prism, l'avenir des applications Web selon Mozilla (French) Mozilla Prism : bundle...
Configuration - Archive of obsolete content
e application to open minimized to the system tray: yes or no. Launch Prism with -webapp [bundle] to load the specified web profile and install the webapp to your Prism profile folder. Once the webapp is installed, it can be launched using -webapp [webapp-id] and Prism will skip the installation and run the webapp directly. Any of the profile parameters can also be passed directly on the command line as well. Example Here is an example of a webapp.ini profile: [Parameters] name=Gmail id=google.mail@developer.mozilla.org uri=https://mail.google.com icon=gmail status=yes location=no sidebar=no navigation=no ...
Extensions - Archive of obsolete content
lication ID and the differences in the user interface (UI). Extensions typically overlay the host application's UI to add toolbar buttons, menus and other features. One of Prism's features is an extreme lack of UI elements, which means that trying to use the same overlays in Firefox and Prism is really not possible. The Basics In order to install an extension in Prism, you need to follow the guidelines for building a Mozilla-based extension. To support Prism specifically, you'll need to add Prism to the list of target applications in the extension's install.rdf file. The code snippet will look something like this: <em:targetApplication> <!- Prism -> <Description> <em:id>prism@developer.mozilla.org</em:id> <em:minVersion>0.8</em:minVersion> <em:maxVersion>1.0.0.*</em:maxVersion>...
FAQ - Archive of obsolete content
Archive › Mozilla › Prism › FAQ
s not a platform. Prism is built on top of the Mozilla platform and its Gecko rendering engine, just like Mozilla Firefox, so it provides the same capabilities to web applications that Firefox provides, including support for HTML, JavaScript, CSS, and <canvas>. At the same time, we're also working to increase the capabilities of those apps by adding features to the Web itself, like support for offline data storage and access to 3D graphics hardware, that will be available to web applications in both Prism and Firefox. How is Prism different from XULRunner? Prism is built on top of XULRUnner. Prism is a simple XULRunner application with the main portion of the UI consisting of a XUL <browser> element. How does Prism render web pages? Prism uses Gecko, the same browser rendering system found i...
Hacking wiki - Archive of obsolete content
sions/Breadcrumbs.php"); include("extensions/TitleOverride.php"); include("extensions/Abbr.php"); include("extensions/Object.php"); include("extensions/Kbd.php"); ?> TBD installing/configuring RSS and Doxygen extensions - anything special needs to be done? The title-override / breadcrumbs extensions need an additional table created. To configure it, run <tt>update-devmo.php</tt> from the command line. The following worked for me (from the <tt>www</tt> directory): /path/to/php -f ./maintenance/update-devmo.php Done You should have a working install of the MDC wiki now. If you have problems with setting up the MDC wiki (and not the web server or PHP or MediaWiki), feel free to ask in #devmo. Random tips You can set the file to log by putting something like this in your LocalSettings.php:...
RDF Datasource How-To - Archive of obsolete content
tify the data source implementation An implementation class (that corresponds to the CLSID) whose code lives in a DLL. The DLL must be located in the XPCOM components directory A factory that is registered to an XPCOM ProgID in order to be instantiated from the repository. Constructing a DLL for a component is beyond the scope of this document; the reader is referred to the RDF factory as a guideline. Registering an RDF datasource is fairly simple: in the DLL's NSRegisterSelf() method, you simply call the component manager's RegisterComponent() method: extern "C" PR_IMPLEMENT(nsresult) NSRegisterSelf(nsISupports* aServiceManager, const char* aPath) { nsresult rv; ... // Assume compMgr refers to the component manager rv = compMgr->RegisterComponent(kMyDataSourceCID, "My...
Remote debugging - Archive of obsolete content
also the values they were passed. Core dump A core dump includes all of the memory of a crashed program. It allows you to see the crash in a debugger even after the program has long exited. Transferring a core dump is tricky, because it is large and can contain private information. Core dumps on Mac and Linux To generate a core dump on Mac, type "ulimit -c unlimited", run Firefox from the command line, and make Firefox crash. When Firefox crashes, a core will be placed in /Cores. You can then load the core file into gdb (gdb firefox-bin corefile), and it will be as if you caught the crash while running Firefox under gdb! When transferring a Mac or Linux core dump, you'll also have to transfer the Firefox executable (and maybe more). Core dumps on Windows On Windows you can produce a "minidump"...
Rsyncing the CVS Repository - Archive of obsolete content
ol system. Here's how to do it: rsync -az --delete --stats cvs-mirror.mozilla.org::mozilla ~/cvs-mirror This will mirror the CVS repository into ~/cvs-mirror. Optionally, the --progress option will show the progress for each file, and a percentage of the total files that are transferred. At the time of this writing, this will take 2.8 GB of disk space. Note that for using this copy, the NoLocks line in CVSROOT/config will need to be commented out, as it requires a modified CVS binary. References Thanks also to bz for telling me the exact commands that I need ...
Safely loading URIs - Archive of obsolete content
the URI. So if you're implementing a context menu and you add a "View Image" option, the source of the image URI would be the page the image is in, not the chrome document the context menu code is in. Differences between the methods The three methods differ from each other in how the source of the URI is identified and in what is known about the URI to be loaded. In general, the following guidelines apply for Gecko 1.8: If you plan pass a URI string to nsIWebNavigation.loadURI (which can happen indirectly, e.g. by passing the string to something that loads it in a <browser> or <iframe>), you must call checkLoadURIStr to be secure. There's no way to do this completely securely in Gecko versions prior to 1.8.0.4. If you're doing anything else (passing a URI string to some other API like w...
Same origin policy for XBL - Archive of obsolete content
it looks at the nsIPrincipal originating the load and the nsIURI to be loaded. Determining the originating principal The principal originating the load is determined using the following steps: For external stylesheets (<link>, <?xml-stylesheet?>, user sheets, and UA sheets), it depends on where the sheet is loaded from, just like it would for an HTML document loaded from a similar source. For inline stylesheets (<style> and style attributes), the principal of the element node involved (meaning the <style> element or the element whose style attribute is being looked at). For the nsIDOMDocumentXBL interface's nsIDOMDocumentXBL.addBinding() and nsIDOMDocumentXBL.loadBindingDocument() methods, the originating principal is the one of the script making the call, or the principal of the document th...
open - Archive of obsolete content
thods to examine or modify the file. Certain methods of File, such as read and write should not be used when the file is not open. Other methods, such as remove may not be used when the file is open. Valid file types are text, binary and unicode. Text indicates ASCII text without NUL characters. Binary indicates UTF-8 files. Unicode indicates UCS-2 files. For all file types, carriage returns and linefeeds are treated in a platform-agnostic way. Examples Example: Using open In the following example, myFile is a File object: myFile.open("read", "text"); See Also ...
String Quick Reference - Archive of obsolete content
Note: may involve changing existing APIs Old way: wrap with nsCAutoString() // foo is a PRUnichar* stri...
Table Cellmap - Archive of obsolete content
at are not caused by zero spans, this is at least a O2(n) algorithm. The following routines seem to be hot spots performance wise: nsCellMap::ColHasSpanningCells nsCellMap::RowHasSpanningCells nsCellMap::RowIsSpannedInto Users of nsCellmap::GetDataAt outside nsCellMap.cpp The border collapse code relies on the cellmap. The collapsing of rows and columns uses the cellmap. and finally the line iterator methods which are used for arrow navigation through a table. Original Document Information Author(s): Bernd Mielke Last Updated Date: September 27, 2003 Copyright Information: Portions of this content are (C) 1998-2007 by individual mozilla.org contributors; content available under a Creative Commons license | Details. ...
Table Layout Strategy - Archive of obsolete content
utStrategy::BalanceColumnWidths or the fixed layout counter part. In the following the Basic Table Layout Strategy is discussed. The functionality is distributed over a large number of subroutines as shown in the chart below. The words The table layout is width oriented and knows the following widths: Minimum content width - min the minimum width that is required to layout the content, all linebreak possibilities will be used percent width - pct the cell width specified in percent, fixed width - fix the cell width specified as px, mm etc., proportional width - prop the cell width specified via 1*, 2* etc. and the desired width - des the width the content could fill without any linebreaks. Cells can be members of colspans. These colspans have to distribute their space to the col...
Tamarin Acceptance Test Template - Archive of obsolete content
This is the test template for Tamarin acceptance tests (placed in test/acceptance/feature_name): /* -*- Mode: js; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 4 -*- */ /* vi: set ts=4 sw=4 expandtab: (add to ~/.vimrc: set modeline modelines=5) */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations unde...
Actionscript Performance Tests - Archive of obsolete content
The testconfig.txt file defines groups of tests to run (e.g. sunspider, scimark, language). By default the time for each test is output. Use the --memory flag to capture the maximum private bytes memory (high water mark) for a test. By default each test is run a single time. ...
Running Tamarin acceptance tests - Archive of obsolete content
2 tests against vm: /Users/build/hg/builds/5260-6d1899261bac/mac/avmshell_64 2532 running abcasm/abs_helper.as skipping... reason: 2531 running abcasm/adhoc.abs skipping... reason: inconsistencies in different debug output, need to implement regex matching of diffs 2527 running abcasm/branchToCommon.abs 2530 running abcasm/arithmetic.abs 2529 running abcasm/bkpt.abs 2528 running abcasm/bkptline.abs 2526 running abcasm/bug_476556.abs 2524 running abcasm/bug_491056.abs ... test run PASSED! Tests complete at 2010-09-28 10:39:26.751797 Start Date: 2010-09-28 10:38:07.221457 End Date : 2010-09-28 10:39:26.751797 Test Time : 0:01:19.530340 passes : 59291 failures : 0 expected failures : 75 tests skipped : 76 The -f flag tells runtests.py to force recom...
Running Tamarin performance tests - Archive of obsolete content
"--index index.py" will load index.py and run all of the tests in that index and report results normalized to the index values. A subset of the tests in the index can be run by passing what tests you want to run after specifying the index file. "--saveindex indexname.py" will ru...
Tamarin Acceptance Testing - Archive of obsolete content
AvmDiff See instruction in doc/avmdiff.txt in the tamarin repository. Misc The acceptance and performance tests can be run on windows mobile devices con...
Treehydra Manual - Archive of obsolete content
IMPLE CFGs Treehydra can be positioned after any pass, allowing you access various levels of GIMPLE. In this example, we show how to access the GIMPLE just after function inlining is performed. (This allows a simple version of interprocedural analysis.) At this point, GCC is using a different internal structure, so Treehydra uses a different callback, process_cgraph. require({ after_gcc_pass: "einline" + (isGCC42 ? "" : "_ipa")}); include('gcc_util.js'); // for function_decl_cfg function process_cgraph(cgraph) { // cgraph is a GCC structure representing a group of functions // within the call graph. Iterate over the functions like this. for (let node = cgraph; node; node = node.next) { let fn = node.decl; if (DECL_STRUCT_FUNCTION(fn)) { // fn has a bo...
Using gdb on wimpy computers - Archive of obsolete content
undation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "i386-redhat-linux"... (gdb) b main Breakpoint 1 at 0x804ec45: file nsAppRunner.cpp, line 811. (gdb) r Starting program: /home/blizzard/src/mozilla/mozilla/dist/bin/./mozilla-bin Breakpoint 1, main (argc=1, argv=0xbffff894) at nsAppRunner.cpp:811 811 InstallUnixSignalHandlers(argv[0]); (gdb) set auto-solib-add 0 (gdb) c Continuing. nsNativeComponentLoader: autoregistering begins. [...] It's easy to define a function for gdb to do this for you automatically. You can add this fu...
Anonymous Content - Archive of obsolete content
's Note: Should there be an API for retrieving insertion points, for dynamically creating new insertion points, or for removing insertion points? Perhaps on ElementXBL?] Event flow and targeting Flow and targeting across scopes DOM events can fire on anonymous targets just as they can on explicit targets. As long as the event flows within the same scope, it is no different from the behavior outlined in the DOM Level 2 Events specification. Events flow through the final transformed content model after all elements have been repositioned through the usage of children tags. Whenever events flow from an anonymous element in a bound element's scope to the bound element itself, one of two actions occurs. Either the event is retargeted so that the bound element becomes the target, or the event i...
Windows stub installer - Archive of obsolete content
ar ($) signs--which may be used in the .jsts, including: $Version$ which is replaced at packages time with the browser version. $SpaceRequired$ which is replaced at package time with the amount of space in KB required for the package when it is fully extracted. Other macro strings listed in makejs.pl can be found by searching for "Version", which is one of the macro strings, until you find the line $line =~ s/\$Version\$/$inVersion/i; Other macro strings are grouped in this section. As with "Version", the macro name will be the first string in the substitution statement on each line. Add a [Component <component>]</component> section to the config.ini template file named config.it found at: <http://lxr.mozilla.org/seamonkey/sou...dows/config.it>. Then add the Component <component> i...
Install Wizards (aka: Stub Installers) - Archive of obsolete content
installer package is an archive file (called xpi--pronounced "zippies"--because of its .xpi extensions) in Phil Katz zip format. It contains some files to be installed and the install script, usually named install.js, which contains JavaScript directives for actions to take during an install including adding files and directories, removing old or obsolete files and directories, executing command line tools, etc. To learn more about the XPInstall and installer packages please refer to The Annotated Browser XPI Installer and the XPInstall API Reference. What do we mean by engine code? The XPInstall engine processes installer packages by reading instructions from their install scripts to extract files and take other install actions. The same XPInstall engine is used by the browser and the st...
modDateChanged - Archive of obsolete content
input date or has not. Description Most often, the date passed in as the second parameter in modDateChanged is the returned value from a modDate on a separate file, as in the following example, in which the dates of two files are compared. Example fileSource1 = getFolder("Program", "file1.txt"); fileSource2 = getFolder("Program", "file2.txt"); err1 = File.modDate(fileSource1); // the baseline returned err2 = File.modDateChanged(fileSource1, err1); logComment("File.modDateChanged should return 'false' = " + err2); // the reason it expects false is we're comparing // the return 'time stamp' value for // file1.txt with the actual file1.txt itself. // Thus, no change in 'time stamp' values. err3 = File.modDateChanged(fileSource2, err1); logComment("File.modDateChanged should return 'tru...
loadResources - Archive of obsolete content
This method is used to internationalize installation scripts by allowing the installer to retrieve localized string values from a separate file. ...
logComment - Archive of obsolete content
Method of Install object Syntax int logComment( String aComment ); Parameters The sole input parameter is a string whose value will be written to the log during the installation process. Returns An integer error code. For a list of possible values, see Return Codes. Description The install log is created in the product directory by default (where the browser executable is) if it can be, and if the installation doesn't have proper permission, the install log is written to the user's profile directory. ...
Methods - Archive of obsolete content
Constructs an object for working with a Windows .ini file. getWinRegistry Constructs an object for working with the Windows Registry. initInstall Initializes installation for the given software and version. loadResources Returns an object whose properties are localized strings loaded from the specified property file. logComment Add a comment line to the install log. patch Applies a set of differences between two versions. performInstall Finalizes the installation of the software. refreshPlugins Refreshes the list of plug-ins registered for the browser. registerChrome Registers chrome with the chrome registry. resetError Resets a saved error code to zero. setPacka...
Install Object - Archive of obsolete content
see how to package a plugin as an extension. Install Use the Install object to manage the downloading and installation of software with the XPI Installation Manager. Overview The Install object is used primarily in installation scripts. In all cases, the Install object is implicit--like the window object in regular web page scripts--and needn't be prefixed to the object methods. The following two lines, for example, are equivalent: f = getFolder("Program"); f = Install.getFolder("Program"); An installation script is composed of calls to the Install object, and generally takes the following form: Initialize the installation Call initInstall with the name of the installation and the necessary registry and version information. Add the files to the installation Add f...
Extending Gecko with XBL and XTF - Archive of obsolete content
Presentation View Online Download Summary This session explored ways to extend Mozilla/Firefox to handle new XML tags and namespaces via drop-in extensions to the layout engine. Questions and Discussion Extending Gecko with XBL and XTF - Discussion ...
Mozilla E4X - Archive of obsolete content
E4X marries XML and JavaScript syntax, and extends JavaScript to include namespaces, qualified names, and XML elements and lists. E4X also adds new JavaScript operators for filtering XML lists, and for enumerating XML children and descendants. Another E4X feature: the ability to bind a W3C DOM document to a new XML object, reflecting the DOM in E4X terms so that updates to either the DOM or the E4X object hierarchy show up in the other. ...
SVG And Canvas In Mozilla - Archive of obsolete content
Advances in hardware, especially graphics processors, offer the potential for far richer graphics in interactive applications. To realize this potential in Web applications, browsers must expose rich new graphics APIs to Web content. The Mozilla project will meet this challenge with two major new features to be delivered in Firefox 1.5: integrated SVG and a new canvas HTML element. Work is also underway "under the hood" on a new unified graphics architecture that uses 3D graphics processors to accelerate all rendering. ...
XUL - Mozilla's XML User Interface Language - Archive of obsolete content
Presentation View Online Download Summary Ben Goodger, lead engineer for Mozilla Firefox talked about XUL, Mozilla's XML User Interface toolkit. Questions and Discussion XUL - Mozilla's XML User Interface Language - Discussion ...
A XUL Bestiary - Archive of obsolete content
sumed. In other words, a chrome URL like the global pointer above picks up a file called global.css, and the help pointer above could also be written as chrome://help/content, because the name of the package itself is "help." Viewing Chromes Other Than Mozilla's There is a special flag you can use to start Mozilla with some chrome other than the default. When you invoke Mozilla from the command line with the -chrome flag, you can specify a chrome just as you would in the previous example: mozilla -chrome chrome://help/content/help.xul Brings up the help package mentioned in the previous example as a "stand-alone" chrome. This special option allows you to create and access chromes independent of the Mozilla browser and begins to suggest some possibilities for XUL-as-platform beyond the sim...
align - Archive of obsolete content
. center Extra space is split equally along each side of the child elements, resulting in the children being placed in the center of the box. end Child elements are placed on the right or bottom edge of the box. If the box is larger than the total size of the children, the extra space is placed on the left or top side. baseline This value applies to horizontally oriented boxes only. It causes the child elements to be aligned so that their text labels are lined up. stretch This is the default value. The child elements are stretched to fit the size of the box. For a horizontal box, the children are stretched to be the height of the box. For a vertical box, the children are stre...
cols - Archive of obsolete content
Archive › Mozilla › XUL › Attribute › cols
...
next - Archive of obsolete content
Archive › Mozilla › XUL › Attribute › next
<< XUL Reference home next Type: id Set to the pageid of the next wizardpage after this one. When set, the page with this pageID is displayed when the Next button is pressed. This can be used to create wizards that do not have a linear sequence. If one of the pages has a next attribute, all of the pages should have one, except that last page. ...
oncommand - Archive of obsolete content
<< XUL Reference home oncommand Type: script code This event handler is called when the command is activated. This occurs when a user selects a menu item or presses a keyboard shortcut attached to the command. ...
resizer.dir - Archive of obsolete content
<< XUL Reference home dir Type: one of the values below The direction that the window is resized. left Resized to the left. right Resized to the right. top Resized up. bottom Resized down. bottomstart Resized down and toward the start of the line (toward the left for left-to-right locales, toward the right for right-to-left locales). bottomend Resized down and toward the end of the line (toward the right for left-to-right locales, toward the left for right-to-left locales). bottomleft Resized down and to the left. bottomright Resized down and to the right. topleft Resized up and to the left. topright Resized up and to the right. See also dir ...
style - Archive of obsolete content
Syntax is as in the HTML style attribute. ...
Attribute (XUL) - Archive of obsolete content
image inactivetitlebarcolor increment index inputtooltiptext insertafter insertbefore instantApply inverted iscontainer isempty key keycode keytext label lastpage lastSelected last-tab left linkedpanel max maxheight maxlength maxpos maxrows maxwidth member menu menuactive min minheight minResultsForPopup minwidth mode modifiers mousethrough movetoclick multiline multiple name negate newlines 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...
Dynamically modifying XUL-based user interface - Archive of obsolete content
ument.getElementById("myPopup"); // a <menupopup> element var first = createMenuItem("First item"); var last = createMenuItem("Last item"); popup.insertBefore(first, popup.firstChild); popup.appendChild(last); You can also use appendChild() and insertBefore() to move existing elements. For example you could move the item labeled "First item" to the end of popup by adding this statement as a last line to the snippet above: popup.appendChild(first); This statement would remove the node from its current position in the document and re-insert it at the end of the popup. Anonymous content (XBL) XBL is the language used in Mozilla to define new widgets. Widgets defined in XBL may choose to define some content which is inserted to the bound element, when the binding is attached. This content, calle...
Accessing Files - Archive of obsolete content
etFile(), listed in the following table. Application The directory of the executing application. For Firefox, for instance, this will be the directory where Firefox is installed. For a XULRunner application, this will be the directory where the application is installed. Working The current working directory. If the application was launched from a command line, for instance, this will be the directory where the application was launched from, which may be different from the 'Application' value. Profile The profile directory where preferences are stored. Desktop The desktop directory. Usually, you would use this as the default directory for saving files. Components The components directory...
Working With Directories - Archive of obsolete content
Open and Save Dialogs, Reading textual data, Writing textual data, List of file-related error codes. A reference to a directory may be created in the same way as with a file by using nsIScriptableIO.getFile(). You can access a subdirectory by supplying a directory name as the second argument, or refer to one of the special directories by supplying a null string for the second argument. The first line below with retrieve the directory corresponding to the user's home directory, while the second will retrieve the directory 'myfiles' on the desktop. var dir1 = IO.getFile("Home", ""); var dir2 = IO.getFile("Desktop", "myfiles"); To refer to a subdirectory, rather than using a path, use nsIFile.append() to build up a path. For instance: var dir2 = IO.getFile("Desktop", "myfiles"); dir2.append("pi...
Getting File Information - Archive of obsolete content
= file.fileSize; It is also possible to modify the size of a file by setting the fileSize (nsIFile.Attributes) attribute to a value. This may be useful to truncate a file, however, setting the file size will also increase the size of a file if the value is larger than the current size of the file. In this case, the new part of the file will be filled with empty data. For instance, the following line will set the length of a file to 5000 bytes. file.fileSize = 5000; Modified Time The time that a file was last changed may be retrieved using the lastModifiedTime (nsIFile.Attributes) attribute. This attribute holds a value measured in milliseconds since January 1, 1970. It is convenient to pass the returned time to the Date constructor. var lastmod = new Date(file.lastModifiedTime); In th...
Writing to Files - Archive of obsolete content
Binary Data In addition to text, binary values may be written to a file either as bytes or as numbers. A number of methods are available which may be used for this. If you are going to write to a binary file instead of text, specify the 'binary' flag in place of the 'text' flag when creating the stream with nsIScriptableIO.newOutputStream(). var stream = IO.newOutputStream(file, "binary"); This line will create and open a binary stream for a file. Once opened, you can write to the file using various writing methods. The following methods are available, all of which take one argument, which is the value to write: writeBoolean will write a boolean value to a stream. If the argument is false, 0 is written, and if the argument is true, 1 is written. Non-boolean values will be converted into b...
International characters in XUL JavaScript - Archive of obsolete content
Earlier versions always interpreted JS files loaded from XUL as ISO-8859-1 (Latin-1), in both local and remote cases. ...
scrollByIndex - Archive of obsolete content
<< XUL Reference home scrollByIndex( lines ) Return type: no return value Scrolls the contents of the arrowscrollbox by a certain number of lines. A line is a single element. Use a positive value as the lines argument to scroll forward that many lines, or a negative value to scroll backward that many lines. ...
Other Resources - Archive of obsolete content
Demostrates flexing, layouts, set up of trees and such. Very useful. ...
OpenClose - Archive of obsolete content
extra work. For instance, a menu's popup will open when the menu label is clicked, and a submenu will open when the mouse is hovered over the parent menu element. However, there may be situations when you wish to open a menu manually. The menu element has an open property which may be set to true to open the menu, or false to close the menu. A simple example: somemenu.open = true; This single line of code will open a menu referenced by the variable 'somemenu'. Note that the open property applies to the menu or button, not to the menupopup. Here is a complete example which uses a button to open a menu: <button label="Open Menu" oncommand="document.getElementById('editMenu').open = true;"/> <menu id="editMenu" label="Edit"> <menupopup> <menuitem label="Cut"/> <menuitem la...
Positioning - Archive of obsolete content
d be opened. Positioning using Coordinates A popup can be positioned further using the x and y arguments to openPopup. After the popup is positioned using the anchor, the x and y arguments may be used to offset the popup by a certain distance. The section on the openPopup method provides an example of this. If a menupopup, panel or tooltip has a margin specified in a style sheet or using the inline style attribute, this margin will be applied around the outside of the popup. In the following example, the menupopup has a 2ex margin above it, so when opened, the popup will be placed a distance of 2ex below the bottom of the button. <button label="Popup" type="menu"> <menupopup style="margin-top: 2ex;"> <menuitem label="Cat"/> <menuitem label="Dog"/> </menupopup> </button> This ...
next - Archive of obsolete content
Archive › Mozilla › XUL › Property › next
<< XUL Reference next Type: string wizardpage id Set to the pageid of the next page after this one. When set, the page with this pageID is displayed when the Next button is pressed. This can be used to create wizards that do not have a linear sequence. If one of the pages has a next attribute, all of the pages should have one, except that last page. ...
style - Archive of obsolete content
Archive › Mozilla › XUL › Property › style
...
Notes - Archive of obsolete content
Deleting the "(Default)" values in the following registry keys will fix this: HKEY_CLASSES_ROOT\HTTP\shell\open\ddeexec HKEY_CLASSES_ROOT\https\shell\open\ddeexec You can also do this from within your XPCOM component using Windows registry interface. Some more links on the matter: A Mozillazine post. A blog post. ...
text-link - Archive of obsolete content
...
Containment Properties - Archive of obsolete content
hecking if it is a container. Note the distinction here. The containment attribute doesn't replace the existing container checking. If the resource 'http://www.xulplanet.com/rdf/A' was also an RDF Seq with some children, then those children would also be added to the results. This next example demonstrates this. The only difference between this and the previous example is a a couple of additional lines added to the RDF/XML: <rdf:Seq rdf:about="http://www.xulplanet.com/rdf/A"> <rdf:li rdf:resource="http://www.xulplanet.com/rdf/E"/> <rdf:li rdf:resource="http://www.xulplanet.com/rdf/F"/> </rdf:Seq> The effect is that there are five results instead of three. Three generated via the use of the containment attribute, and two generated because the starting resource is a container with two child...
Rule Compilation - Archive of obsolete content
ou will only have need for one rule, as you want all results to be generated in the same manner. For instance, if generating the items in a listbox, you will typically use only one rule. If only one rule is needed, the rule element is optional. A template without any rules (or, in fact, one with a rule with no query defined) will generate output unconditionally for each result. Template syntax outline Here is the outline of the template syntax so far. <vbox datasources="http://www.xulplanet.com/ds/sample.rdf" ref="http://www.xulplanet.com/rdf/A" flex="1"> <template> <query> -- query content goes here -- </query> <rule> -- rule content goes here -- </rule> <rule> -- rule content goes here -- </rule> </template> </vbox> Query/rule compilati...
Template Builder Interface - Archive of obsolete content
> </template> </html:div> This example generates three paragraphs. Some static content before the <template> element displays a <h1> header. Since templates were designed for creating XUL content, sometimes there can be unusual results when using HTML. Sometimes this is due to different whitespace handling for HTML and XUL, which is why the content to generate in the above example is all on one line. If you do plan on generating non-XUL content with a template, just watch out for issues like this. Note that this particular whitespace issue has been fixed in Firefox 3 and later. Note also that the datasources attribute has been placed on an HTML element. This is also allowed. However, one thing to watch out for is that non-XUL elements do not have their content generated lazily so all of the ...
Template Logging - Archive of obsolete content
: In template with id root using ref http://www.some-fictitious-zoo.com/birds New active result for query 2 matching rule 1: http://www.some-fictitious-zoo.com/birds/emperorpenguin In the example above, a new result has been added. For references, the value of the template's id and ref attributes are provided in each logged message. This is useful if multiple templates are being used. The second line gives details about the new result. The id of the result is specified at the end, in this case 'http://www.some-fictitious-zoo.com/b...emperorpenguin'. This corresponds to the id attribute set on a generated row. For an RDF datasource, this will be the result's resource. For other datasources, this may be a somewhat random value. However, calling getElementById using this id will retrieve the gen...
Template and Tree Listeners - Archive of obsolete content
andle dragging with more flexibility. For example, in some situations you may want to require dragging onto a folder type of row. In other situations, you may wish to allow items to be dragged between (before or after) rows. This would be the situation if you were dragging items from that tree around, for instance dragging a bookmark from one location to another. The tree widget will draw a small line between the rows while dragging. All you need to do is add a tree builder observer which returns true for the canDrop method. Note that the 'drag on' case only allows dragging onto containers, not ordinary rows. var treeBuilderObserver = { canDropBeforeAfter : function(idx, orient) { return false; }, canDropOn : function(idx, orient) { return true; }, canDrop : function(idx, orient) { retur...
Creating toolbar buttons (Customize Toolbar Window) - Archive of obsolete content
e in the example) depends on the window (the parent window of the toolbar you wish to insert a button). See below for the list of common palette IDs. class="toolbarbutton-1" makes the toolbar button appear correctly in Icons and Text mode; it also adjusts padding. Set the command to be executed when the button is clicked in the oncommand attribute. If you need to handle middle-click, add this line after the oncommand line. onclick="checkForMiddleClick(this, event)" you can also handle middle-click and right-click using onclick handler and check event.button in it like this: <toolbarpalette id="BrowserToolbarPalette"> <toolbarbutton id="myextension-button" class="toolbarbutton-1" label="&toolbarbutton.label;" tooltiptext="&toolbarbutton.tooltip;" onclick="MyExtension.onclic...
Accesskey display rules - Archive of obsolete content
automatically if it's necessary. This document describes the rules of generating a label text. XUL elements don't display any accesskeys on Mac XUL elements don't display any accesskeys on Mac. Because MacOS X doesn't have the conception of accesskey function on its native widgets/applications. Basic accesskey display rules On non-Mac platforms, a character which is same as its accesskey is underlined. E.g., when an accesskey of "File" is 'F', the generated label will be "File". If a label has two or more characters which are same as its accesskey, the first character of them will be underlined. If a label doesn't have the character, XUL elements append the accesskey character with parentheses. E.g., when an accesskey of "Open" is 'A', the generated label will be "Open (A)". However, if the...
Adding Buttons - Archive of obsolete content
is is usually drawn with the text in grey. If the button is disabled, the function of the button cannot be performed. If this attribute is left out entirely, the button is enabled. You can switch the disabled state of the button using JavaScript. accesskey This should be set to a letter that is used as a shortcut key. This letter should appear in the label text and will typically be drawn underlined. When the user presses ALT (or a similar key that varies on each platform) and the access key, the button will be focused from anywhere in the window. Note: Buttons support more attributes than those listed above. Others will be discussed later. Some examples of buttons Example 1 : Source View <button label="Normal"/> <button label="Disabled" disabled="true"/> The examples above will ge...
Adding Event Handlers - Archive of obsolete content
much better to include code in a separate file as the XUL window will load slightly faster. The src attribute is used to link in an external script file. Our find files example Let's add a script to the find file dialog. Although it does not matter what the script file is called, usually it would be the same as the XUL file with a .js extension. In this case, findfile.js will be used. Add the line below just after the opening window tag and BEFORE any elements. <script src="findfile.js"/> We'll create the script file later when we know what we want to put in it. We'll define some functions in the file and we can call them in event handlers. You can include multiple scripts in a XUL file by using multiple script tags, each pointing to a different script. You may use relative or absolut...
Adding HTML Elements - Archive of obsolete content
on has been left out for simplicity. A dialog with a check box Example 2 : Source View <html:p> Click the box below to remember this decision. <html:p> <html:input id="rtd" type="checkbox"/> <html:label for="rtd">Remember This Decision</html:label> </html:p> </html:p> In this case, one p tag was used to place the text in and another was used to break apart the text into multiple lines. Text outside of HTML blocks Example 3 : Source View <html:div> Would you like to save the following documents? <html:hr/> </html:div> Expense Report 1 What I Did Last Summer <button id="yes" label="Yes"/> <button id="no" label="No"/> As can be seen in the image, the text inside the div tag was displayed but the other text (Expense Report 1 and What I Did Last Summer) was not. This ...
Adding Properties to XBL-defined Elements - Archive of obsolete content
. When set, an alert will be displayed which displays the value to assign to the property. The special variable val holds the value that the property should be assigned to. Use this to validate it or store it. The following decribes what happens in a typical case: There are two elements, one called 'banana' and the other 'orange'. They each have a custom property called 'size'. When the following line of script is executed: banana.size = orange.size; The onget script is called for the size property of the orange. The script calculates the value and returns it. The onset handler of the size property of the banana is called. This script uses the value passed in the val variable and assigns it to the size property of the banana in some manner. Note that unlike a field, a property does not ho...
Additional Install Features - Archive of obsolete content
or delete files before or after the files are installed. For example, you might want to make a backup of some files first. The following code will make a copy of the file "/bin/grep" and put it in the directory "/main". var binFolder = getFolder("file:///","bin"); var grep = getFolder(binFolder, "grep"); var mainFolder = getFolder("file:///", "main"); File.copy(grep, mainFolder); The first line will retrieve a reference to the /bin directory. The text 'file:///' is a special string which means the root of the filesystem. From there, we get the file 'grep' which is contained inside the 'bin' directory. If this file does not exist, an error will occur during the installation. Next, we get the 'main' folder, again from the file system root. Finally, we call the File.copy function whi...
Advanced Rules - Archive of obsolete content
er will repeat this for each of the four cities. A match occurs and the builder will generate content for each city that has a prediction. If the city has no prediction resource, the condition does not match and no content will be generated for that city. Note that you do not need to put 'rdf:' at the beginning of the predicate, as that part is assumed. We could also replace the object with an in-line value. For example: <conditions> <content uri="?city"/> <triple subject="?city" predicate="http://www.xulplanet.com/rdf/weather#prediction" object="Cloudy"/> </conditions> This example is similar but we specify that we want to match on 'Cloudy'. The result is that the conditions will only match for cities where the prediction is 'Cloudy'. We can add more triples to ...
Box Model Details - Archive of obsolete content
> Summary of the box model To achieve complicated layouts, you will generally need to add nested boxes, specify minimum and maximum sizes on some elements, and make certain elements flexible. The best interface is one that can be displayed at various sizes without problems. The box model may be difficult to understand without trying various various things out for yourself. The following is an outline of both types of boxes: Horizontal boxes Lay out their elements next to each other horizontally. Flexible elements are flexed horizontally. Packing controls their horizontal placement of child elements. Alignment controls how the row of elements are aligned vertically. Vertical boxes Lay out their elements vertically in a column. Flexible elements are flexed vertically. Packing c...
Box Objects - Archive of obsolete content
ntent tree stores the nodes as they are found in the source code. The layout tree holds a different tree of nodes for each individual component that can be displayed. The layout tree holds the structure as the nodes are expected to be displayed There is not necessarily a one to one relationship between content and layout nodes. Some content nodes may have several layout objects, for example, each line of a paragraph has a separate layout object. Conversely, some content nodes have no layout objects at all. For instance, the key element doesn't have any layout objects since it isn't displayed in any way. Similarly, any element that has been hidden will not have a layout object either. The DOM is generally used only to get and modify information pertaining to the content or structure of the docu...
Creating an Installer - Archive of obsolete content
components. The second argument is a result code. If the result is 0, the installation completed successfully. If the result is non-zero, an error occured and the value is an error code. The function doneFn() here just displays an alert box to the user. Next, we create an array xpi which will hold the name (Calendar) and URL (calendar.xpi) of the installer. You can add an additional similar such line for each package you wish to have installed. Finally, we call the install function. When this section of script is executed, the file calendar.xpi will be installed. Our find files example Let's try this with the find files dialog. function doneFn ( name , result ){ if (result) alert("An error occured: " + result); } var xpi = new Object(); xpi["Find Files"] = "findfile.xpi"; InstallTrigg...
Cross Package Overlays - Archive of obsolete content
ontent/navigator.xul"/> </RDF:Seq> This declares that we are adding a overlay window, a child of the root overlay node (urn:mozilla:overlays). You can add additional nodes for any other windows that you want to apply overlays to by adding additional li nodes. Next, we add a node for each overlay to apply to the window. In this case, we only have one, but we could apply others also. Add these lines just after the previous lines. <RDF:Seq about="chrome://navigator/content/navigator.xul"> <RDF:li>chrome://findfile/content/foverlay.xul</RDF:li> </RDF:Seq> Mozilla reads this information and builds a list of overlays that are applied to other windows. It stores this information in the chrome/overlayinfo directory. You do not need to manually modify the files in this directory. It is a...
Custom Tree Views - Archive of obsolete content
uld have more complex data in each cell. The final step is to associate the view object with the tree. The tree has a property view, which can be assigned to the view object declared above. We can assign a value to this property at any time to set or change the view. function setView(){ document.getElementById('my-tree').view = treeView; } The following presents the example together. An inline script has been used here to simplify the example. Normally, you would put the script in an external script file. Example custom tree Source <?xml version="1.0"?> <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> <window title="Tree Example" id="tree-window" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" onload="setView();"> <script> //Moz 1.8 var...
Focus and Selection - Archive of obsolete content
e fifth character displayed, as well as the sixth, seventh and eighth. If there were only six characters entered into the field, only the fifth and sixth characters would be selected. No error would occur. If you use the same value for both parameters, the start and end of the selection changes to the same position. This results in changing the cursor position within the textbox. For example, the line below can be used to move the cursor to the beginning of the text. tbox.setSelectionRange(0,0); You can retrieve the current selection by using the selectionStart and selectionEnd properties. These properties are set to the starting and ending positions of the current selection respectively. If both are set to the same value no text is selected, and the cursor is moved to that position. Once you...
More Menu Features - Archive of obsolete content
es-toolbar> Here we have added two menus with various commands on them. Notice how the menu bar was added inside the toolbox. The three dots after Open Search and Save Search are the usual way that you indicate to the user that a dialog will open when selecting the command. Access keys have been added for each menu and menu item. You will see in the image that this letter has been underlined in the menu label. Also, the Paste command has been disabled. We'll assume that there's nothing to paste. Our Find files example so far : Source View Adding Checkmarks to Menus Many applications have menu items that have checks on them. For example, a feature that is enabled has a check placed beside the command and a feature that is disabled has no check. When the user selects the menu, the ...
More Tree Features - Archive of obsolete content
ach item in the tree has a level starting at 0. The topmost items in the tree will have a level of 0, the children of those items will have a level of 1, the children below that will have a level of 2, and so on. The tree will query the view for the level of each item in order to determine how to draw the rows. The tree will draw the open and close icons to open and close a parent item as well as lines connecting the children to their parents. The tree will also handle drawing the rows with the right level of indenting. However, the view will need to make sure it keeps track of the level of the rows as necessary. This can sometimes be quite tricky, but fortunately, the built-in content tree view does all of the hard work for us. To create a set of nested rows, all we need to do is add a second...
Open and Save Dialogs - Archive of obsolete content
text files and for all files. The user therefore has the option to display text files only or all files. You can also use filterXML and filterXUL to filter for XML and XUL files respectively. If you would like to filter for custom files, you can use the appendFilter() function to do this: fp.appendFilter("All Files" ,"*.*"); fp.appendFilter("Audio Files (*.wav, *.mp3)","*.wav; *.mp3"); This line will add a filter for Wave and MP3 audio files. The first argument is the title of the file type and the second is a semicolon-seperated list of file masks. You can add more masks or fewer masks as needed. You can call appendFilter as many times as necessary to add additional filters. The order you add them determines their priority. Typically, the first one added is selected by default. Getting...
Progress Meters - Archive of obsolete content
value has been set to 50% so that we can see the meter on the window. A margin has been set to 4 pixels so that it is separated from the edge of the window. As was stated earlier, we only want the progress bar to be displayed while the search was occurring. A script will show and hide it as necessary. To make this work you will first have to define the namespace html. Do this by adding the below line to your opening window tag in the findfile.xul. xmlns:html="http://www.w3.org/1999/xhtml" The example so far. Source View In the next section, we will learn how to add additional elements to the window using HTML. << PreviousNext >> ...
Property Files - Archive of obsolete content
in the file are declared with the syntax name=value. An example is shown below: notFoundAlert=No files were found matching the criteria. deleteAlert=Click OK to have all your files deleted. resultMessage=%2$S files found in the %1$S directory. Here, the property file contains three properties. These would be read by a script and displayed to the user. A property file can also include comments. A line that begins with a hash sign ('#') is treated as a comment: # This is a comment welcomeMessage=Hello, world! # This is another comment goodbyeMessage=Come back soon! Stringbundles You could write the code to read properties yourself, however XUL provides the stringbundle element which does this for you. The element has a number of functions which can be used to get strings from the property file...
Scroll Bars - Archive of obsolete content
value is 1. pageincrement The value here specifies how much the value of curpos changes by when the user clicks pages through the scroll bar, which can be done by clicking on the tray between the box and the arrows. The default value is 10. The example given in the syntax above will create a scroll bar that can range from a value of 0 to 100. The value 100 might be the number of lines in a list, but it could be anything you want. The initial value in this example is 20. When clicking on one of the scroll bar arrows, the value would change by 1 either up or down. By paging through the scroll bar, the value will change by 10. When the user clicks the scroll bar arrows, the thumb will move by the amount specified by the value increment. Increasing the value of this attribute wil...
Stacks and Decks - Archive of obsolete content
o the right and down by adding a padding to its left and top sides. This has the result of drawing the same text 'Shadowed' again but slightly offset from the other. The second description element is drawn in red so the effect is more visible. This method has advantages over using text-shadow because you could completely style the shadow apart from the main text. It could have its own font, underline or size. (You could even make the shadow blink). It is also useful as Mozilla doesn't currently support CSS text shadowing. A disadvantage is that the area taken up by the shadow makes the size of the stack larger. Shadowing is very useful for creating the disabled appearance of buttons: Example 2 : Source View <stack style="background-color: #C0C0C0"> <description value="Disabled" style="col...
Styling a Tree - Archive of obsolete content
::-moz-tree-twisty: the appearance of the twisty used to expand and collapse child rows. ::-moz-tree-image: the image for a cell. You can set the image with the list-style-image property. ::-moz-tree-row: a row. Use this to set the background color of a row. ::-moz-tree-indentation: the indentation to the left of rows that are children of other rows. ::-moz-tree-column: a column. ::-moz-tree-line: the lines that are drawn to connect child rows to parent rows. ::-moz-tree-separator: a separator in a tree. ::-moz-tree-progressmeter: content for progressmeter cells. You can create a progressmeter column by setting the type attribute on the column to progressmeter. ::-moz-tree-drop-feedback: the drag and drop feedback. ::-moz-tree-checkbox: the image to use for checkbox columns. You can...
XBL Example - Archive of obsolete content
last page, don't change the page and return the last page's index. The page should not change to one after the last page. thedeck.setAttribute("selectedIndex",newidx); Change the selectedIndex attribute on the deck. This causes the requested page to be displayed. document.getAnonymousNodes(this)[0].childNodes[1].childNodes[1].setAttribute("value",(newidx+1)+" of "+totalpages); This line modifies the label element so that it displays the current page index. The label element can be retrieved by getting the first element of anonymous content (the vertical box), the second child of that label element (the horizontal box), and then the second element of that box. The value attribute is changed to read '1 of 3' or something similar. Note that one is added to the index because indicie...
XPCOM Examples - Archive of obsolete content
f (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. The first two lines of getCookies() get the menulist and remove all of the existing items in the menu. This is done because getCookies() is called every time the menu is opened and we don't want to leave the old items there each time. Next, the cookie manager is retrieved. The cookie manager has an enumerator method which returns an object which implements nsISimpleEnumerator. This can be used to iterate over all o...
Using Visual Studio as your XUL IDE - Archive of obsolete content
are still some problems for which I did not find a solution yet. 5.1 Localization using DTD You will get validation errors in Visual Studio, if you are localizing your XUL files. That has to do with the way Mozilla implemented localization: < !DOCTYPE window SYSTEM "chrome://loomo/locale/main.dtd"> Visual Studio doesn't recognize the chrome URI prefix, what will give you an error at the previous line ("The URI prefix is not recognized"). As VS doesn't know how the chrome protocol works it can't detect where the dtd file is really located and thus will give you errors wherever you use the entities that are declared in this file. 5.2 Text preprocessor The Mozilla Build System includes a Text preprocessor. As preprocessor directives are not valid XML, Visual Studio will mark them as errors in yo...
Using the standard theme - Archive of obsolete content
ng, some internal default will be applied, which does by no means correspond to the standard theme (the theme currently chosen by the user in the Theme Selector), or even the default theme delivered with your the base application. Applying the standard theme In order to use the theme currently chosen by the user of the base application (the so called "Global Skin"), you have to add the following line to your XUL file: <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> This imports the styles found in the <tt>global/skin</tt> chrome directory and will make the standard XUL widgets of your application use the selected chosen theme. You do not have to specify a specific file; Mozilla will determine by its own which files in the directory it needs to use. If you are only going to u...
XUL Parser in Python/source - Archive of obsolete content
class XULParser(xmllib.XMLParser): def unknown_starttag(self, t, a): name = strip(t) if name not in el_list: el_list[name] = {} for attr,val in a.items(): el_list[name][strip(attr)] = strip(val) def syntax_error(self, message): pass p = XULParser() cmd = 'dir /s /b *.xul' CHROME_DIR = 'C:\Program Files\Netscape\Netscape 6\chrome' os.chdir(CHROME_DIR) files = os.popen(cmd).readlines() for file in files: file = file.strip() print '** ' + file + ' **' data = open(file).read() p.feed(data) w.write('<html><h3>Periodic Table of XUL Elements</h3>') w.write('<table><style>.head {font-weight: bold; background-color: lightgrey;}</style>') elements = el_list.keys() elements.sort() for item in elements: w.write('<tr><td class="head">' + item + '</td></tr>\n') for a in el_list[...
XUL Template Primer - Bindings - Archive of obsolete content
<label>'s value attribute (which should contain the value of ?street) is just left blank. Related Documents XUL Template Primer XUL template basics. XUL Template Primer - Multiple Rules Illustrates how to write templates with multiple <rule> elements. XUL Template Primer - Nested Content Illustrates how a template can be used recursively to build nested content. XUL Template Primer - Outliner Illustrates how a template can be used as a view for a XUL outliner. XUL Template Reference Describes the simple XUL template syntax in detail. Notes 1. As of this writing, it is necessary to order <binding> elements carefully. Specifically, if a binding depends on a variable in another binding, it must appear after the binding it depends on. For example, the sample in this document wouldn...
XUL and RDF - Archive of obsolete content
ject ModelPurpose - The purpose of this document is two-fold. The first section of the document describes the motivation and reasoning behind using RDF as the foundation of XUL. This section makes a technical argument both for having XUL in the first place and for using RDF as the underlying implementation of XUL's content model. The second section describes the XUL/RDF architecture itself and outlines enhancements to the XUL language in order to allow the markup language to reference local data and to indicate how and when it would like to be annotatable with local data. ...
XUL controls - Archive of obsolete content
user to adjust the division of space between elements. <splitter collapse="before"> <grippy/> </splitter> Splitter Reference Related Elements: grippy <tab> Description goes here. <tab label="firefox"/> Tab Reference Related Elements: tabs tabbox tabpanels <textbox> A textbox which allows a single line of text to be entered. <textbox value="firefox"/> More information about the textbox element. Textbox Reference <textbox multiline="true"> A textbox which allows multiple lines of text to be entered. <textbox multiline="true"/> More information about the multiple line textbox element. Textbox Reference <...
XUL Event Propagation - Archive of obsolete content
lement that wants to capture events taking place below it. Any XUL element may use the DOM addEventListener method to register itself to capture events. The syntax for this in XUL is as follows: element = document.getElementById("id of the element"); element.addEventListener(event name, event handler function, whether to register a capturing listener); The event handler code argument can be in-line code or a function. The last boolean parameter specifies whether the event listener wants to use event capturing, or be registered to listen for events that bubble up the hiearchy normally. Note: The DOM provides the addEventListener method for creating event listeners on nodes that do not otherwise supply them. But in XUL, almost every element includes an "oncommand" event listener attribute fo...
arrowscrollbox - Archive of obsolete content
s horizontal arrowscrollboxes only. tabIndex Type: integer Gets and sets the value of the tabindex attribute. Methods ensureElementIsVisible( element ) Return type: no return value If the specified element is not currently visible to the user, the displayed items are scrolled so that it is. If the item is already visible, no scrolling occurs. scrollByIndex( lines ) Return type: no return value Scrolls the contents of the arrowscrollbox by a certain number of lines. A line is a single element. Use a positive value as the lines argument to scroll forward that many lines, or a negative value to scroll backward that many lines. scrollByPixels( pixels ) Return type: no return value Scrolls the contents of the arrowscrollbo...
attribute.align - Archive of obsolete content
size of the children, the extra space is placed on the right or bottom side. center Extra space is split equally along each side of the child elements, resulting the children being placed in the center of the box. end Child elements are placed on the right or bottom edge of the box. If the box is larger than the total size of the children, the extra space is placed on the left or top side. baseline This value applies to horizontally oriented boxes only. It causes the child elements to be aligned so that their text labels are lined up. stretch The child elements are stretched to fit the size of the box. For a horizontal box, the children are stretched to be the height of the box. For a vertical box, the children are stretched to be the width of the box. If the size of the box changes, the c...
bbox - Archive of obsolete content
Archive › Mozilla › XUL › bbox
<< XUL Reference home [ Examples | Attributes | Properties | Methods | Related ] A horizontal box that is baseline aligned. It is equivalent to using an hbox element with an align attribute set to baseline. Examples (example needed) Attributes Inherited from XUL element align, allowevents, allownegativeassertions, class, coalesceduplicatearcs, collapsed, container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minheight, minwidth, mousethrough, observes, ordinal, orient, pack, persist, popup, position, preference-editable, querytype, ref, removeelement, sortDirection, sortResource, sortResource2, statustext, style, template, tooltip, tooltiptext, top...
description - Archive of obsolete content
<< XUL Reference home [ Examples | Attributes | Properties | Methods | Related ] This element is used to create a block of text. The text can be set either with the value attribute or by placing text inside the open and close description tags. The value attribute is used to set text that appears in a single line. If text appears as a child of the description, it will wrap to multiple lines. It may contain arbitrary markup, which can be styled as needed. More information is available in the XUL tutorial. Attributes crop, disabled, tabindex value Properties accessibleType, crop, disabled, tabIndex, value Style classes header, indent, monospace, plain, small-margin Examples This is a long section of text that will word wrap when displayed <description> This ...
label - Archive of obsolete content
Archive › Mozilla › XUL › label
isplayed in a monospace font. plain This class causes the element to be displayed with no border or margin. small-margin This class causes the text to be displayed with a smaller margin. text-link Labels with this class may be focused and the click handler run or the address in the href attribute opened on a mouse click or Enter key press. Labels will appear like a link (blue and underlined). Related Elements description Attributes label Interfaces nsIAccessibleProvider, nsIDOMXULLabelElement Notes Labels are not focusable Note: Starting in Gecko 2.0, labels are properly not focusable. They used to incorrectly inherit from nsIDOMXULControlElement. The caption is in the "value" attribute Remember that the label element has a "value" attribute, unlike va...
menuseparator - Archive of obsolete content
More information is available in the XUL tutorial. ...
resizer - Archive of obsolete content
" style="background: black; -moz-appearance: none;" element="button" right="0" bottom="0" width="16" height="16"/> </stack> Attributes dir Type: one of the values below The direction that the window is resized. left Resized to the left. right Resized to the right. top Resized up. bottom Resized down. bottomstart Resized down and toward the start of the line (toward the left for left-to-right locales, toward the right for right-to-left locales). bottomend Resized down and toward the end of the line (toward the right for left-to-right locales, toward the left for right-to-left locales). bottomleft Resized down and to the left. bottomright Resized down and to the right. topleft Resized up and to the left. topright Resized up and...
script - Archive of obsolete content
More information is available in the XUL tutorial. ...
<statusbarpanel> - Archive of obsolete content
ethods | Related ] Firefox 4 note The status bar has been removed. Refer to the add-on bar. An individual element of a statusbar. This is a special type of button which is drawn differently. Unlike normal buttons, a statusbarpanel can only have a label or an image but not both. This element is often used with a short label or icon to indicate status, for instance whether the user is online or whether there are new messages. Attributes crop, image, label Properties image, label Style classes statusbarpanel-iconic, statusbarpanel-iconic-text, statusbarpanel-menu-iconic Examples <statusbar> <statusbarpanel label="Left panel"/> <spacer flex="1"/> <progressmeter mode="determined" value="82"/> <statusbarpanel label="Right panel"/> </statusbar> Attributes cro...
stringbundle - Archive of obsolete content
The key and value is separated with an equals sign. ...
toolbarbutton - Archive of obsolete content
<< XUL Reference home [ Examples | Attributes | Properties | Methods | Related ] A button that appears on a toolbar. It is equivalent to a regular button except that it may be rendered differently. Typically, it is expected to have an image. More information is available in the XUL tutorial. Relevant accessbility guidelines All toolbar functionality should be duplicated elsewhere in the application Where possible, provide keyboard alternatives. Where possible, duplicate functionality in a menu item or context menu. Where not possible, make all toolbarbuttons focusable by -moz-user-focus: normal. Attributes accesskey, autocheck, checkState, checked, command, crop, dir, disabled, dlgtype, gr...
toolbox - Archive of obsolete content
rwindow" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" title="toolbox example" width="300"> <toolbox> <toolbar> <toolbarbutton label="Back"/> <toolbarbutton label="Forward"/> <toolbarbutton label="Home"/> </toolbar> <toolbar> <toolbarbutton label="Stop"/> <toolbarbutton label="Reload"/> </toolbar> </toolbox> <textbox multiline="true" value="We have two toolbars inside of one toolbox above." width="20"/> </window> Attributes Inherited from XUL element align, allowevents, allownegativeassertions, class, coalesceduplicatearcs, collapsed, container, containment, context, contextmenu, datasources, dir, empty, equalsize, flags, flex, height, hidden, id, insertafter, insertbefore, left, maxheight, maxwidth, menu, minhe...
XUL - Archive of obsolete content
for instructions on running XULRunner apps in Firefox. View All... Community View Mozilla forums... ...
Application Update - Archive of obsolete content
sionInfo // updates available to installed addons that resolve them, not newer // versions. pref("app.update.incompatible.mode", 0); Update Server Follow the instructions here to setup an update server for your XULRunner application to query. I opted for the simpler approach of not using the update php script. HTTPS is recommended but not required (yet). update.xml The format is outlined here Process As best I can tell here's how the update process works. At the scheduled interval the application checks the update server for update.xml, search for the correct one using the Software name, versions, build id's, channels, and other information like locales. If the update.xml file doesn't exist there is no update. Update.xml contains only information about the update. I...
Building XULRunner - Archive of obsolete content
nfiguration. On Mac, XULRunner requires Mac OS X 10.3 or higher and XCode 1.5 or higher to build properly. The runtime requirement is Mac OS X 10.2. A basic minimal mozconfig which will build a release configuration of XULRunner is: mk_add_options MOZ_CO_PROJECT=xulrunner mk_add_options MOZ_OBJDIR=@topsrcdir@/obj-xulrunner ac_add_options --enable-application=xulrunner #Uncomment the following line if you don't want to build JavaXPCOM: #ac_add_options --disable-javaxpcom CVS tags and XULRunner versions Older XULRunner releases where tagged in CVS with (for instance XULRUNNER_1_8_0_5_RELEASE ) up to version 1.8.0.5 The CVS repository does not have specific tags for XULRunner anymore. Instead a XULRunner build is a just special build made from the Firefox/Mozilla tree, using the same tag ...
Creating XULRunner Apps with the Mozilla Build System - Archive of obsolete content
lly compensating you for all that extra work you put in just now. See, it all balances out in the end! Building with a prebuilt SDK Once you've downloaded the XULRunner SDK, you'll need a .mozconfig of your own. Here's an example for McCoy: # Options for client.mk. mk_add_options MOZ_CO_PROJECTS=browser mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/../mccoybase # Options for 'configure' (same as command-line options). ac_add_options --with-libxul-sdk=/path/to/xulrunner-sdk ac_add_options --enable-application=mccoy You still need to get the Mozilla Source Code and put your project in a subdirectory underneath the mozilla root. Of course, you only really need the Mozilla build system since all the other Mozilla files are in the XULRunner SDK, and there is a bug filed to make it possible to check out t...
Debugging a XULRunner Application - Archive of obsolete content
?location=chrome%3A%2F%2Fvenkman%2Fcontent%2Fvenkman-overlay.js&instance=12 may not load or link to chrome://venkman/skin/venkman-source.css. Note the "New in Firefox 3" attribute "contentaccessible" on https://developer.mozilla.org/En/Chrome_Registration so as per http://markmail.org/message/ezbomhkw3bgqjllv#query:x-jsd+page:1+mid:xvlr7odilbyhn6v7+state:results change the manifest to have this line: content venkman jar:venkman.jar!/content/venkman/ contentaccessible=yes I get errors about not being able to open contentAreaUtils.js, contentAreaDD.js, findUtils.js, or contentAreaUtils.js... Inspired by http://article.gmane.org/gmane.comp.mozilla.devel.jsdebugger/859 I extracted venkman.jar, opened venkman\content\venkman\venkman-scripts.xul and changed: @@ -54,11 +54,11 @@ <script s...
Deploying XULRunner - Archive of obsolete content
could perform the check and register the appropriate version if necessary. After that, the app could be installed to the registered XULRunner and appear in start menus, lists of installed programs, etc. (Bonus points for checking the operating system and downloading the right XULRunner on the fly, or bundling them into your installer). Registration and app installation are performed with command line switches as outlined in the XULRunner section of article Command Line Options. It may turn out to be easier to create a self contained portable application, as described here, and deploy it with a generic installer that would create shortcuts to scripts that launch your application in the unregistered bundled XULRunner. The responsibility still lies with the developer to provide the correct vers...
How to enable locale switching in a XULRunner application - Archive of obsolete content
ho have localised their XUL application using DTD entity files and want to provide their users with a mechanism to switch the locale in the application itself. Normally the application locale is inherited from the OS environment of the host system, however there are situations when you might want to give users the option to override the default setting and choose a different locale. Here is an outline of the solution: 1. Modify the application preferences First, you need to tell XULRunner that your application wishes to ignore the default OS locale and that it will do its own choosing instead. Edit the application preferences file and set "intl.locale.matchOS" to false. Your application is now going to ignore the OS locale, so it would be a good idea to define one to fall back on using the pre...
Using LDAP XPCOM with XULRunner - Archive of obsolete content
This will create a new file in the components subdirectory of the built package, mozldap_stub.dll (on Windows) or libmozldap_stub.so (on Linux). Copy mozldap.xpt and mozldap_stub.dll into your components XUL app subdirectory. Create a libraries subdirectory in your XUL app directory, and copy mozldap.dll (or libmozldap.so), and the...
Make your xulrunner app match the system locale - Archive of obsolete content
ge of xpcom and will be written for someone using python, but the ideas should be adaptable. Also, this may not be the proper way to do this and it may not work for you in all cases. Please update if there are more correct ways to do this. The first step is to get the code we're about to write to run before any of the locale specific resources are loaded. Democracy does this by creating a command line handler called DemocracyCLH, and then creating a new object of our PyBridge component. The code described lives in the PyBridge component's onStartup method which gets called automatically. The second step is to figure out the system locale. To be finished later. Then set the locale preference. The following is python code to set this preference. from xpcom import components ps_cls = components.
XUL Explorer - Archive of obsolete content
It has a list of code snippets (small fragments of XUL or JavaScript) that can be quickly inserted into the editor. The XUL can be loaded from and saved to files. A XUL validator and the Error Console are both available to help debug problems. The help menu provides access to XUL information on MDC. There is even simple "keyword" help lookup for XUL elements. Roadmap Features: The preview pane can be toggled with the editor. Previewing in a popup window is still available. ...
Mozrunner - Archive of obsolete content
This documentation is no longer maintained. For more information about mozrunner as part of the mozbase project, please see the mozbase project page. mozrunner is a python package which handles running of Mozilla applications. mozrunner utilizes mozprofile for managing application profiles and mozprocess for robust process control. mozrunner may be used from the command line or programmatically as an API. Command Line Usage The mozrunner command will launch the application (specified by --app) from a binary specified with -b or as located on the PATH. mozrunner takes the command line options from mozprofile for constructing the profile to be used by the application. Run mozrunner --help for detailed information on the command line program. API Usage mozrunner features a base class,...
Format - Archive of obsolete content
the release triage team will no longer be accepting bugs unless they meet one of the posted criteria. Criteria are included in the linked post. Firefox 1.5.0.5 planned release - 2006/07/26 Discussions Firefox survey feedback requested Rachel Werner (Mozilla Corp marketing intern) requested feedback on a proposed user survey. The survey questions and feedback are included in the thread. Deadline for feedback has passed. Dropping bugs from blocking1.8.1+ David Baron suggested a list of bugs that could be dropped from the blocking list. View bugzilla list. Meetings Mozilla Project weekly status meeting - 2006/07/24 1:00p PDT (Last meeting notes) Firefox 2 (Bon Echo) status meeting - 2006/07/25 11:00a PDT (Last meeting notes) Firefox 3 (Gran Paradiso) status meeting - 2006/07/26 1...
2006-10-06 - Archive of obsolete content
Summary: mozilla.dev.accessibility - Oct 6, 2006 Announcements Legal Precedent Set for Web Accessibility US Federal court rules that retailers may be sued if its website is inaccsessible. Read more... Discussions W3C Sets Road Map for Web App Accessibility The W3C introduced its WAI-ARIA (Web Accessibility Initiative for Accessible Rich Internet Applications) roadmap--a set of guidelines for developers to make accessible web content. This set of documents tackles some of the difficulties that AJAX has been causing with regards to accessibility. Read more... Other links of interest: Roadmap for Accessible Rich Internet Applications (WAI-ARIA Roadmap) Roles for Accessible Rich Internet Applications (WAI-ARIA Roles) States and Properties Module for Accessible Rich Internet Applicat...
2006-11-17 - Archive of obsolete content
06 Announcements None this week. Discussions mozilla access to http? to Snipurl? User is looking for advice how to access HTTP or Snipurl. No replies as of yet. Firefox 2.0 - window.focus() User questions where the change in behaviour in window.focus() is a bug or was intented. Firefox 2.0 JavaScript Popup Issue User seeks advice about a line of JavaScript code that worked in Firefox 1.5.0.x, but not in Firefox 2.0 Balloon Help User inquires if anyone can explain how to disable the balloon help in Firefox 2.0. Two questions: (1) launching a separate intance of firefox.exe, and (2) programmatically closing a window User has two questions about using Adobe Flex Builder Debugger in FireFox 2.0. ...
2006-11-10 - Archive of obsolete content
h mozilla November 8th: Kirans is trying to build Mozilla with XULRunner option on a windows machine. When he ran this "make -f client.mk build" command he receive an error saying "No such file or directory". He stated that he set is HOME variable to C:\mozilla, and is not sure what he is doing wrong. November 9th: Jonathan Watt responded to his posting stating that he must have the wrong line endings in his mozconfig or some other script fill that he is probably using to run. Build Problem Firefox 2.0 on FC3 November 10th: Vin downloaded the latest Firefox 2 RC3 and tried to build it on FC3 with the following options: ./configure --enable-application=browser --prefix=$PREFIX --enable-extensions=default,spatialnavigation Then he tried running "make" and received the following ...
2006-12-01 - Archive of obsolete content
Summary: mozilla.dev.builds - November 25th to December 1st 2006 Any one else seeing this? November 27th: Rinaldi J. Montessi posted a link to a bug that he himself added to bugzilla. Announcements Automatic configure updated back On November 27th J. Paul Reed announced that: The server which performs the automatic autoconf/configure generation is back online. J. Paul Reed has also requested that if any problems are encountered he should be contacted via irc in #build @ irc.mozilla.org. Meetings There were no meetings this week. Summarized By: Vanessa Miranda & Mohammad Tirtashi ...
2006-10-06 - Archive of obsolete content
FFx 2 RC2 testing today L10n builds were completed was completed and ready for test. test resumt will be found here Another Lightning localization update with some bad news Difference has been located between SUNBIRD_0_3_BRANCH (for Sunbird 0.3) and MOZILLA_1_8_BRANCH. ...
2006-10-20 - Archive of obsolete content
ere are issues or questions, contact mozilla.dev.builds. Firefox RC 3 is there, staging servers, too Firefox RC3 build is located here. Community was encouraged to do testing. Discussions how to file a legal approval for a dictionary? Discussion about how to file a legal approval for a dictionary. there is no xpi file Instructions on how to find xpi files. Meetings Sign Off deadline is this Thursday There was a status meeting on Tuesday, October 17, 2006. Sign off deadline was on Thursday, October 19, 2006. Meeting minutes is located here. Authors Paul Yanchun Gu (gpaul) Aditya Nanda Kuswanto(vipers101) ...
2006-11-3 - Archive of obsolete content
Check thread for complete details. MozillaTranslator 5.13 released MozillaTranslator 5.13 is available here. Opening l10n repository on MOZILLA_1_8_BRANCH for approved check-ins MOZILLA_1_8_BRANCH is opened for approved check-ins. Check-ins are limited to bug fixes filed in Bugzilla and should mention their bug, describe the change, and who approved the change. ...
2006-07-17 - Archive of obsolete content
the release triage team will no longer be accepting bugs unless they meet one of the posted criteria. Criteria are included in the linked post. Firefox 1.5.0.5 planned release - 2006/07/26 Discussions Firefox survey feedback requested Rachel Werner (Mozilla Corp marketing intern) requested feedback on a proposed user survey. The survey questions and feedback are included in the thread. Deadline for feedback has passed. Dropping bugs from blocking1.8.1+ David Baron suggested a list of bugs that could be dropped from the blocking list. View bugzilla list. Meetings Mozilla Project weekly status meeting - 2006/07/24 1:00p PDT (Last meeting notes) Firefox 2 (Bon Echo) status meeting - 2006/07/25 11:00a PDT (Last meeting notes) Firefox 3 (Gran Paradiso) status meeting - 2006/07/26 1...
2006-09-29 - Archive of obsolete content
Summary of newsgroup moz.dev.platform Summary: mozilla.dev.platform - September 22 - 29, 2006 Announcements Firefox 2 Release Candidate 1 is now available for download Announcing that Firefox 2 RC 1 is available for Download Discussions Xulrunner fails without feedback on OSX Intel 10.4.7 Will Morton is trying to port a XUL application to OSX. When he runs xulrunner from the command line, it fails silently without any errors. This happens with all his xulrunner ports, with xulrunner 1.8.0.1, 1.8.0.4 and nightly 1.8. Benjamin Smedberg was able to point out one possible flaw. Instead of using /path/to/xulrunner-bin.ini (which Will was doing) applications on a mac must be in an application bundle (Foo.app). Then use xulrunner -install-app to "unpack" the XUL app into the Mac structu...
2006-10-20 - Archive of obsolete content
eS noticed that mp3 files are no longer allowed to be opened directly from email attachments in trunk builds of Thunderbird and Seamonkey. They must be first saved to the drive. --------------010306060708080008030904 Content-Type: audio/mpeg; name="Eternals - Babalus's Wedding DayFinal.mp3" Content-Transfer-Encoding: base64 Content-ID: <part1.00030607.05030...@gmail.com> Content-Disposition: inline; filename="Eternals - Babalus's Wedding DayFinal.mp3" He wonders why this is. Meetings None during this week. ...
2006-11-24 - Archive of obsolete content
Summary: mozilla.dev.tech.layout - November 17 - November 24, 2006 Announcements None this week. Discussions backed out view manager hierarchy unification Discussion aboutthe view manager hierarchy unification and the problems with TP regressions that occuring whenever update batching interacts it. See BigID 360789 New linebreaker interface New linebreaker current interface is unworkable when it comes to using Thai and UAX#14. Meetings None this week. ...
NPN_GetURL - Archive of obsolete content
anywhere on the network. This is especially useful for enabling an existing application to operate on the web. For HTTP URLs, the browser resolves this method as the HTTP server method GET, which requests URL objects. Use NPN_GetURLNotify() instead of NPN_GetURL() in these cases: To request a stream and receive notification of the result. If the buffer contains header information (even a blank line). Make sure that the target matches the URL type sent to it. For example, a null target does not make sense for some URL types (such as mailto). The following recommendations about target choice apply to other methods that handle URLs as well. If the target parameter refers to the window or frame containing the current plug-in instance, the instance is destroyed and the plug-in may be unloaded. ...
NPStream - Archive of obsolete content
to NPN_GetURLNotify or NPN_PostURLNotify. For other streams, notifyData is null. headers The response headers from the host. This field is only available if the NP version is greater than or equal to NPVERS_HAS_RESPONSE_HEADERS. This field is used only for HTTP and is null for other types of streams. The plug-in should copy this data before making use of it. The headers include the HTTP status line and all headers, verbatim as received from the server. Lines are terminated by newline characters ("\n"), and the headers are terminated by a newline followed by null ("\n\0"). Description The browser allocates and initializes the NPStream object and passes it to the plug-in in as a parameter to NPP_NewStream or NPN_NewStream. The browser cannot delete the object until after it calls NPP_Destroy...
NPAPI plugin reference - Archive of obsolete content
ion controlled by the plugin. NPN_SetValueForURL Allows a plugin to change the stored information associated with a URL, in particular its cookies. (While the API theoretically allows the preferred proxy for a given URL to be changed, doing so does not have much meaning given how proxies are configured, and is not supported.) NPN_Status Lets a plug-in display a message on the browser's status line. NPN_UserAgent Returns the browser's user agent field. This can be used to handle variations in different browsers (or versions thereof) when implementing your plug-in. NPN_UTF8FromIdentifier Returns the UTF-8 string corresponding to the given string identifier. NPN_Version Lets plugins obtain version information, both of the plug-in API and of the browser itself. NPN_Write Pushes data in...
Plugins - Archive of obsolete content
r enhance the functionality of the browser itself. Plugins are also different from search plugins, which plug additional search engines in the search bar. Gecko Plugin API Reference (NPAPI) This reference describes the application programming interfaces for NPAPI plugins and provides information about how to use these interfaces. Site Author Guide For Click-To-Activate Plugins These guidelines will help website authors use plugins when they are blocked by default with the Firefox click-to-activate feature. Scripting plugins (npruntime) This reference describes the new cross-browser NPAPI extensions that let plugins be scriptable and also let them access the script objects in the browser. Shipping a plugin as a Toolkit bundle Plugins can be shipped as a Toolkit bundle, allowi...
Introduction to Public-Key Cryptography - Archive of obsolete content
here. Certificate Data Formats Certificate requests and certificates can be created, stored, and installed in multiple formats: binary and text. All of these formats conform to X.509 standards. Three examples of binary formats are DER-encoded certificates, PKCS #7 certificate chains, and Netscape Certificate Sequence. Any of the binary formats can be imported in text form, which begins with the line: -----BEGIN CERTIFICATE----- Following this line is the certificate data, which can be in any of the binary formats described. This data should be base-64 encoded, as described by RFC 1113. The certificate information is followed by this line: -----END CERTIFICATE----- Distinguished Names An X.509 v3 certificate binds a distinguished name (DN) to a public key. A DN is a series of name-value ...
TCP/IP Security - Archive of obsolete content
t it. The most common use for transport layer protocols is securing HTTP traffic; the Transport Layer Security (TLS) protocol is usually used for this. (TLS is the standards-based version of SSL version 3. More information on TLS is available in RFC 4346, The TLS Protocol Version 1.1, available at https://www.ietf.org/rfc/rfc4346.txt. ...
Threats - Archive of obsolete content
attacks often comes in form of instant messages or phishing emails which appear to be legitimate but they are used to obtain personal information. For example, a mail which appears to be to be sent from a bank, asking to verify your identity by giving away your private information. DDOS Network attack. The volume and strength of DDoS attacks are growing as hackers try to bring organizations offline or steal their data by flooding websites and networks with spurious traffic. Original Document Information Author(s): Ella Deon Lackey Last Updated Date: 2012 Copyright Information: (C) 2012 Red Hat, Inc. Link: Red Hat Certificate System Common Criteria Certification 8.1: Deployment, Planning, and Installation Original Document Information Author(s): Joint Task Force Transformatio...
Tamarin Tracing Build Documentation - Archive of obsolete content
y of the Tamarin repository: $ hg clone http://hg.mozilla.org/tamarin-tracing tamarin-tracing Building Tamarin Building Tamarin will create all the libraries for the AVMPlus and garbage collector (MMgc), and create a standalone executable, avmshell, for executing files in the ABC file format. Running avmshell without any arguments will list the available options. Note that additional command-line arguments are only available in the debug configuration. The Tamarin codebase contains a cross-platform build system for Mozilla developers. The cross-platform build system is used for daily automated build testing so it is the most reliable system. The Tamarin codebase has the ability to build additional code which supports debugging hooks. In the XCode project, this is the Debug_Debugger and Re...
Creating a Skin for Firefox - Archive of obsolete content
Author(s): Neil Marshall and Tucker Lee Other Contributors: Brent Marshall, CDN (http://themes.mozdev.org), JP Martin, Boris Zbarsky, Asa Dotzler, WeSaySo, David James, Dan Mauch, Anders Conbere, Tim Regula (http://www.igraphics.nn.cx) Copyright Information: Copyright 2002-2003 Neil Marshall, permission given to MDC to migrate into the wiki April 2005 via email. Original Location: http://www.eightlines.com/neil/mozskin ...
Using the W3C DOM - Archive of obsolete content
initialize its CSS properties from JavaScript through the DOM. W3C DOM2 Reflection of an Element's CSS Positioning Properties The values returned by the W3C DOM2 style.left and style.top properties are strings that include the CSS unit suffix (such as "px"), whereas IE5+ ElemRef.style.pixelLeft (and the corresponding properties for top) return an integer. So, if you want to get the element's inline STYLE settings for left and top as integers, parse the integer from the string by using parseInt(). Conversely, if you want to set the element's inline STYLE settings for left and top, make sure to construct a string that includes the unit (such as "140px") by appending the unit string to the integer value. CSS 1 and CSS 2.x specifications require that non-zero values must be specified with a le...
Using Web Standards in your Web Pages - Archive of obsolete content
mmendations, tutorials and references. The other sections address DOM and DHTML coding practices which are at odds with the W3C web standards and suggest replacements. Every proposed W3C web standards replacement in this article is working without a problem in modern browsers like MSIE 7, Firefox 2, Opera 9, Safari 3, Konqueror 3.5+, Icab 4, etc. The next-to-last section, Summary of Changes, outlines all the changes described in this article. The last section offers excellent and best references for those wishing to learn more about upgrading techniques presented in this article and more for those wishing to perfect their web pages. Contents Benefits of using web standards Making your page using web standards - how to Using the W3C DOM Developing Cross Browser and Cross Platform Pages...
Browser Detection and Cross Browser Support - Archive of obsolete content
hat the use of user agent string based detection be limited to server side situations and except in those circumstances where it is absolutely required such as when details of the Gecko branch are required. There are legitimate reasons to use the user agent string (or the navigator object) to determine exactly what vendor, version or operating system is being used. Many financial sites (banks, online stock trading firms, etc) have very strict policies with respect to what browsers they support. This is due to the history of security exploits that have been discovered in older browsers. If you have the need to only allow specific versions of browsers to use your secure site, then the user agent string and the related information from the navigator object can be very useful. You can also use d...
-ms-accelerator - Archive of obsolete content
is not a keyboard shortcut. true The object is a keyboard shortcut. Formal syntax false | true Examples This example uses the -ms-accelerator attribute in a <u> element to specify that the "N" in the <label> element is a keyboard shortcut. When the option to "Hide keyboard navigation indicators until I use the Alt key" is enabled in the user's Display Properties, the "N" is not underlined until the user presses the Alt key. When Alt + N is pressed, the <input> element that defines an accesskey attribute value of "N" receives the focus. <!DOCTYPE html> <html> <head> <title>Accelerator</title> </head> <body> <label for="oName"><u style="-ms-accelerator: true; accelerator: true">N</u>ame: </label> <input type="text" id="oName" size="25" accesske...
-ms-block-progression - Archive of obsolete content
ted valueas specifiedAnimation typediscrete Syntax Values tb Default. Top-to-bottom block flow. Layout is horizontal. rl Right-to-left block flow. Layout is vertical. bt Bottom-to-top block flow. Layout is horizontal. lr Left-to-right block flow. Layout is vertical. Formal syntax tb | rl | bt | lr Specifications Not part of any specification. Remarks In vertical layout, text lines are rotated 90? clockwise. Images are not rotated, but tables are. Box layout in vertical orientations is exactly analogous to layout in the horizontal orientation: width, height, top, bottom, right, and left do not rotate with the text. Only one block progression is active at a time; these values cannot be combined. This property is based on the block-progression property of the CSS3 Text Lay...
-ms-content-zoom-chaining - Archive of obsolete content
A bounce effect is shown when the user hits a zoom limit during page manipulation. ...
-ms-content-zoom-limit-max - Archive of obsolete content
A zoom factor of 100% corresponds to no zooming. Larger values zoom in. Smaller values zoom out.Computed valueas specifiedAnimation typediscrete Syntax Values <percentage> The maximum zoom factor. Formal syntax <percentage> Specifications Not part of any specification. ...
-ms-content-zoom-limit-min - Archive of obsolete content
A zoom factor of 100% corresponds to no zooming. Larger values zoom in. Smaller values zoom out.Computed valueas specifiedAnimation typediscrete Syntax Values <percentage> The minimum zoom factor. Formal syntax <percentage> Specifications Not part of any specification. ...
-ms-content-zoom-limit - Archive of obsolete content
The -ms-content-zoom-limit CSS shorthand property is a Microsoft extension that specifies values for the -ms-content-zoom-limit-min and -ms-content-zoom-limit-max properties. Initial valueas each of the properties of the shorthand:-ms-content-zoom-limit-max: 400%-ms-content-zoom-limit-min: 100%Applies tonon-replaced block-level elements and non-replaced inline-block elementsInheritednoPercentagesas each of the properties of the shorthand:-ms-content-zoom-limit-max: The largest allowed zoom factor. A zoom factor of 100% corresponds to no zooming. Larger values zoom in. Smaller values zoom out.-ms-content-zoom-limit-min: The smallest allowed zoom factor. A zoom factor of 100% corresponds to no zooming. Larger values zoom in. Smaller values zoom out.Computed valueas each of the properties ...
-ms-content-zoom-snap-points - Archive of obsolete content
The first percentage specifies where the first snap-point will be placed. ...
-ms-content-zoom-snap-type - Archive of obsolete content
Indicates that zooming is unaffected by any defined snap-points. After the contact is picked up, the content will continue to move with inertia. ...
-ms-content-zoom-snap - Archive of obsolete content
The -ms-content-zoom-snap CSS shorthand property is a Microsoft extension that specifies values for the -ms-content-zoom-snap-type and -ms-content-zoom-snap-points properties. Initial valueas each of the properties of the shorthand:-ms-content-zoom-snap-type: none-ms-content-zoom-snap-points: snapInterval(0%, 100%)Applies tonon-replaced block-level elements and non-replaced inline-block elementsInheritednoComputed valueas each of the properties of the shorthand:-ms-content-zoom-snap-type: as specified-ms-content-zoom-snap-points: as specifiedAnimation typediscrete Syntax The -ms-content-zoom-snap shorthand property is specified as one or both of the following content zoom snap values, in order, separated by spaces. Values -ms-content-zoom-snap-type Value of the -ms-content-zoom-s...
-ms-content-zooming - Archive of obsolete content
The element is not zoomable. zoom The initial value of the top-level element. The element is zoomable. ...
-ms-overflow-style - Archive of obsolete content
Same as inherit. none Scrollbars are never displayed, although the element can still be scrolled if the element's content overflows. scrollbar "Traditional" scrollbars are displayed if the element's content overflows. ...
-ms-scroll-chaining - Archive of obsolete content
The nearest scrollable parent element begins scrolling when the user hits a scroll limit during any manipulation. No bounce effect is shown. ...
-ms-scroll-limit-x-max - Archive of obsolete content
<length> The maximum value for the scrollLeft property. Formal syntax auto | <length> Specifications Not part of any specification. ...
-ms-scroll-limit-x-min - Archive of obsolete content
If the value is negative, then 0 is used. Formal syntax <length> Specifications Not part of any specification. Remarks This property has no effect on non-scrollable elements. ...
-ms-scroll-limit-y-max - Archive of obsolete content
<length> The maximum value for the scrollTop property. Formal syntax auto | <length> Specifications Not part of any specification. ...
-ms-scroll-limit-y-min - Archive of obsolete content
If the value is negative, then 0 is used. Formal syntax <length> Specifications Not part of any specification. Remarks This property has no effect on non-scrollable elements. ...
-ms-scroll-limit - Archive of obsolete content
roperty is a Microsoft extension that specifies values for the -ms-scroll-limit-x-min, -ms-scroll-limit-y-min, -ms-scroll-limit-x-max, and -ms-scroll-limit-y-max properties. Initial valueas each of the properties of the shorthand:-ms-scroll-limit-x-min: 0-ms-scroll-limit-y-min: 0-ms-scroll-limit-x-max: auto-ms-scroll-limit-y-max: autoApplies tonon-replaced block-level elements and non-replaced inline-block elementsInheritednoComputed valueas each of the properties of the shorthand:-ms-scroll-limit-x-min: as specified-ms-scroll-limit-y-min: as specified-ms-scroll-limit-x-max: as specified-ms-scroll-limit-y-max: as specifiedAnimation typediscrete Syntax The -ms-scroll-limit property is specified as one or more of the following scroll limit values, in the order listed, separated by spaces. Va...
-ms-scroll-rails - Archive of obsolete content
This value allows for free-form panning. railed Initial value. Panning locks to the primary axis of motion. ...
-ms-scroll-snap-points-x - Archive of obsolete content
The -ms-scroll-snap-points-x CSS property is a Microsoft extension that specifies where snap-points will be located along the x-axis. Initial valuesnapInterval(0px, 100%)Applies tonon-replaced block-level elements and non-replaced inline-block elementsInheritednoComputed valueas specifiedAnimation typediscrete Syntax Values Note: a <length-percentage> is a value that can be either a <length> or a <percentaqe>. snapInterval( <length-percentage>, <length-percentage> ) Specifies a starting snap-point followed by the interval between all snap-points. The first value specifies where the first snap-point will be placed. The second value specifies the distance between subsequent snap-points both to the left and the right of the initial snap-point. snapList( <length-perce...
-ms-scroll-snap-points-y - Archive of obsolete content
The -ms-scroll-snap-points-y CSS property is a Microsoft extension that specifies where snap-points will be located along the y-axis. Initial valuesnapInterval(0px, 100%)Applies tonon-replaced block-level elements and non-replaced inline-block elementsInheritednoComputed valueas specifiedAnimation typediscrete Syntax Values Note: a <length-percentage> is a value that can be either a <length> or a <percentaqe>. snapInterval( <length-percentage>, <length-percentage> ) Specifies a starting snap-point followed by the interval between all snap-points. The first value specifies where the first snap-point will be placed. The second value specifies the distance between subsequent snap-points both above and below the initial snap-point. snapList( <length-percentage>...
-ms-scroll-snap-x - Archive of obsolete content
The -ms-scroll-snap-x CSS shorthand property is a Microsoft extension that specifies values for the -ms-scroll-snap-type and -ms-scroll-snap-points-x properties. Initial valueas each of the properties of the shorthand:-ms-scroll-snap-type: none-ms-scroll-snap-points-x: snapInterval(0px, 100%)Applies tonon-replaced block-level elements and non-replaced inline-block elementsInheritednoComputed valueas each of the properties of the shorthand:-ms-scroll-snap-type: as specified-ms-scroll-snap-points-x: as specifiedAnimation typediscrete Syntax Values The -ms-scroll-snap-x shorthand property is specified as one or both of the following values, in order and separated by spaces. -ms-scroll-snap-type The value of the -ms-scroll-snap-type property. -ms-scroll-snap-points-x The...
-ms-scroll-snap-y - Archive of obsolete content
The -ms-scroll-snap-x CSS shorthand property is a Microsoft extension that specifies values for the -ms-scroll-snap-type and -ms-scroll-snap-points-y properties. Initial valueas each of the properties of the shorthand:-ms-scroll-snap-type: none-ms-scroll-snap-points-y: snapInterval(0px, 100%)Applies tonon-replaced block-level elements and non-replaced inline-block elementsInheritednoComputed valueas each of the properties of the shorthand:-ms-scroll-snap-type: as specified-ms-scroll-snap-points-y: as specifiedAnimation typediscrete Syntax Values The -ms-scroll-snap-y shorthand property is specified as one or both of the following values, in order and separated by spaces. -ms-scroll-snap-type The value of the -ms-scroll-snap-type property. -ms-scroll-snap-points-y The...
::-ms-browse - Archive of obsolete content
er-bottom-color border-bottom-left-radius border-bottom-right-radius border-bottom-style border-bottom-width border-left-color border-left-style border-left-width border-right-color border-right-style border-right-width border-top-color border-top-left-radius border-top-right-radius border-top-style border-top-width box-shadow box-sizing color cursor display (values block, inline-block, none) @font-face font-size font-style font-weight height margin-bottom margin-left margin-right margin-top opacity outline-color outline-style outline-width padding-bottom padding-left padding-right padding-top transform transform-origin visibility width Syntax ::-ms-browse Example HTML <label>Select image: <input type="file"></label> CSS input[type="file"]::...
::-ms-clear - Archive of obsolete content
er-bottom-color border-bottom-left-radius border-bottom-right-radius border-bottom-style border-bottom-width border-left-color border-left-style border-left-width border-right-color border-right-style border-right-width border-top-color border-top-left-radius border-top-right-radius border-top-style border-top-width box-shadow box-sizing color cursor display (values block, inline-block, none) @font-face font-size font-style font-weight height margin-bottom margin-left margin-right margin-top opacity outline-color outline-style outline-width padding-bottom padding-left padding-right padding-top transform transform-origin visibility width Syntax ::-ms-clear Example HTML <form> <label for="firstname">First name:</label> <input type="text" id="...
::-ms-fill-lower - Archive of obsolete content
er-bottom-color border-bottom-left-radius border-bottom-right-radius border-bottom-style border-bottom-width border-left-color border-left-style border-left-width border-right-color border-right-style border-right-width border-top-color border-top-left-radius border-top-right-radius border-top-style border-top-width box-shadow box-sizing color cursor display (values block, inline-block, none) @font-face font-size font-style font-weight height margin-bottom margin-left margin-right margin-top -ms-background-position-x -ms-background-position-y -ms-high-contrast-adjust opacity outline-color outline-style outline-width padding-bottom padding-left padding-right padding-top transform transform-origin visibility width Specifications Not part of any sp...
::-ms-fill-upper - Archive of obsolete content
er-bottom-color border-bottom-left-radius border-bottom-right-radius border-bottom-style border-bottom-width border-left-color border-left-style border-left-width border-right-color border-right-style border-right-width border-top-color border-top-left-radius border-top-right-radius border-top-style border-top-width box-shadow box-sizing color cursor display (values block, inline-block, none) @font-face font-size font-style font-weight height margin-bottom margin-left margin-right margin-top -ms-background-position-x -ms-background-position-y -ms-high-contrast-adjust opacity outline-color outline-style outline-width padding-bottom padding-left padding-right padding-top transform transform-origin visibility width Syntax ::-ms-fill-upper Speci...
::-ms-reveal - Archive of obsolete content
er-bottom-color border-bottom-left-radius border-bottom-right-radius border-bottom-style border-bottom-width border-left-color border-left-style border-left-width border-right-color border-right-style border-right-width border-top-color border-top-left-radius border-top-right-radius border-top-style border-top-width box-shadow box-sizing color cursor display (values block, inline-block, none) @font-face font-size font-style font-weight height margin-bottom margin-left margin-right margin-top -ms-background-position-x -ms-background-position-y -ms-high-contrast-adjust opacity outline-color outline-style outline-width padding-bottom padding-left padding-right padding-top transform transform-origin visibility width Syntax ::-ms-reveal Specificatio...
::-ms-thumb - Archive of obsolete content
er-bottom-color border-bottom-left-radius border-bottom-right-radius border-bottom-style border-bottom-width border-left-color border-left-style border-left-width border-right-color border-right-style border-right-width border-top-color border-top-left-radius border-top-right-radius border-top-style border-top-width box-shadow box-sizing color cursor display (values block, inline-block, none) @font-face font-size font-style font-weight height margin-bottom margin-left margin-right margin-top -ms-background-position-x -ms-background-position-y -ms-high-contrast-adjust opacity outline-color outline-style outline-width padding-bottom padding-left padding-right padding-top transform transform-origin visibility width Syntax ::-ms-thumb Specificat...
::-ms-ticks-after - Archive of obsolete content
er-bottom-color border-bottom-left-radius border-bottom-right-radius border-bottom-style border-bottom-width border-left-color border-left-style border-left-width border-right-color border-right-style border-right-width border-top-color border-top-left-radius border-top-right-radius border-top-style border-top-width box-shadow box-sizing color cursor display (values block, inline-block, none) @font-face font-size font-style font-weight height margin-bottom margin-left margin-right margin-top -ms-background-position-x -ms-background-position-y -ms-high-contrast-adjust opacity outline-color outline-style outline-width padding-bottom padding-left padding-right padding-top transform transform-origin visibility width Syntax ::-ms-ticks-after ...
::-ms-ticks-before - Archive of obsolete content
er-bottom-color border-bottom-left-radius border-bottom-right-radius border-bottom-style border-bottom-width border-left-color border-left-style border-left-width border-right-color border-right-style border-right-width border-top-color border-top-left-radius border-top-right-radius border-top-style border-top-width box-shadow box-sizing color cursor display (values block, inline-block, none) @font-face font-size font-style font-weight height margin-bottom margin-left margin-right margin-top -ms-background-position-x -ms-background-position-y -ms-high-contrast-adjust opacity outline-color outline-style outline-width padding-bottom padding-left padding-right padding-top transform transform-origin visibility width Syntax ::-ms-ticks-before ...
::-ms-track - Archive of obsolete content
er-bottom-color border-bottom-left-radius border-bottom-right-radius border-bottom-style border-bottom-width border-left-color border-left-style border-left-width border-right-color border-right-style border-right-width border-top-color border-top-left-radius border-top-right-radius border-top-style border-top-width box-shadow box-sizing color cursor display (values block, inline-block, none) @font-face font-size font-style font-weight height margin-bottom margin-left margin-right margin-top -ms-background-position-x -ms-background-position-y -ms-high-contrast-adjust opacity outline-color outline-style outline-width padding-bottom padding-left padding-right padding-top transform transform-origin visibility width Syntax ::-ms-track See also ...
::-ms-value - Archive of obsolete content
er-bottom-color border-bottom-left-radius border-bottom-right-radius border-bottom-style border-bottom-width border-left-color border-left-style border-left-width border-right-color border-right-style border-right-width border-top-color border-top-left-radius border-top-right-radius border-top-style border-top-width box-shadow box-sizing color cursor display (values block, inline-block, none) @font-face font-size font-style font-weight height margin-bottom margin-left margin-right margin-top -ms-background-position-x -ms-background-position-y -ms-high-contrast-adjust opacity outline-color outline-style outline-width padding-bottom padding-left padding-right padding-top transform transform-origin visibility width Syntax ::-ms-value Example i...
display-inside - Archive of obsolete content
ox. /* Keyword values */ display-inside: auto; display-inside: block; display-inside: table; display-inside: flex; display-inside: grid; display-inside: ruby; /* Global values */ display-inside: inherit; display-inside: initial; display-inside: unset; Value not found in DB! Syntax One of the keyword values listed below. Values auto If the element's computed <display-outside> value is inline-level, the element is an inline element, and lays out its contents using inline layout. If the element's computed <display-outside> value is an layout-specific internal type, this elements acts as normal for its given <display-outside> value. Otherwise, this value computes to block. block The element lays out its contents using block layout. table The element lays out its contents using table...
The global XML object - Archive of obsolete content
</foo>; element.toXMLString(); // returns <foo><?process x="true"?><bar/><?process x="false"?></foo> ignoreWhitespace true by default. Ignores whitespace between nodes and leading and trailing whitespace in text nodes, which would otherwise be interpreted as text nodes or as part of those text nodes, respectively. prettyPrinting true by default. When true, toXMLString() includes newlines and indenting for the serialization of E4X objects. prettyIndent 2 by default. The number of spaces to indent each level in the XML tree. Ignored if prettyPrinting is false. << Previous ...
Debug.write - Archive of obsolete content
tr1, str2, ... , strN Optional Strings to send to the script debugger. Remarks The Debug.write function sends strings to the Immediate window of a script debugger at run time. If the script is not being debugged, the Debug.write function has no effect. The Debug.write function is almost identical to the Debug.writeln function. The only difference is that the Debug.writeln function sends a newline character after the strings are sent. Example This example uses the Debug.write function to display the value of the variable in the Immediate window of the script debugger. Note: To run this example, you must have a script debugger installed and the script must run in debug mode. Internet Explorer 8 includes the JavaScript debugger. If you are using an earlier version of Internet Explorer, ...
Debug.writeln - Archive of obsolete content
The debug.writeln function sends strings to the script debugger, followed by a newline character. Syntax Debug.writeln([str1 [, str2 [, ... [, strN]]]]) Parameters str1, str2, ... , strN Optional Strings to send to the script debugger. Remarks The Debug.writeln function sends strings, followed by a newline character, to the Immediate window of the Microsoft Script Debugger at run time. If the script is not being debugged, the Debug.writeln function has no effect. The Debug.writeln function is almost identical to the Debug.write function. The only difference is that the Debug.write function does not send a newline character after sending the strings. Example This example uses the Debug.writeln function to display the value of the variable in the Immediate window of the Mic...
Debug - Archive of obsolete content
at an asynchronous operation has completed. Debug.msTraceAsyncOperationStarting Initiates a trace for an asynchronous operation. Debug.msUpdateAsyncCallbackRelation Updates the relationship status between a synchronous work item and the associated asynchronous operation. Debug.write Sends strings to the script debugger. Debug.writeln Sends strings to the script debugger, followed by a newline character. Examples Print the value of a variable This example uses the write function to display the value of the variable. var counter = 42; Debug.write("The value of counter is " + counter); Requirements Supported in the following document modes: Quirks, Internet Explorer 6 standards, Internet Explorer 7 standards, Internet Explorer 8 standards, Internet Explorer 9 standards, Internet E...
GetObject - Archive of obsolete content
\\DRAWINGS\\SAMPLE.DRW", "FIGMENT.DRAWING"); In the preceding example, FIGMENT is the name of a drawing application and DRAWING is one of the object types it supports. Once an object is activated, you reference it in code using the object variable you defined. In the preceding example, you access properties and methods of the new object using the object variable MyObject. For example: MyObject.Line(9, 90); MyObject.InsertText(9, 100, "Hello, world."); MyObject.SaveAs("C:\\DRAWINGS\\SAMPLE.DRW"); Note: Use the GetObject function when there is a current instance of the object, or if you want to create the object with a file already loaded. If there is no current instance, and you don't want the object started with a file loaded, use the ActiveXObject object. If an object has registered i...
@cc_on - Archive of obsolete content
is supported in Internet Explorer 10 Standards mode and in all earlier versions. The @cc_on statement activates conditional compilation support within comments in a script. Syntax @cc_on Remarks The @cc_on statement activates conditional compilation within comments in a script. It is not common to use conditional compilation variables in scripts written for ASP or ASP.NET pages or command-line programs because the capabilities of the compilers can be determined by using other methods. When you write a script for a Web page, always put conditional compilation code in comments. This enables hosts that do not support conditional compilation to ignore it. It is strongly recommended that you use the @cc_on statement in a comment, so that browsers that do not support conditional compilatio...
@if - Archive of obsolete content
n1 ) text1 [@elif ( condition2 ) text2] [@else text3] @end Parameters text1 Optional Text to be parsed if condition1 is true. text2 Optional Text to be parsed if condition1 is false and condition2 is true. text3 Optional Text to be parsed if both condition1 and condition2 are false. Remarks When you write an @if statement, you do not have to place each clause on a separate line. You can use multiple @elif clauses. However, all @elif clauses must come before an @elseclause. The @if statement is typically used to determine which text among several options should be used for text output. It is not common to use conditional compilation variables in scripts written for ASP or ASP.NET pages or command-line programs. This is because the capabilities of the compilers can be d...
New in JavaScript 1.5 - Archive of obsolete content
parentheses, (?:x) can be used instead of capturing parentheses, (x). When non-capturing parentheses are used, matched subexpressions are not available as back-references. Positive and negative lookahead assertions are supported. Both assert a match depending on what follows the string being matched. The m flag has been added to specify that the regular expression should match over multiple lines. Functions can now be declared inside an if clause. Functions can now be declared inside an expression. ...
New in JavaScript 1.7 - Archive of obsolete content
s, let expressions, and destructuring assignment. Using JavaScript 1.7 In order to use some of the new features of JavaScript 1.7, you need to specify that you wish to use JavaScript 1.7. In HTML or XUL code, use: <script type="application/javascript;version=1.7"></script> When using the JavaScript shell, you need to set the version you wish to use using the -version 170 switch on the command line or using the version() function: version(170); The features that require the use of the new keywords "yield" and "let" require you to specify version 1.7 because existing code might use those keywords as variable or function names. The features that do not introduce new keywords (destructuring assignment and array comprehensions) can be used without specifying the JavaScript version. New feat...
LiveConnect Overview - Archive of obsolete content
in the same location (JRE 1.4 and up). Using the LiveConnect classes with the JDK To access the LiveConnect classes, place the .jar or .zip file in the CLASSPATH of the JDK compiler in either of the following ways: Create a CLASSPATH environment variable to specify the path and name of .jar or .zip file. Specify the location of .jar or .zip file when you compile by using the -classpath command line parameter. You can specify an environment variable in Windows NT by double-clicking the System icon in the Control Panel and creating a user environment variable called CLASSPATH with a value similar to the following: C:\Program Files\Java\jre1.4.1\lib\plugin.jar See the Sun JDK documentation for more information about CLASSPATH. Note: Because Java is a strongly typed language and JavaScript is...
JSException - Archive of obsolete content
ly took a string argument, specifying the detail message or other information for the exception. The getWrappedException method was not available. JSException constructors, deprecated in JavaScript 1.4, constructs a JSException object with an optional detail message. Declaration 1. public JSException() 2. public JSException(String s) 3. public JSException(String s, String filename, int lineno, String source, int tokenIndex) Arguments s The detail message. filename The URL of the file where the error occurred, if possible. lineno The line number of the file, if possible. source The string containing the JavaScript code being evaluated. tokenIndex The index into the source string where the error occurred. getWrappedException Instance method getW...
background-size - Archive of obsolete content
each. I'm going to post on dev-mdc momentarily with a proposal on this. (Sheppy 07 December 2009) We should encourage web developers to ask for layout engines, not for browsers. [That said, the popularity of Chrome let me think of a table row like Safari, Chrome (WebKit) | 4.0, 2.0 (528). But I'm not able and willing spending time for this. Remember you have to test yourself, don't trust online references, don't trust WebKit | Apple | Google homepage, they are wrong. DON'T TRUST THE INTERNET AT ALLl! ] Listing Konqueror below the table is a compromise for consistency. Feel free to put it inside, nothing is set in stone. Konqueror's global market share is 0.05%, (< 5% of Linux users). Given the fact that this reference has serious shortcomings in many places and few contributors, I thin...
Reference - Archive of obsolete content
them yet. --Maian 02:39, 21 October 2005 (PDT) delete? I don't see any mention in the operators section for the delete operator. Did this operator get removed/deprecated, or is it missing from the documentation? Brundlefly 13:15, 19 December 2005 (PST) Neither: Core JavaScript 1.5 Reference:Operators:Special Operators:delete Operator --Nickolay 14:48, 19 December 2005 (PST) reading offline? Well, may be it's no so common in today's world... but is there a way to get content of jsref-1.5 or other documents as a tarball? There are still valid needs for this: computers on slow links, computers behind insane firewalls, as well as computers not connected to internet. Unfortunately there is not an [easy] method to download content/packages of content off of DevMo for 'local' browsing/...
forEach - Archive of obsolete content
e to alter the text as English is not my mother tongue and I'm more concerned with the code quality that the English grammar ;-S dotnetCarpenter 30 June 2012 <hr> The Compatibility section goes to extraordinary lengths in providing a forEach implementation. A much more sane approach would be to count on the implementation to throw errors if wrong arguments are provided and implement this in fewer lines of code. I've removed the lengthy example, while still linking to it and provided a much simpler and leaner implementation. dotnetCarpenter 30 June 2012 <hr> I have released the write access restriction, but I will be watching changes closely. jswisher 01 October 2011 <hr> There is some mistype in Array.prototype.forEach: kValue = O[ Pk ]; should be kValue = O[ k ]; <hr> This page has been the ...
Writing JavaScript for XHTML - Archive of obsolete content
applications. (Note that XHTML documents which behave correctly in both application/xhtml+xml and text/html environments are sometimes known as 'polyglot' documents.) To test the following examples locally, use Firefox's extension switch. Just write an ordinary (X)HTML file and save it once as test.html and once as test.xhtml. Problem: Nothing Works After switching the MIME type suddenly no inline script works anymore. Even the plain old alert() method is gone. The code looks something like this: <script type="text/javascript"> //<!-- window.alert("Hello World!"); //--> </script> Solution: The CDATA Trick This problem usually arises, when inline scripts are included in comments. This was common practice in HTML, to hide the scripts from browsers not capable of JS. In the age ...
Building Mozilla XForms - Archive of obsolete content
efox 3.5, you need to do two more Mercurial checkouts: cd extensions hg clone http://hg.mozilla.org/xforms hg clone http://hg.mozilla.org/schema-validation That's it, you now have everything you need to get started. Configure your build: the .mozconfig file Mozilla uses a file called .mozconfig in your home directory to store the build configuration. For xforms, you will need to add the following line: ac_add_options --enable-extensions="default,xforms" # if you're using a Mozilla source before 2010-11-06 (e.g. an old Firefox 3.6 release) use this instead (see bug 601570 for details): ac_add_options --enable-extensions="default,xforms,schema-validation" A complete .mozconfig file for a release build might look like that: . $topsrcdir/browser/config/mozconfig mk_add_options MOZ_CO_PROJECT=br...
XForms Custom Controls - Archive of obsolete content
t like XForms controls. The purpose of this article is to give you enough background information so that you'll be able to get a good start. To really grasp the following information, a good understanding of XForms, XBL, JavaScript and CSS is needed. XPCOM knowledge will certainly not hurt. But even if you are only comfortable with a couple of these technologies, we hope that the possibilities outlined below will inspire you to learn more where you need to. Implementation Status The framework we use in the Mozilla XForms processor is very much a "work in progress". Please keep in mind that just about everything we mention here may change to some degree as we continue to work on it. Work has just started in the W3C XForms Working Group to investigate the custom control issue, so eventually (hop...
XForms Help Element - Archive of obsolete content
Introduction Specifies contextual help for the containing form control (see the spec). The help message will be displayed if the F1 key is pressed while the containing form control has focus or if the containing form control recieves a xforms-help event. The message of the help element can exist in instance data, in a remote document, or as inline text. If more than one source of message is specified in this element, the order of precedence is: single node binding attributes, linking attributes, inline text. Attributes Single-Node Binding Linking src - URL of a document whose contents will be retrieved by the help element and used to provide a help message for the containing form control. Type restrictions The help element can be bound to any simple content. Representations Is ...
XForms Hint Element - Archive of obsolete content
Introduction Similar to a tooltip (see the spec). The hint is displayed when the mouse moves and pauses over the containing form control. The hint will also be displayed if the containing form control recieves a xforms-hint event. The message of the hint element can exist in instance data, in a remote document, or as inline text. If more than one source of message is specified in this element, the order of precedence is: single node binding attributes, linking attributes, inline text. Attributes Single-Node Binding Linking src - URL of a document whose contents will be retrieved by the hint element and used to provide hint text for the containing form control. Type restrictions The hint element can be bound to any simple content. Representations Is represented by a tooltip wind...
XForms Input Element - Archive of obsolete content
the checkbox. before shows the label first, then the checkbox, after shows the checkbox, than the label. labelposition was introduced with Mozilla XForms 0.8.8. Before that, the default behavior was to display the label first, then the checkbox. Since the introduction of labelposition, the behavior changed as described above to better match other implementations as well as commonly used GUI guidelines. datepicker This widget is similar to a combobox. It consists of a text field for direct user input next to a button that when activated will 'drop down' a calender widget that the user can also interact with (xhtml/xul). Characteristics used when the instance node is of type xsd:date or a type derived from it. will not work with xsd:dateTime (behavior defaults to text input). Specific handl...
XForms Message Element - Archive of obsolete content
Introduction Used in combination with XML Event listeners to display a message to the user when the specified event occurs (see the spec). The message of the message element can exist in instance data, in a remote document, or as inline text. If more than one source of message is specified in this element, the order of precedence is: single node binding attributes, linking attributes, inline text. Attributes Single-Node Binding Linking src - URL of a document whose contents will be retrieved by the message element and used to provide the message text for the message element. Special level - defines a representation of message element Type restrictions The message element can be bound to any simple content. Representations It may be represented in the following ways: modal ...
XForms Textarea Element - Archive of obsolete content
Introduction Serves to show/change multiline text (see the spec). Attributes UI Common appearance - isn't supported. accesskey - used to specify the keyboard shortcut for focusing this control. Single-Node Binding Special inputmode - isn't supported. incremental - supported. The default value is false. Type restrictions The textarea element can be bound to a node of type xsd:string or any type derived from it. Representations The XForms textarea element is represented by a multiline text field (xhtml/xul). Characteristics analogous widgets are <xhtml:textarea/> and <xul:textbox multiline="true"/> if the incremental attribute has the value true, then the bound instance node is updated on every user input. ...
Mozilla XForms User Interface - Archive of obsolete content
e. calendar - used for date data types when appearance = 'full'. days list - used when the data has a data type of day. months list - used when the data has a data type of month. number field - used for numerical data types. secret Used for inputting passwords. Each character typed by the user is represented by an asterisk on the screen (see the spec). 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). It can have the following presentations: text - default representation for data of most types, especially static text. calendar - used for date data types when appearance = 'full'. image - if the instance node contains an image, then an output element can be used ...
Using XForms and PHP - Archive of obsolete content
a used as instance data for XForms, the page needs to be served as XML, for example application/xhtml+xml. To do that, you need to use the header() PHP function: <?php header("Content-Type: application/xhtml+xml; charset=UTF-8"); ... ?> But remember this (quote from PHP documentation): Remember that header() must be called before any actual output is sent, either by normal HTML tags, blank lines in a file, or from PHP. It is a very common error to read code with include(), or require(), functions, or another file access function, and have spaces or empty lines that are output before header() is called. The same problem exists when using a single PHP/HTML file. Parsing Submitted Data Depending on the submission type, you might get different data formats on the server side. To really ...
XForms - Archive of obsolete content
Obsolete since Gecko 19 (Firefox 19 / Thunderbird 19 / SeaMonkey 2.16)This feature is obsolete. Although it may still work in some browsers, its use is discouraged since it could be removed at any time. Try to avoid using it. Note: Support for XForms was removed from Firefox in Firefox 19. See the HTML Forms Guide for approaches to creating forms in HTML5. XForms Essentials An online book giving you a guided tour of XForms. XForms were envisioned as the future of online forms as envisioned by the W3C. Drawing on other W3C standards like XML Schema, XPath, and XML Events, XForms tried to address some of the limitations of the current HTML forms model. However, XForms never gained traction and is now considered obsolete. Other strengths that XForms brings to the table is the separ...
Archived open Web documentation - Archive of obsolete content
propriate, the Firefox Mobile team designed the importDialog() method to replace window.openDialog(). Instead of opening a new window, it merges the specified XUL dialog into the main window. Writing JavaScript for XHTML Technical review completed. Editorial review completed. XForms XForms were envisioned as the future of online forms as envisioned by the W3C. Drawing on other W3C standards like XML Schema, XPath, and XML Events, XForms tried to address some of the limitations of the current HTML forms model. However, XForms never gained traction and is now considered obsolete. ...
Describing microformats in JavaScript - Archive of obsolete content
-name" : { } } }; The properties are quite simple here. The type property indicates the type of address represented by the object (work, home, and so forth). Since the plural property is true, multiple types can be specified. This allows an address to be marked as being, for example, a work address for receiving parcels. The street-address property is plural as well. This allows multiple lines of address information to be contained in the street-address array. The microformat is registered with the microformat API by calling Microformats.add(), like this: Microformats.add("adr", adr_definition); Note: To be clear: since the adr microformat is included by default in Firefox 3 and later, you don't need to add it yourself if you wish to make use of it. See also Using microformats, ...
Popup Window Controls - Archive of obsolete content
t.write() to emit appropriate HTML which will contain the same information as the popup window. You can also use either the advanced features in the Document Object Model (DOM) or innerHTML to create the appropriate HTML. Example The example tag links to devedge-temp.mozilla.org This example illustrates detecting suppressed popup windows as well as an approach for replacing popup windows with inline HTML using innerHTML. Original Document Information Author(s): Bob Clary Last Updated Date: December 5th, 2002 Copyright (C) 2001-2003 Netscape. ...
RDF in Mozilla FAQ - Archive of obsolete content
an one datasource is added to the database. Examples Where can I find some (working) examples? A few examples are posted here. Some of these are included in signed scripts, and are runnable from HTTP directly. See also duplicates.rdf (for live RDF feed from Mozilla) alongside duplicates.xul. Note that for these to work, you have to relax Mozilla's security model. To do this, add the following line to your preferences file. (Shut down Mozilla first since it overwrites your preferences file when you quit.) user_pref("signed.applets.codebase_principal_support", true); Mozilla will ask you if you want to grant the scripts in duplicates.xul permission to access XPConnect; respond in the affirmative. Currently, Mozilla does not allow unprivileged access to the RDF interfaces and services; se...
Web Standards - Archive of obsolete content
Web standards are carefully designed to deliver the greatest benefits to the greatest number of web users while ensuring the long-term viability of any document published on the Web. Designing and building with these standards simplifies and lowers the cost of production, while delivering sites that are accessible to more people and more types of Internet devices. Sites developed along these lines will continue to function correctly as traditional desktop browsers evolve, and as new Internet devices come to market. [1] Documentation Migrate apps from Internet Explorer to Mozilla Ever have trouble getting your Internet Explorer-specific Web applications to work with Mozilla? This article covers common issues associated with migrating applications to the open ...
Windows Media in Netscape - Archive of obsolete content
ow to control the Windows Media Player ActiveX control using JavaScript and provides working examples. This article deals uniquely with Netscape 7.1 running on the Windows operating system. Detecting the Right Browser Like Internet Explorer, Netscape 7.1 and later versions can play Windows Media files using the popular Windows Media Player ActiveX control. This control is widely used to provide inline media support for web pages that provide sound, video and other media. Controls such as Windows Media Player also interact closely with the scripts in a web page. Netscape 7.1 is the first Netscape Gecko(TM) browser to support the Windows Media Player as an ActiveX control -- previous Netscape browsers did not support any ActiveX controls, and thus detecting which versions of Netscape support the...
Obsolete: XPCOM-based scripting for NPAPI plugins - Archive of obsolete content
to JavaScript in Mozilla based browsers. In order to make it still possible to script plugins, some changes have been made to the Mozilla code. The changes allow to make existing 4.x plugins scriptable with only minor modifications in their code. The present document describes the steps of what should be done to the plugin code to turn it scriptable again. What's in the Mozilla code? A couple of lines have been added to the DOM code asking a plugin to return a scriptable iid and a pointer to a scriptable instance object. The old Plugin API call NPP_GetValue is used to retrieve this information from the plugin. So the plugin project should be aware of two new additions to NPPVariable enumeration type which are now defined in npapi.h as: NPPVpluginScriptableInstance = 10, NPPVpluginScriptableII...
Common causes of memory leaks in extensions - Extensions
in question is browser.xul or some long-lived web app such as Gmail, the leaked compartment might survive for quite some time. function leakref() {} function main(window) { // This is a potential leak, as the window (e.g. browser.xul) will hold on to // the leakref function and the enclosing compartment via the listener. window.addEventListener("leaky", leakref, true); // The following line still fails to avoid the leak, as useCapture differs // and removeEventListener will not remove anything. // This kind of subtle bug is very common. // unload(function() window.removeEventListener("leaky", leakref, false), window); // This is the right way to do it remove the listener. unload(function() window.removeEventListener("leaky", leakref, true), window); } Note: The unload()...
Game monetization - Game development
vary greatly depending on the brand, client, and amount of work you put in. Other non-game focused monetization strategies There are other ways you can earn money when building HTML5 games, and it doesn't even have to be game-related. Selling resources If you're a graphic designer, you can sell the assets from the games you've created, or something brand new exclusively for that purpose at online shops like Envato Market. It's not much, but if you're a known designer it can be an extra passive stream of income. Writing articles and tutorials It is possible to write articles about your games and even get paid for them. Game promotion and monetization at the same time is a win-win, and if you don't abuse it with too much advertising the readers will enjoy reading them and as well as learn...
Publishing games - Game development
at the options you have when you want to publish and distribute your game, and earn something out of it while you wait for it to become famous. Game distribution So you've followed a tutorial or two and created an HTML5 game -- that's great! Game distribution provides all you need to know about the ways you can distribute your newly created game into the wild -- including hosting it yourself online, submitting it to open marketplaces, and submitting it to closed ones like Google Play or the iOS App Store. Game promotion Developing and finishing the game is not enough. You have to let the world know that you have made something interesting available, which people will enjoy playing. There are many Game promotion techniques -- many of them free -- so even if you're struggling to make a livi...
Bounding volume collision detection with THREE.js - Game development
It has an update() method that will resize its bounding box Mesh if the linked Mesh rotates or changes its dimensions, and update its position. It takes into account the child meshes when computing the size of the bounding box, so the original mesh and all its children are wrapped. We can easily debug collisions by rendering the Meshes that BoxHelper creates. By default they are created with a LineBasicMaterial material (a three.js material for drawing wireframe-style geometries). The main disadvantage is that it only creates box bounding volumes, so if you need spheres vs AABB tests you need to create your own Sphere objects. To use it, we need to create a new BoxHelper instance and supply the geometry and -- optionally -- a color that will be used for the wireframe material. We also ne...
Async scripts for asm.js - Game development
(Scripts created from script default to async.) The default HTML shell Emscripten generates produces the latter. When is async not async? Two common situations in which a script is *not* async (as defined by the HTML spec) are: <script async>code</script> and var script = document.createElement('script'); script.innerHTML = "code"; document.body.appendChild(script); Both are counted as 'inline' scripts and get compiled and then run immediately. What if your code is in a JS string? Instead of using eval or innerHTML, both of which trigger synchronous compilation, you should use a Blob with an object URL: var blob = new Blob([codeString]); var script = document.createElement('script'); var url = URL.createObjectURL(blob); script.onload = script.onerror = function() { URL.revokeObjectUR...
Desktop gamepad controls - Game development
To update the state of the gamepad's currently pressed buttons we will need a function that will do exactly that on every frame: function gamepadUpdateHandler() { buttonsPressed = []; if(controller...
Desktop mouse and keyboard controls - Game development
39, down: 40 }; That way instead of using the codes to compare the input in the handler functions we could do something like this, which is arguably easier to remember: if(event.keyCode == KeyboardHelper.left) { leftPressed = true; } Note: You can also find a list if the different keycodes and what keys they relate to in the keyCode reference page. You can see this example in action online at end3r.github.io/JavaScript-Game-Controls and the full source code can be found at github.com/end3r/JavaScript-Game-Controls. Phaser approach As I mentioned before you can write everything on your own, but you can also take the advantage of built-in functions in frameworks like Phaser -- these will make your life easier and development a lot faster. All the edge cases, differences between bro...
Unconventional controls - Game development
before the closing </body> tag for outputting diagnostic information. We will need a few helper variables for our code to work -- one for the purpose of calculating the degrees from radians, two for holding the horizontal and vertical amount of degrees our hand is leaning above the controller, one for the threshold of that lean, and one for the state of our hand's grab status. ...
Implementing game control mechanisms - Game development
e button is pressed, and it will be checked against the input's isDown boolean variable on every frame of the game. That should give you some understanding of the project structure. We'll be playing mostly with the MainMenu.js and Game.js files, and we'll explain the code inside the create() and update() methods in much more detail in later articles. Pure JavaScript demo There's also a small online demo with full source code available on GitHub where the basic support for the control mechanisms described in the articles is implemented in pure JavaScript. It will be explained in the given articles themselves below, but you can play with it already, and use the code however you want for learning purposes. The articles JavaScript is the perfect choice for mobile gaming because of HTML5 being...
Bounce off the walls - Game development
will check whether the ball is touching (colliding with) the wall, and if so, we will change the direction of its movement accordingly. To make the calculations easier let's define a variable called ballRadius that will hold the radius of the drawn circle and be used for calculations. Add this to your code, somewhere below the existing variable declarations: var ballRadius = 10; Now update the line that draws the ball inside the drawBall() function to this: ctx.arc(x, y, ballRadius, 0, Math.PI*2); Bouncing off the top and bottom There are four walls to bounce the ball off -- let's focus on the top one first. We need to check, on every frame, whether the ball is touching the top edge of the Canvas -- if yes, we'll reverse the ball movement so it will start to move in the opposite directio...
Build the brick field - Game development
chanics, we are now able to lose -- this is great as it means the game is finally feeling more like a game. However, it will quickly get boring if all you do is bounce the ball off the walls and the paddle. What a breakout game really needs is some bricks to destroy with the ball, and this is what we'll create now! Setting up the brick variables The overall aim of this lesson is to render a few lines of code for the bricks, using a nested loop that works through a two-dimensional array. First however we need to set up some variables to define information about the bricks such as their width and height, rows and columns, etc. Add the following lines to your code below the variables which you have previously declared in your program. var brickRowCount = 3; var brickColumnCount = 5; var brick...
Create the Canvas and draw on it - Game development
ag. var canvas = document.getElementById("myCanvas"); var ctx = canvas.getContext("2d"); Here we're storing a reference to the <canvas> element to the canvas variable. Then we're creating the ctx variable to store the 2D rendering context -- the actual tool we can use to paint on the Canvas. Let's see an example piece of code that prints a red square on the canvas. Add this below your previous lines of JavaScript, then load your index.html in a browser to try it out. ctx.beginPath(); ctx.rect(20, 40, 50, 50); ctx.fillStyle = "#FF0000"; ctx.fill(); ctx.closePath(); All the instructions are between the beginPath() and closePath() methods. We are defining a rectangle using rect(): the first two values specify the coordinates of the top left corner of the rectangle on the canvas, while the se...
Collision detection - Game development
the next challenge -- the collision detection between the ball and the bricks. Luckily enough we can use the physics engine to check collisions not only between single objects (like the ball and the paddle), but also between an object and the group. Brick/Ball collision detection The physics engine makes everything a lot easier -- we just need to add two simple pieces of code. 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. The third, optiona...
Game over - Game development
Add the code below inside the create() function; just after you define the ball's attributes is fine: game.physics.arcade.checkCollision.down = false; This will make the three walls (top, left and right) bounce the ball back, but the fourth (bottom) will disappear, letting the ball fall off the screen if the paddle misses it. We need a way to detect this and act accordingly. Add the following lines just below the previous new one: ball.checkWorldBounds = true; ball.events.onOutOfBounds.add(function(){ alert('Game over!'); location.reload(); }, this); Adding those lines will make the ball check the world (in our case canvas) bounds and execute the function bound to the onOutOfBounds event. When you click on the resulting alert, the page will be reloaded so you can play again. Co...
Randomizing gameplay - Game development
same angle throughout the whole game. This means that every game is quite similar. To fix this and improve playability we should make the rebound angles more random, and in this article we'll look at how. Making rebounds more random We can change the ball's velocity depending on the exact spot it hits the paddle, by modifying the x velocity each time the ballHitPaddle() function is run using a line along the lines of the below. Add this new line to your code now, and try it out. function ballHitPaddle(ball, paddle) { ball.animations.play('wobble'); ball.body.velocity.x = -1*5*(paddle.x-ball.x); } It's a little bit of magic -- the new velocity is higher, the larger the distance between the center of the paddle and the place where the ball hits it. Also, the direction (left or right...
Gecko FAQ - Gecko Redirect 1
DOM 3 support is also planned for a future release. XML 1.0...
Plug-in Development Overview - Gecko Plugin API Reference
: Use the NPN_UserAgent method to read this information. To determine whether plug-in and the browser versions are compatible and possibly provide alternative processing for different versions: Use the NPN_Version method to check for changes in major and minor version numbers. For information about using these methods, see Version, UI, and Status Information. Displaying Messages on the Status Line Functionally, your plug-in is seamlessly integrated into the browser and operates as an addition to current browser capabilities. To make the user feel that the plug-in is part of the the browser user interface, your plug-in can emulate the browser behavior by providing status line messages. Use the NPN_Status method to display a message on the status line. For information about using this meth...
Algorithm - MDN Web Docs Glossary: Definitions of Web-related terms
concept of "Algorithmic Complexity" or "Big O" notation. For example: A cooking recipe is a simple algorithm for humans. A sorting algorithm is often used in computer programming to explain a machine how to sort data. Common algorithms are Pathfinding algorithms such as the Traveling Salesman Problem, Tree Traversal algorithms and so on. There are also Machine Learning algorithms such as Linear Regression, Logistic Regression, Decision Tree, Random Forest, Support Vector Machine, Recurrent Neural Network (RNN), Long Short Term Memory (LSTM) Neural Network, Convolutional Neural Network (CNN), Deep Convolutional Neural Network and so on. Learn more General knowledge Algorithm on Wikipedia Technical reference Explanations of sorting algorithms Explanations of algorithmic compl...
Alignment subject - MDN Web Docs Glossary: Definitions of Web-related terms
riting mode of the box is also used. The definition of the alignment subject depends on the layout mode being used. Block containers (including table cells) The entire content of the block as a single unit. Multicol containers The column boxes, with any spacing inserted between column boxes added to the relevant column gaps. Flex containers For justify-content, the flex items in each flex line. For align-content, the flex lines. Note, this only has an effect on multi-line flex containers. Grid containers The grid tracks in the appropriate axis, with any spacing inserted between tracks added to the relevant gutters. Collapsed gutters are treated as a single opportunity for space insertion. Learn more CSS Box Alignment ...
Block (CSS) - MDN Web Docs Glossary: Definitions of Web-related terms
A block on a webpage is an HTML element that appears on a new line, i.e. underneath the preceding element in a horizontal writing mode, and above the following element (commonly known as a block-level element). For example, <p> is by default a block-level element, whereas <a> is an inline element -- you can put several links next to one another in your HTML source and they will sit on the same line as one another in the rendered output. Using the display property you can change whether an element displays inline or as a block (among many other options); blocks are also subject to the effects of positioning schemes and use of the position property. Learn more General knowledge Visual formatting model ...
Block - MDN Web Docs Glossary: Definitions of Web-related terms
The term block can have several meanings depending on the context. It may refer to: Block (CSS) A block on a webpage is an HTML element that appears on a new line, i.e. underneath the preceding element in a horizontal writing mode, and above the following element (commonly known as a block-level element). For example, <p> is by default a block-level element, whereas <a> is an inline element -- you can put several links next to one another in your HTML source and they will sit on the same line as one another in the rendered output. Block (scripting) In JavaScript, a block is a collection of related statements enclosed in braces ("{}"). For example, you can put a block of statements after an if (condition) block, indicating that the interpreter should run the code ins...
Compile - MDN Web Docs Glossary: Definitions of Web-related terms
hine language, such as assembly, that the CPU can understand. Some compilers which translate between similar level languages are called transpilers or cross-compilers, for instance to compile from TypeScript to JavaScript. Those are considered productivity tools. Most Compilers work either ahead-of-time (AOT) or just-in-time (JIT). As a programmer, you usually invoke AOT compilers from a command line or your IDE. The most famous, "gcc" is one example. JIT compilers are usually transparent to you, used for performance. For instance in the browser: Firefox' SpiderMonkey JavaScript Engine has a JIT built-in that will compile JavaScript in a website to machine code while you're viewing it so it runs faster. Projects like WebAssembly work on making this even better. Learn more General knowledge...
Cross Axis - MDN Web Docs Glossary: Definitions of Web-related terms
s perpendicular to the main axis, therefore if your flex-direction is either row or row-reverse then the cross axis runs down the columns. If your main axis is column or column-reverse then the cross axis runs along the rows. Alignment of items on the cross axis is achieved with the align-items property on the flex container or align-self property on individual items. In the case of a multi-line flex container, with additional space on the cross axis, you can use align-content to control the spacing of the rows. Learn more Property reference align-content align-items align-self flex-wrap flex-direction flex Further reading CSS Flexbox Guide: Basic Concepts of Flexbox CSS Flexbox Guide: Aligning items in a flex container CSS Flexbox Guide: Mastering wrapping of flex ite...
Cryptanalysis - MDN Web Docs Glossary: Definitions of Web-related terms
Cryptanalysis is the branch of cryptography that studies how to break codes and cryptosystems. Cryptanalysis creates techniques to break ciphers, in particular by methods more efficient than a brute-force search. In addition to traditional methods like frequency analysis and index of coincidence, cryptanalysis includes more recent methods, like linear cryptanalysis or differential cryptanalysis, that can break more advanced ciphers. Learn more General knowledge Cryptanalysis on Wikipedia ...
Flex - MDN Web Docs Glossary: Definitions of Web-related terms
The items then participate in flex layout, and all of the properties defined in the CSS Flexible Box Layout Module may be applied. The flex property is a shorthand for the flexbox properties flex-grow, flex-shrink and flex-basis. In addition <flex> can refer to a flexible length in CSS Grid Layout. ...
Flex Item - MDN Web Docs Glossary: Definitions of Web-related terms
Continuous runs of text inside flex containers will also become flex items. ...
Grid Areas - MDN Web Docs Glossary: Definitions of Web-related terms
Grid areas must be rectangular in nature; it is not possible to create, for example, a T- or L-shaped grid area. In the example below I have a grid container with two grid items. I have named these with the grid-area property and then laid them out on the grid using grid-template-areas. This creates two grid areas, one covering four grid cells, the other two. ...
Grid Axis - MDN Web Docs Glossary: Definitions of Web-related terms
CSS Grid Layout is a two-dimensional layout method enabling the laying out of content in rows and columns. Therefore in any grid we have two axes. The block or column axis, and the inline or row axis. It is along these axes that items can be aligned and justified using the properties defined in the Box Alignment specification. In CSS the block or column axis is the axis used when laying out blocks of text. If you have two paragraphs and are working in a right to left, top to bottom language they lay out one below the other, on the block axis. The inline or row axis runs across the Block Axis and is the direction along which regular text flows. These are our rows in CSS Grid Layout. The physical direction of these axes can change according to the writing mode of the document. L...
Grid Cell - MDN Web Docs Glossary: Definitions of Web-related terms
If you do not place items using one of the grid placement methods, direct children of the grid container will be placed one into each individual grid cell by the auto-placement algorithm. Additional row or column tracks will be created to create enough cells to hold all items. In the example we have created a three column track grid. ...
Grid Column - MDN Web Docs Glossary: Definitions of Web-related terms
It is defined by the grid-template-columns property or in the shorthand grid or grid-template properties. In addition, columns may be created in the implicit grid when items are placed outside of columns created in the explicit grid. These columns will be auto-sized by default, or can have a size specified with the grid-auto-columns property. When working with alignment in CSS Grid Layout, the axis down which columns run is known as the block, or column, axis. ...
Grid container - MDN Web Docs Glossary: Definitions of Web-related terms
When an element becomes a grid container it establishes a grid formatting context. The direct children can now lay themselves out on any explicit grid defined using grid-template-columns and grid-template-rows, or on the implicit grid created when an item is placed outside of the explicit grid. ...
Grid Row - MDN Web Docs Glossary: Definitions of Web-related terms
A grid row is a horizontal track in a CSS Grid Layout, that is the space between two horizontal grid lines. It is defined by the grid-template-rows property or in the shorthand grid or grid-template properties. In addition, rows may be created in the implicit grid when items are placed outside of rows created in the explicit grid. These rows will be auto sized by default, or can have a size specified with the grid-auto-rows property. When working with alignment in CSS Grid Layout, the axis along which rows run is known as the inline, or row, axis. Learn More Property reference grid-template-rows grid-auto-rows grid grid-template Further reading CSS Grid Layout Guide: Basic concepts of grid layout ...
Grid Tracks - MDN Web Docs Glossary: Definitions of Web-related terms
They are defined in the explicit grid by using the grid-template-columns and grid-template-rows properties or the shorthand grid or grid-template properties. Tracks are also created in the implicit grid by positioning a grid item outside of the tracks created in the explicit grid. The image below shows the first row track on a grid. Track sizing in the explicit grid When defining grid tracks using grid-template-columns and grid-template-rows you may use any length unit, and also the flex unit, fr which indicates a portion of the available space in the grid container. ...
Gutters - MDN Web Docs Glossary: Definitions of Web-related terms
splay: grid; grid-template-columns: repeat(3,1.2fr); grid-auto-rows: 45%; grid-column-gap: 20px; grid-row-gap: 20px; } <div class="wrapper"> <div>One</div> <div>Two</div> <div>Three</div> <div>Four</div> <div>Five</div> </div> In terms of grid sizing, gaps act as if they were a regular grid track however nothing can be placed into the gap. The gap acts as if the grid line at that location has gained extra size, so any grid item placed after that line begins at the end of the gap. The grid-gap properties are not the only thing that can cause tracks to space out. Margins, padding or the use of the space distribution properties in Box Alignment can all contribute to the visible gap - therefore the grid-gap properties should not be seen as equal to "the gutter size" ...
HTTP header - MDN Web Docs Glossary: Definitions of Web-related terms
The value finish at the next CRLF or at the end of the message. ...
Hotlink - MDN Web Docs Glossary: Definitions of Web-related terms
For example, an image hosted on site1.com is shown directly on site2.com. ...
Hypertext - MDN Web Docs Glossary: Definitions of Web-related terms
The term was coined by Ted Nelson around 1965. ...
ISP - MDN Web Docs Glossary: Definitions of Web-related terms
Learn more General knowledge How the Internet works (explanation for beginners) Internet service provider on Wikipedia ...
Intrinsic Size - MDN Web Docs Glossary: Definitions of Web-related terms
In CSS, the intrinsic size of an element is the size it would be based on its content, if no external factors were applied to it. For example, inline elements are sized intrinsically: width, height, and vertical margin and padding have no impact, though horizontal margin and padding do. How intrinsic sizes are calculated is defined in the CSS Intrinsic and Extrinsic Sizing Specification. Intrinsic sizing takes into account the min-content and max-content size of an element. For text the min-content size would be if the text wrapped as small as it can in the inline direction without causing an overflow, doing as much soft-wrapping as possible. For a box containing a string of text, the min-content size would be defined by the longest word. The keyword value of min-content for the widt...
JSON - MDN Web Docs Glossary: Definitions of Web-related terms
Learn more General knowledge JSON on Wikipedia Technical reference JSON on MDN ...
Keyword - MDN Web Docs Glossary: Definitions of Web-related terms
When you use a search engine, you use keywords to specify what you are looking for, and the search engine returns relevant webpages. For more accurate results, try more specific keywords, such as "Blue Mustang GTO" instead of simply "Mustang". Webpages also use keywords in a meta tag (in the <head> section) to describe page content, so search engines can better identify and organize webpages. ...
Main Axis - MDN Web Docs Glossary: Definitions of Web-related terms
Choose column or column-reverse and your main axis will run top to bottom of the page in the block direction. ...
Middleware - MDN Web Docs Glossary: Definitions of Web-related terms
parts of a system to communicate and manage data. It is the software that handles communication between components and input/output, so developers can focus on the specific purpose of their application. In server-side web application frameworks, the term is often more specifically used to refer to pre-built software components that can be added to the framework's request/response processing pipeline, to handle tasks such as database access. Learn more General knowledge Middleware_(distributed_applications) on Wikipedia Middleware on Wikipedia ...
MitM - MDN Web Docs Glossary: Definitions of Web-related terms
tter and only then send it to whom you intended to sent the letter for. The original recipient would then mail you a letter back, and the mailman would again open the letter, read it, eventually modify it, repackage it, and give it to you. You wouldn't know there's a man in the middle in your communication channel - the mailman is invisible to you and to your recipient. In physical mail and in online communication, MITM attacks are tough to defend. A few tips: Don't just ignore certificate warnings. You could be connecting to a phishing server or an imposter server. Sensitive sites without HTTPS encryption on public Wi-Fi networks aren't trustworthy. Check for HTTPS in your address bar and ensure encryption is in-place before logging in. Learn more OWASP Article: Man-in-the-middle ...
Network throttling - MDN Web Docs Glossary: Definitions of Web-related terms
et speeds for developers creating web applications in a corporate office building on a powerful computer are generally very fast. As a developer, tech writer, or designer, this is likely your experience. The network speeds of a mobile user accessing that web application, possibly while traveling or in a remote area with poor data plan covereage, will likely be very slow, if they are able to get online at all. Network throttling enables a developer to emulate an experience of a user. Most browser developer tools, such as the browser inspector, provide a function to emulate different network conditions. By emulating your user's experience via network throttling, you can more readily identify and fix load time issues. Browser developer tools generally have network throttling options, to allow yo...
Progressive Enhancement - MDN Web Docs Glossary: Definitions of Web-related terms
Feature detection is generally used to determine whether browsers can handle more modern functionality, while polyfills are often used to add missing features with JavaScript. Special notice should be taken of accessibility. Acceptable alternatives should be provided where possible. ...
Progressive web apps - MDN Web Docs Glossary: Definitions of Web-related terms
Learn more The App Center on MDN Progressive web apps on Google Developers ...
QUIC - MDN Web Docs Glossary: Definitions of Web-related terms
modifications is an extremely slow process. The creation of QUIC allows developers to conduct experiments and try new things faster. QUIC was designed to support the semantics of HTTP/2. It provides multiplexing, flow control, security and congestion control. Key features of QUIC include: Reduction in connection establishment time. Improved congestion control. Multiplexing without head-of-line blocking. Forward error correction. Connection migration. There is limited browser and server support for QUIC today. Resources Chromium Projects Documentation IETF Draft See Also HTTP/2 ...
Round Trip Time (RTT) - MDN Web Docs Glossary: Definitions of Web-related terms
See Also Time to First Byte (TTFB) Latency ...
SEO - MDN Web Docs Glossary: Definitions of Web-related terms
rawl the web, following links from page to page, and index the content found. When you search, the search engine displays the indexed content. Crawlers follow rules. If you follow those rules closely when doing SEO for a website, you give the site the best chances of showing up among the first results, increasing traffic and possibly revenue (for ecommerce and ads). Search engines give some guidelines for SEO, but big search engines keep result ranking as a trade secret. SEO combines official search engine guidelines, empirical knowledge, and theoretical knowledge from science papers or patents. SEO methods fall into three broad classes: technical Tag the content using semantic HTML. When exploring the website, crawlers should only find the content you want indexed. copywriting Write c...
Statement - MDN Web Docs Glossary: Definitions of Web-related terms
Every program consists of a sequence of statements. ...
Synthetic monitoring - MDN Web Docs Glossary: Definitions of Web-related terms
However, it doesn't necessarily reflect what users are experiencing. Synthetic Monitoring involves deploying scripts to simulate the path an end-user might take through a web application, reporting back the performance of the simulator experiences. ...
Telnet - MDN Web Docs Glossary: Definitions of Web-related terms
Telnet is a command line tool and an underlying TCP/IP protocol for accessing remote computers. Learn more Telnet on Wikipedia ...
UI - MDN Web Docs Glossary: Definitions of Web-related terms
User Interface (UI) is anything that facilitates the interaction between a user and a machine. In the world of computers, it can be anything from a keyboard, a joystick, a screen or a program. In case of computer software, it can be a command-line prompt, a webpage, a user input form, or the front-end of any application. Learn More General Knowledge User interface on Wikipedia Front end development on Wikipedia ...
Whitespace - MDN Web Docs Glossary: Definitions of Web-related terms
ce characters and sequential whitespaces are collapsed as a single space in many cases (this behavior can be changed by the white-space CSS property. They are also used as a separator of an element name and its parameters, class names, and so on. In JavaScript ECMAScript(R) 2015 Language Specification specifies several Unicode codepoints as white space: U+0009 CHARACTER TABULATION <TAB>, U+000B LINE TABULATION <VT>, U+000C FORM FEED <FF>, U+0020 SPACE <SP>, U+00A0 NO-BREAK SPACE <NBSP>, U+FEFF ZERO WIDTH NO-BREAK SPACE <ZWNBSP> and Other category "Zs" Any other Unicode "Separator, space" code point <USP>. These characters are usually unnecessary for the functionality of the code. ...
XInclude - MDN Web Docs Glossary: Definitions of Web-related terms
back> tags (the two elements in the language) with all of the attributes of <xi:include> be included in an XML document so as to be resolvable into a single XML document. (Note that this has not been thoroughly tested for all circumstances and may not necessarily reflect the standard behavior completely.) Note also that if you wish to allow xml:base, you will need the xml:base function, and the line beginning var href = ... should become: var href = getXmlBaseLink (/* XLink sans xml:base */ xinclude.getAttribute('href'), /* Element to query from */ xinclude); function resolveXIncludes(docu) { // http://www.w3.org/TR/xinclude/#xml-included-items var xincludes = docu.getElementsByTagNameNS('http://www.w3.org/2001/XInclude', 'include'); if (xincludes) { for (i=0; i < xincl...
Array - MDN Web Docs Glossary: Definitions of Web-related terms
store multiple values in a single variable. This is compared to a variable that can store only one value. Each item in an array has a number attached to it, called a numeric index, that allows you to access it. In JavaScript, arrays start at index zero and can be manipulated with various methods. What an array in JavaScript looks like: let myArray = [1, 2, 3, 4]; let catNamesArray = ["Jacqueline", "Sophia", "Autumn"]; //Arrays in JavaScript can hold different types of data, as shown above. Learn more General knowledge Array on Wikipedia Technical reference JavaScript Array on MDN ...
caret - MDN Web Docs Glossary: Definitions of Web-related terms
This point in the text is called the insertion point. The word "caret" differentiates the text insertion point from the mouse cursor. ...
Character encoding - MDN Web Docs Glossary: Definitions of Web-related terms
An encoding defines a mapping between bytes and text. A sequence of bytes allows for different textual interpretations. By specifying a particular encoding (such as UTF-8), we specify how the sequence of bytes is to be interpreted. For example, in HTML we normally declare a character encoding of UTF-8, using the following line: <meta charset="utf-8"> This ensures that you can use characters from just about any human language in your HTML document, and they will display reliably. Learn more General knowledge Character encoding on W3C Character encoding on Wikipedia ...
HTTPS - MDN Web Docs Glossary: Definitions of Web-related terms
...
Overflowing content - Learn web development
Basic computer literacy, basic software installed, basic knowledge of working with files, HTML basics (study Introduction to HTML), and an idea of how CSS works (study CSS first steps.) Objective: To understand overflow and how to manage it. What is overflow? Everything in CSS is a box. You can constrain the size of these boxes by assigning values of width and height (or inline-size and block-size). Overflow happens when there is too much content to fit in a box. CSS provides various tools to manage overflow. As you go further with CSS layout and writing CSS, you will encounter more overflow situations. CSS tries to avoid "data loss" Let's consider two examples that demonstrate the default behavior of CSS when there is overflow. The first example is a box that has be...
Type, class, and ID selectors - Learn web development
t styling added by the browser, which spaces out headings and paragraphs with margins, everything is close together and we can't see the different paragraphs easily. This kind of behavior can sometimes be seen in "reset stylesheets", which strips out all of the browser styling. Since the universal selector makes global changes, we use it to deal with very specific situations such as the one outlined below. Using the universal selector to make your selectors easier to read One use of the universal selector is to make selectors easier to read and more obvious in terms of what they are doing. For example, if I wanted to select the first child of any descendant element of <article> , no matter what element it was, and make it bold, I could use the :first-child selector, which we will learn mo...
CSS values and units - Learn web development
Unit Relative to em Font size of the parent, in the case of typographical properties like font-size, and font size of the element itself, in the case of other properties like width. ex x-height of the element's font. ch The advance measure (width) of the glyph "0" of the element's font. rem Font size of the root element. lh Line height of the element. vw 1% of the viewport's width. vh 1% of the viewport's height. vmin 1% of the viewport's smaller dimension. vmax 1% of the viewport's larger dimension. Exploring an example In the example below you can see how some relative and absolute length units behave. The first box has a width set in pixels. As an absolute unit t...
Floats - Learn web development
Clearing floats We have seen that the float is removed from normal flow and that other elements will display beside it, therefore if we want to stop the following element from moving up we need to clear i...
CSS layout - Learn web development
is module, you should already: Have basic familiarity with HTML, as discussed in the Introduction to HTML module. Be comfortable with CSS fundamentals, as discussed in Introduction to CSS. Understand how to style boxes. Note: If you are working on a computer/tablet/other device where you don't have the ability to create your own files, you could try out (most of) the code examples in an online coding program such as JSBin or Glitch. Guides These articles will provide instruction on the fundamental layout tools and techniques available in CSS. At the end of the lessons is an assessment to help you check your understanding of layout methods, by laying out a webpage. Introduction to CSS layout This article will recap some of the CSS layout features we've already touched upon in pre...
What is CSS? - Learn web development
r literacy, basic software installed, basic knowledge of working with files, and HTML basics (study Introduction to HTML.) Objective: To learn what CSS is. In the Introduction to HTML module we covered what HTML is, and how it is used to mark up documents. These documents will be readable in a web browser. Headings will look larger than regular text, paragraphs break onto a new line and have space between them. Links are colored and underlined to distinguish them from the rest of the text. What you are seeing is the browser's default styles -- very basic styles that the browser applies to HTML to make sure it will be basically readable even if no explicit styling is specified by the author of the page. However, the web would be a boring place if all websites looked like t...
CSS first steps - Learn web development
nment set up as detailed in Installing basic software, and an understanding of how to create and manage files, as detailed in Dealing with files. Basic familiarity with HTML, as discussed in the Introduction to HTML module. Note: If you are working on a computer/tablet/other device where you don't have the ability to create your own files, you could try out (most of) the code examples in an online coding program such as JSBin or Glitch. Guides This module contains the following articles, which will take you through all the basic theory of CSS, and provide opportunities for you to test out some skills. What is CSS? CSS (Cascading Style Sheets) allows you to create great-looking web pages, but how does it work under the hood? This article explains what CSS is, with a simple syntax exa...
CSS FAQ - Learn web development
Learn › CSS › Howto › CSS FAQ
to the .corpName class is overridden by font-weight: normal; applied to all elements in the body. The use of the * selector should be minimized as it is a slow selector, especially when not used as the first element of a selector. Its use should be avoided as much as possible. Specificity in CSS When multiple rules apply to a certain element, the rule chosen depends on its style specificity. Inline style (in HTML style attributes) has the highest specificity and will override any selectors, followed by ID selectors, then class selectors, and eventually element selectors. The text color of the below <div> will therefore be red. div { color: black; } #orange { color: orange; } .green { color: green; } <div id="orange" class="green" style="color: red;">This is red</div> The rules are more ...
Learn to style HTML using CSS - Learn web development
t some basic experience with using it, its time to dive a bit deeper. This module looks at the cascade and inheritance, all the selector types we have available, units, sizing, styling backgrounds and borders, debugging, and lots more. The aim here is to provide you with a toolkit for writing competent CSS and help you understand all the essential theory, before moving on to more specific disciplines like text styling and CSS layout. Styling text With the basics of the CSS language covered, the next CSS topic for you to concentrate on is styling text -- one of the most common things you'll do with CSS. Here we look at text styling fundamentals, including setting font, boldness, italics, line and letter spacing, drop shadows and other text features. We round off the module by looking at a...
How do you make sure your website works properly? - Learn web development
In this article we go over various troubleshooting steps for a website and some basic actions to take in order to solve these issues. Prerequisites: You need to know how to upload files to a web server. Objective: You will learn how to diagnose and resolve some basic issues you can run into with your website. So you've published your website online? Very good! But are you sure it works properly? A distant web server often behaves quite differently from a local one, so it's a good idea to test your website once it's online. 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. Most of the time it's no big deal, just a simple mistake or an issue with your web hosting configuration. Let's ...
What HTML features promote accessibility? - Learn web development
The following content describes specific features of HTML that can be used to make a web page more accessible to people with different disabilities. Tabbing Users who do not or cannot use pointing devices can Tab through links and, as such, links should be in a logical tabbing order. The tabindex attribute allows you to define this order. If the HTML is linear, as it should be, a logical tabbing order should automatically fall into place. <ul> <li><a href="here.html" tabindex="1">Here</a></li> <li><a href="there.html" tabindex="3">There</a></li> <li><a href="anywhere.html" tabindex="2">Anywhere</a></li> </ul> In this example (which is used purely as a demonstration--do not do this), tabbing would jump from "Here" to "Anywhere" to "There". Link Titles If you have a link that isn'...
How much does it cost to do something on the Web? - Learn web development
s ongoing projects in its own specialized format. Most of the images on the internet are copyrighted, so it is better to check the license of the file before you use it. Sites like Pixabay provide images under CC0 license, so you can use, edit and publish them even with modification for commercial use. Media editors If you want to include video or audio into your website, you can either embed online services (for example YouTube, Vimeo, or Dailymotion), or include your own videos (see below for bandwidth costs). For audio files, you can find free software (Audacity, Wavosaur), or paying up to a few hundred dollars (Sony Sound Forge, Adobe Audition). Likewise, video-editing software can be free (PiTiVi, OpenShot for Linux, iMovie for Mac), less than $100 (Adobe Premiere Elements), or several...
What are hyperlinks? - Learn web development
s and move from one to another. Being human-readable, URLs already made things easier, but it's hard to type a long URL whenever you want to access a document. This is where hyperlinks revolutionized everything. Links can correlate any text string with a URL, such that the user can instantly reach the target document by activating the link. Links stand out from the surrounding text by being underlined and in blue text. Tap or click a link to activate it, or if you use a keyboard, press Tab until the link is in focus and hit Enter or Spacebar. Links are the breakthrough that made the Web so useful and successful. In the rest of this article, we discuss the various types of links and their importance to modern Web design. Deeper dive As we said, a link is a text string tied to a URL, and w...
What is a web server? - Learn web development
ore convenient to store files all on a dedicated web server because: A dedicated web server is typically more available. (up and running) Excusing downtime and systems troubles, a dedicated web server is always connected to the Internet. A dedicated web server can have the same IP address all the time. This is known as a dedicated IP address. (not all ISPs provide a fixed IP address for home lines) A dedicated web server is typically maintained by a third-party. For all these reasons, finding a good hosting provider is a key part of building your website. Examine the various services companies offer. Choose one that fits your needs and budget. (Services range from free to thousands of dollars per month.) You can find more details in this article. Once you have web hosting service, you...
What is accessibility? - Learn web development
's language, so that screen readers read your text properly. Make sure that a user can navigate to all widgets on a page solely with the keyboard, without getting trapped. (At least let them Tab in and out.) And that's just the beginning. Accessibility champions Since 1999, the W3C has operated a working group called the Web Accessibility Initiative (WAI) promoting accessibility through guidelines, support material, and international resources. More details Please refer to: Wikipedia article about accessibility WAI (W3C's Web Accessibility Initiative) Next steps Accessibility can impact both a website's design and technical structure. From a design point of view, we suggest learning about designing for all types of users. If the technical side interests you more, you could le...
Example - Learn web development
</p> </section> <section> <p> <button type="submit">Validate the payment</button> </p> </section> </form> CSS Content h1 { margin-top: 0; } ul { margin: 0; padding: 0; list-style: none; } form { margin: 0 auto; width: 400px; padding: 1em; border: 1px solid #CCC; border-radius: 1em; } div+div { margin-top: 1em; } label span { display: inline-block; width: 120px; text-align: right; } input, textarea { font: 1em sans-serif; width: 250px; box-sizing: border-box; border: 1px solid #999; } input[type=checkbox], input[type=radio] { width: auto; border: none; } input:focus, textarea:focus { border-color: #000; } textarea { vertical-align: top; height: 5em; resize: vertical; } fieldset { ...
How to structure a web form - Learn web development
e (Basic native form controls). For now, read the descriptions carefully as you follow the below instructions, and start to form an appreciation of which wrapper elements we are using to structure the form, and why. To start with, make a local copy of our blank template file and the CSS for our payment form in a new directory on your computer. ...
Sending form data - Learn web development
html: The same form as we saw above in the The POST method section but with the action set to {{ url_for('hello') }}. This is a Jinja2 template, which is basically HTML but can contain calls to the Python code that is running the web server contained in curly braces. url_for('hello') is basically saying "redirect to /hello when the form is submitted". greeting.html: This template just contains a line that renders the two bits of data passed to it when it is rendered. This is done via the hello() function seen above, which runs when the /hello URL is navigated to. Note: Again, this code won't work if you just try to load it into a browser directly. Python works a bit differently to PHP -- to run this code locally you'll need to install Python/PIP, then install Flask using pip3 install flask...
Web forms — Working with user data - Learn web development
f it into the HTML, CSS, and JavaScript topic areas -- form elements are more complex than most other HTML elements, and they also require a close marriage of related CSS and JavaScript techniques to get the most out of them. Note: If you are working on a computer/tablet/other device where you don't have the ability to create your own files, you could try out (most of) the code examples in an online coding program such as JSBin or Glitch. Introductory guides Your first form The first article in our series provides your very first experience of creating a web form, including designing a simple form, implementing it using the right HTML elements, adding some very simple styling via CSS, and how data is sent to a server. How to structure a web form With the basics out of the way, we now...
Dealing with files - Learn web development
your images folder. Open up your index.html file, and insert the following code into the file exactly as shown. Don't worry about what it all means for now -- we'll look at the structures in more detail later in the series. <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>My test page</title> </head> <body> <img src="" alt="My test image"> </body> </html> The line <img src="" alt="My test image"> is the HTML code that inserts an image into the page. We need to tell the HTML where the image is. The image is inside the images directory, which is in the same directory as index.html. To walk down the file structure from index.html to our image, the file path we'd need is images/your-image-filename. For example, our image is called firefox-icon.png, so the file...
HTML basics - Learn web development
is a markup language that defines the structure of your content. HTML consists of a series of elements, which you use to enclose, or wrap, different parts of the content to make it appear a certain way, or act a certain way. The enclosing tags can make a word or image hyperlink to somewhere else, can italicize words, can make the font bigger or smaller, and so on. For example, take the following line of content: My cat is very grumpy If we wanted the line to stand by itself, we could specify that it is a paragraph by enclosing it in paragraph tags: <p>My cat is very grumpy</p> Anatomy of an HTML element Let's explore this paragraph element a bit further. The main parts of our element are as follows: The opening tag: This consists of the name of the element (in this case, p), wrappe...
Use JavaScript within a webpage - Learn web development
h HTML and server-side scripting when possible. ...
Use HTML to solve common problems - Learn web development
Learn › HTML › Howto
ables with columns and rows. It's one of the most complex HTML structures, and mastering it is not easy: How to create a data table How to make HTML tables accessible Data representation How to represent numeric and code values with HTML -- see Superscript and Subscript, and Representing computer code. How to use data attributes Advanced text semantics How to take control of HTML line breaking How to mark changes (added and removed text) -- see the <ins> and <del> elements. Advanced images & multimedia How to add a responsive image to a webpage How to add vector image to a webpage How to add a hit map on top of an image Internationalization HTML is not monolingual. It provides tools to handle common internationalization issues. How to add multiple languages into ...
Creating hyperlinks - Learn web development
download Firefox</p> Other tips: Don't repeat the URL as part of the link text -- URLs look ugly, and sound even uglier when a screen reader reads them out letter by letter. Don't say "link" or "links to" in the link text -- it's just noise. Screen readers tell people there's a link. Visual users will also know there's a link, because links are generally styled in a different color and underlined (this convention generally shouldn't be broken, as users are used to it). Keep your link label as short as possible -- this is helpful because screen readers need to interpret the entire link text. Minimize instances where multiple copies of the same text are linked to different places. This can cause problems for screen reader users, if there's a list of links out of context that are labeled ...
Introduction to HTML - Learn web development
ave a basic work environment set up (as detailed in Installing basic software), and understand how to create and manage files (as detailed in Dealing with files). Both are parts of our Getting started with the web complete beginner's module. Note: If you are working on a computer/tablet/other devices that doesn't let you create your own files, you can try out (most of) the code examples in an online coding program such as JSBin or Glitch. Guides This module contains the following articles, which will take you through all the basic theory of HTML and provide ample opportunity for you to test out some skills. Getting started with HTML Covers the absolute basics of HTML, to get you started -- we define elements, attributes, and other important terms, and show where they fit in the langua...
Images in HTML - Learn web development
ame functionality as an absent image. Therefore, captions and alt text shouldn't just say the same thing, because they both appear when the image is gone. Try turning images off in your browser and see how it looks. A figure doesn't have to be an image. It is an independent unit of content that: Expresses your meaning in a compact, easy-to-grasp way. Could go in several places in the page's linear flow. Provides essential information supporting the main text. A figure could be several images, a code snippet, audio, video, equations, a table, or something else. Active learning: creating a figure In this active learning section, we'd like you to take the finished code from the previous active learning section, and turn it into a figure: Wrap it in a <figure> element. Copy the text...
Multimedia and Embedding - Learn web development
module, you should have a reasonable understanding of the basics of HTML, as previously covered in Introduction to HTML. If you've not worked through this module (or something similar), work through it first, then come back! Note: If you are working on a computer/tablet/other device where you don't have the ability to create your own files, you could try out (most of) the code examples in an online coding program such as JSBin or Glitch. Guides This module contains the following articles which will take you through all the fundamentals of embedding multimedia on webpages. Images in HTML There are other types of multimedia to consider, but it is logical to start with the humble <img> element used to embed a simple image in a webpage. In this article we'll look at how to use it in more...
HTML table advanced features and accessibility - Learn web development
table. Next, add a colspan attribute to make the "SUM" cell span across the first four columns, so the actual number appears at the bottom of the "Cost" column. Let's add some simple extra styling to the table, to give you an idea of how useful these elements are for applying CSS. Inside the head of your HTML document, you'll see an empty <style> element. Inside this element, add the following lines of CSS code: tbody { font-size: 95%; font-style: italic; } tfoot { font-weight: bold; } Save and refresh, and have a look at the result. If the <tbody> and <tfoot> elements weren't in place, you'd have to write much more complicated selectors/rules to apply the same styling. Note: We don't expect you to fully understand the CSS right now. You'll learn more about this when you go ...
HTML Tables - Learn web development
Learn › HTML › Tables
course that includes all the essential information you need to work towards your goal. Get started Prerequisites Before starting this module, you should already have covered the basics of HTML -- see Introduction to HTML. Note: If you are working on a computer/tablet/other device where you don't have the ability to create your own files, you could try out (most of) the code examples in an online coding program such as JSBin or Glitch. Guides This module contains the following articles: HTML table basics This article gets you started with HTML tables, covering the very basics such as rows and cells, headings, making cells span multiple columns and rows, and how to group together all the cells in a column for styling purposes. HTML table advanced features and accessibility This mo...
Asynchronous JavaScript - Learn web development
ncept of asynchronous programming, you should definitely start with the General asynchronous programming concepts article in this module. If you are, then you can probably skip to the Introducing asynchronous JavaScript module. Note: If you are working on a computer/tablet/other device where you don't have the ability to create your own files, you can try out (most of) the code examples in an online coding program such as JSBin or Glitch. Guides General asynchronous programming concepts In this article we'll run through a number of important concepts relating to asynchronous programming, and how this looks in web browsers and JavaScript. You should understand these concepts before working through the other articles in the module. Introducing asynchronous JavaScript In this articl...
JavaScript building blocks - Learn web development
ards your goal. Get started Prerequisites Before starting this module, you should have some familiarity with the basics of HTML and CSS, and you should have also worked through our previous module, JavaScript first steps. Note: If you are working on a computer/tablet/other device where you don't have the ability to create your own files, you could try out (most of) the code examples in an online coding program such as JSBin or Glitch. Guides Making decisions in your code -- conditionals In any programming language, code needs to make decisions and carry out actions accordingly depending on different inputs. For example, in a game, if the player's number of lives is 0, then it's game over. In a weather app, if it is being looked at in the morning, show a sunrise graphic; show stars ...
JavaScript First Steps - Learn web development
CSS. You are advised to work through the following modules before starting on JavaScript: Getting started with the Web (which includes a really basic JavaScript introduction). Introduction to HTML. Introduction to CSS. Note: If you are working on a computer/tablet/other device where you don't have the ability to create your own files, you could try out (most of) the code examples in an online coding program such as JSBin or Glitch. Guides What is JavaScript? Welcome to the MDN beginner's JavaScript course! In this first article we will look at JavaScript from a high level, answering questions such as "what is it?", and "what is it doing?", and making sure you are comfortable with JavaScript's purpose. A first splash into JavaScript Now you've learned something about the theory...
Solve common problems in your JavaScript code - Learn web development
programming? What are constructors and instances, and how do you create them? What different ways are there to create objects in JavaScript? JSON How do you structure JSON data, and read it from JavaScript? How can you load a JSON file into a page? How do you convert a JSON object to a text string, and back again? Events What are event handlers and how do you use them? What are inline event handlers? What does the addEventListener() function do, and how do you use it? Which mechanism should I use to add event code to my web pages? What are event objects, and how do you use them? How do you prevent default event behaviour? How do events fire on nested elements? (event propagation, also related -- event bubbling and capturing) What is event delegation, and how does it work...
Test your skills: JSON - Learn web development
ing, and an inner loop to loop through all the kittens, add up the total of all/male/female kittens, and add those details to the kittenInfo variable string. The last mother cat name should have an "and" before it, and a full stop after it. How do you make sure this can work, no matter how many cats are in the JSON? Why are the para1.textContent = motherInfo; and para2.textContent = kittenInfo; lines inside the displayCatInfo() function, and not at the end of the script? This has something to do with async code. Try updating the live code below to recreate the finished example: Warning: To answer this question, you'll need to write your code into the live code window above. The example won't work locally, or in an environment like CodePen or JSFiddle, because of something called cross-...
Introducing JavaScript objects - Learn web development
on JavaScript. You should also have some familiarity with JavaScript basics before looking at JavaScript objects in detail. Before attempting this module, work through JavaScript first steps and JavaScript building blocks. Note: If you are working on a computer/tablet/other devices where you don't have the ability to create your own files, you could try out (most of) the code examples in an online coding program such as JSBin or Glitch. Guides Object basics In the first article looking at JavaScript objects, we'll look at fundamental JavaScript object syntax, and revisit some JavaScript features we've already looked at earlier on in the course, reiterating the fact that many of the features you've already dealt with are in fact objects. Object-oriented JavaScript for beginners With...
Web performance resources - Learn web development
file types. Use WOFF and WOFF2. These formats have compression built in. Within @font-face use font-display: swap. By using font display swap the browser will not block rendering and will use the backup system fonts that are defined. Optimiize font weight to match the web font as closely as possible. Icon web fonts If possible avoid icon web fonts and use compressed SVGs. To further optimize inline your SVG data within HTML markup to avoid HTTP requests. Tools Learn to use the Firefox Dev Tools to profile your site. Pagespeed Insights can analyze your page and give some general hints to improve performance. Lighthouse can give you a detailed breakdown of many aspects of your site including performance, SEO and accessibility. Test your page's speed using Webpagetest.org, where you ca...
The business case for web performance - Learn web development
optimal performane for users while enabling the business to tap into new markets and deliver custom experiences. key performance indicators Setting key performance indicators (KPI) as objectives can hiltie performance objectives that are also business objectives. KPIs can be both a set of important business metrics in measuring the impact of user experience and performance on the business's top line, and a way of demonstrating the benefits of prioritizing performance. Here are some KPIs to consider: Conversion Rate The percent of your traffic that takes an intended action, such as completing a purchase or signing up for a newsletter. When a business site is slow, it can prevent users from completing their intended task. This can lead to low conversion rates. Time on Site The average t...
JavaScript performance - Learn web development
ltiple, with several additional dependencies. Often times third party scripts and APIs are added, including A/B testing, tracking pixels, and features like maps and support features. All of this JavaScript must be downloaded. Eventually. Performance optimizatins should include: Reducing the amount of JavaScript that is needed. Some features requiring complex JavaScript can be done with a few lines of JavaScript. Requiring a library for other features may improve developer experience, but is all that JavaScript required? Is there a lighter weight or home spun solutions? Some features may not be necessary, and though they may add some bling, is the cost of the feature in terms of performance worth it? Remove unused code Split the JavaScript into smaller files Code-split JavaScript into...
Web performance - Learn web development
scuss the impact video content has on performance, and cover tips like removing audio tracks from background videos can improve performance. JavaScript performance best practices JavaScript, when used properly, can allow for interactive and immersive web experiences -- or it can significantly harm download time, render time, in-app performance, battery life, and user experience. This article outlines some JavaScript best practices that should be considered to ensure even complex content is as performant as possible. HTML performance features Some attributes and the source order of your mark-up can impact the performance or your website. By minimizing the number of DOM nodes, making sure the best order and attributes are used for including content such as styles, scripts, media, and third-p...
Learning area release notes - Learn web development
nderstanding of frameworks, move on to tutorial series covering popular frameworks like React, Ember, and Vue. Our Web Forms learning module now has "Test your skills" assessments accompanying the articles. April 2020 Our new Understanding client-side web development tools module has been released! Learn the essentials of web development tooling, including what kind of tools exist, the command line, package managers, and how to assemble your own functioning tool chain. March 2020 You'll now find "Test your skills" assessments accompanying the articles in the following modules: CSS building blocks JavaScript first steps JavaScript building blocks Introducing JavaScript objects January 2020 The HTML forms module has been significantly updated: It has been retitled Web forms, and...
Server-side website programming - Learn web development
go on to one of the following modules, which show how to work with two very popular server-side languages using appropriate web frameworks. Server-side website programming first steps This module provides technology-agnostic information about server-side website programming such as "what is it?", "how does it differ from client-side programming?", and "why is it useful?". This module also outlines some of the more popular server-side web frameworks and gives guidance on how to select the best one for your site. Lastly, an introduction to web server security is provided. ...
Ember resources and troubleshooting - Learn web development
Overview: Client-side JavaScript frameworks Next Our final Ember article provides you with a list of resources that you can use to go further in your learning, plus some useful troubleshooting and other information. Prerequisites: At minimum, it is recommended that you are familiar with the core HTML, CSS, and JavaScript languages, and have knowledge of the terminal/command line. A deeper understanding of modern JavaScript features (such as classes, modules, etc), will be extremely beneficial, as Ember makes heavy use of them. Objective: To provide further resource links and troubleshooting information. Further resources Ember.JS Guides Tutorial: Super Rentals Ember.JS API Documentation Ember.JS Discord Server -- a forum/chat...
React resources - Learn web development
Objective: To provide further resources for learning more about React. ...
Adding a new todo form: Vue events, methods, and models - Learn web development
er their own todo items into the app, and for that we'll need a text <input>, an event to fire when the data is submitted, a method to fire upon submission to add the data and rerender the list, and a model to control the data. This is what we'll cover in this article. Prerequisites: Familiarity with the core HTML, CSS, and JavaScript languages, knowledge of the terminal/command line. Vue components are written as a combination of JavaScript objects that manage the app's data and an HTML-based template syntax that maps to the underlying DOM structure. For installation, and to use some of the more advanced features of Vue (like Single File Components or render functions), you'll need a terminal with node + npm installed. Objective: To learn about handling ...
Vue resources - Learn web development
Previous Overview: Client-side JavaScript frameworks Next Now we'll round off our study of Vue by giving you a list of resources that you can use to go further in your learning, plus some other useful tips. Prerequisites: Familiarity with the core HTML, CSS, and JavaScript languages, knowledge of the terminal/command line. Vue components are written as a combination of JavaScript objects that manage the app's data and an HTML-based template syntax that maps to the underlying DOM structure. For installation, and to use some of the more advanced features of Vue (like Single File Components or render functions), you'll need a terminal with node + npm installed. Objective: To learn where to go to find further information on Vue, to continue your lea...
Understanding client-side JavaScript frameworks - Learn web development
te applications. First we'll learn what TypeScript is and what benefits it can bring us. Then we'll see how to configure our project to work with TypeScript files. Finally we will go over our app and see what modifications we have to make to fully take advantage of TypeScript features. 8. Deployment and next steps In this final article we will look at how to deploy your application and get it online, and also share some of the resources that you should go on to, to continue your Svelte learning journey. Which frameworks did we choose? We are publishing our initial set of articles with guides focusing on four frameworks. 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 gaine...
Introduction to cross browser testing - Learn web development
ly have several planning meetings with the site owner/client (this might be your boss, or someone from an external company you are building a web site for), in which you determine exactly what the web site should be -- what content and functionality should it have, what should it look like, etc. At this point you'll also want to know how much time you have to develop the site -- what is their deadline, and how much are they going to pay you for your work? We won't go into much detail about this, but cross-browser issues can have a serious effect on such planning. Once you've got an idea of the required featureset, and what technologies you will likely build these features with, you should start exploring the target audience -- what browsers, devices, etc. will the target audience for this sit...
Tools and testing - Learn web development
in this topic, which gives a useful overview of the general area. Modules Understanding client-side web development tools Client-side tooling can be intimidating, but this series of articles aims to illustrate the purpose of some of the most common client-side tool types, explain the tools you can chain together, how to install them using package managers, and control them using the command line. We finish up by providing a complete toolchain example showing you how to get productive. Understanding client-side JavaScript frameworks JavaScript frameworks are an essential part of modern front-end web development, providing developers with tried and tested tools for building scalable, interactive web applications. Many modern companies use frameworks as a standard part of their tooling, s...
Learn web development
vaScript frameworks, and server-side website programming. Note: Our glossary provides terminology definitions. Besides, if you have a specific question about web development, our Common questions section may have something to help you. Random glossary entry Semantics In programming, Semantics refers to the meaning of a piece of code -- for example "what effect does running that line of JavaScript have?", or "what purpose or role does that HTML element have" (rather than "what does it look like?".) Topics covered The following is a list of all the topics we cover in the MDN learning area. Getting started with the web Provides a practical introduction to web development for complete beginners. HTML -- Structuring the web HTML is the language that we use to structur...
Accessibility Information for Core Gecko Developers
vanilla <div>s and <span>s combined with JavaScript rather than declarative markup to describe the behavior of custom widgets such as menus and tree views. These widgets are often not even keyboard focusable, and assistive technologies do not understand these widgets. 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. Mozilla Accessibility Architecture This document explains how we implement the cross-platform accessibility layer in Mozilla. It contains a class hierararchy and an explanation of the accessibility cache. Unix Accessibility Project This document de...
Event Process Procedure
This diagram outlines how events are processed within Gecko. ...
Information for Governments and Other Organizations Evaluating Mozilla
Mozilla's Section 508 Compliance Section 508 is a set of accessibility requirements that help US federal agencies decide what software applications they can use. Mozilla's W3C User Agent Guidelines Evaluation Report W3C's WAI is advancing another important set of accessibility standards called UAAG. These guidelines go much further than Section 508 does and Mozilla is further from doing a good job at satisfying them. ...
Software accessibility: Where are we today?
Keyboard) and Gnopernicus (screenreader and magnifier). However, these solutions are not yet truly usable for real disabled end users. What do I need to do? Mozilla developers Follow the general front-end accessibility requirements: There are a number of potential "gotchas" when developing XUL UI. Please follow the practical techniques put forth listed in the Accessible XUL Authoring Guidelines. These guidelines cover many possible scenarios. If you take a little time to learn them, they will become an unconscious improvement to your design and engineering technique. Ensure correct keyboard accessibility when developing new controls: Mozilla's XUL and HTML widgets already support proper keyboard accessibility, so let's not regress in that area. Make sure that every new UI c...
Index
, Extensions, distribution, publication Now your add-on is published on AMO, check out the following resources: 681 Retiring your extension Extensions, WebExtension, end-of-life, publication There may be occasions where you want to retire one of your extensions. This article suggests the steps you might want to follow, as well as offering some pointers to a suitable timeline. 682 Submitting an add-on Add-ons, Beginner, Tutorial, WebExtensions This article walks through the process of publishing an add-on. If you just want to get started, head to the Submit a New Add-on page on AMO. 683 Source code submission Add-ons, Extensions, Review Policy, distribution To complete the review process at addons.mozilla.org (AMO), reviewers ...
Frequently Asked Questions for Lightweight themes
ck? We're always looking for ways to improve themes, and would love to hear what you think. Visit the Themes forum to send us your feedback. Creating Your Own Themes Can I create my own Theme? Absolutely! All you need to do is create two graphics files in your favorite graphics editing program (e.g., Photoshop). To get started read more about how to create a theme. Are there any content guidelines? Yes. We are big fans of creativity, but want to ensure that the art displayed in the Themes gallery meets a basic set of guidelines. Please review the Terms of Service and Conditions of Use for authoritative and complete language. Do I still retain ownership over artwork that I upload? Yes. Your artwork will always be your artwork. After creating a Lightweight theme, can I edit the design? ...
Adding a new event
super class's this method. Then, copy the additional members which are defined in the class. If aCopyTargets is false, don't copy its event target related members. All new member variables of event classes must be with "m" prefix. Although, a lot of existing members don't have "m" prefix, but you shouldn't use the legacy local rules. If you need to add methods, it's okay to implement them as inline methods. I.e., you can implement new methods in the header files directly. However, if implementing method isn't small and called from a lot of places, implementing it as inline causes to increase binary size. In this case, you should implement the method in WidgetEventImple.cpp. And also, if implementing a method needs to include other header files, you should implement it in WidgetEventImple.c...
A bird's-eye view of the Mozilla framework
integrate modules and packages at startup is a powerful benefit of the object model, which defines a module as a set of one or more XPCOM objects calledcomponents. These objects provide services to client packages and modules and access services provided by other modules through dynamically queryable interfaces. Figure 2 shows this structure. Figure 2. In the diagram above, each horizontal line extending from an object and terminated by an open circle indicates an interface to the object. The client object does not need to know anything about the internal structure or implementation of the provider object in order to take advantage of its services. The client simply queries the provider for a particular service, and if available, accesses that service through an interface defined in XPI...
Adding APIs to the navigator object
This adds a new API, myComponent, to the navigator object, which you can then access as navigator.myComponent. Real-world example You can see an example of how this is used in Firefox by taking a look at how the mozApps API is implemented: dom/apps/Webapps.manifest dom/apps/Webapps.js ...
Makefile - variables
ing current. XPIDL_MODULE Module name to use when generating .xpt files, default to MODULE. XPIDLSRCS Internal: A list of .idl files to generate exported headers from. XPIDL_NAME Name of extension to build see also configure.sh Variables Description BUILD_PROJECT_ARG Command line/environment override CONFIGURE_ENV_ARGS Command line/environment override Directory Variable DIRS A list of subdirectories to build recursively. PARALLEL_DIRS A list of subdirectories to build recursively that may be built concurrently. STATIC_DIRS Subdirectories containin...
Simple Sunbird build
dd_options --disable-optimize Running Sunbird The Sunbird executable can be found in objdir-sb-release/mozilla/dist/bin/ (on Mac, objdir-sb-release/dist/Calendar.app/Contents/MacOS/). Building Sunbird and Lightning If you've set up you build environment as above, then all you need to do is: echo 'ac_add_options --enable-calendar' >> .mozconfig or just add the ac_add_options --enable-calendar line to your .mozconfig with your favourite editor. Then just re-run the "make -f client.mk" command above (you can do the addition before running make for the first time). This will build the lightning extension into src/../objdir-sb/mozilla/dist/xpi-stage/. See this section for information on how to easily integrate Lightning into a nightly version of Thunderbird. How to build again later In your c...
Updating NSPR or NSS in mozilla-central
Apply the patches. If merging is required, update the patch file. If a patch is no longer needed, remove...
pymake
py -f client.mk. To run tests instead of typing make mochitest-plain in the object directory, you would type python ../build/pymake/make.py mochitest-plain. Alternately, if you would like to simply type in pymake -f client.mk from within the MINGW32 shell. While in the shell type cd ~ (without quotes). Type touch .profile Using any appropriate text editor open .profile and add the following line in the file (assuming your mozilla-central is at C:/mozilla-central, if not, adjust your path accordingly.) alias pymake=C:/mozilla-central/build/pymake/make.py Save your .profile edit and close the shell, then restart the shell. Try typing just pymake into the shell and press enter. This should come back with "No makefile found." If it does, your pymake alias is connected and you are ready ...
Creating Custom Events That Can Pass Data
lassInfo.cpp Mozilla contains many convenience macros to make changes like the one you're making easier. Your modification of this file is basically just two macro calls. Try to make sure of two things: Keep your stuff at the back. You know never know what depends on that enum you modified Keep your stuff organized. Same reason as above. You need to make the following two modifications: around line 1000: NS_DEFINE_CLASSINFO_DATA({truncated name}, nsDOMGenericSH, DOM_DEFAULT_SCRIPTABLE_FLAGS) around line 2900: DOM_CLASSINFO_MAP_BEGIN({truncated name}, nsIDOM{truncatedName}) DOM_CLASSINFO_MAP_ENTRY(nsIDOM{truncated name}) DOM_CLASSINFO_EVENT_MAP_ENTRIES DOM_CLASSINFO_MAP_END Remember, {truncated name} is the same as above. mozilla/content/events/src/nsEventDispatcher.cpp Note: In the...
Gecko Logging
Special module name append Append new logs to existing log file. sync Print each log synchronously, this is useful to check behavior in real time or get logs immediately before crash. raw Print exactly what has been specified in the format string, without the process/thread/timestamp, etc. prefix. timestamp Insert timestamp at start of each log line. rotate:N This limits the produced log files' size. Only most recent N megabytes of log data is saved. We rotate four log files with .0, .1, .2, .3 extensions. Note: this option disables 'append' and forces 'timestamp'. For example, if you want to specify "sync", "timestamp" and "rotate": set MOZ_LOG="example_logger:3,timestamp,sync,rotate:10" To adjust the logging after F...
Interface development guide
XPCOM interfaces define classes that are implemented to provide key functionality in the Mozilla platform. The articles linked from this page offer guidelines for developing and using these interfaces. Documentation XPIDL The XPCOM Interface Description Language is used to specify XPCOM interface classes. IDL interface rules Design guidelines and rules when creating and changing XPCOM interfaces. If you're going to be changing an interface, be sure to read these first! Commenting IDL for better documentation A guide explaining how to properly comment your interface's IDL in order to ensure that not only can others understand your interface, but to ensure that the documentation here on MDC is as accurate as possible. Community View Mozilla embedding forums... Mailing list ...
Contributing to the Mozilla code base
ake getting involved a little easier: Codetribute - our site for finding bugs that are mentored, some are good first bugs, some are slightly harder. Your mentor will help guide you with the bug fix and through the submission and landing process. Good First Bugs - are the best way to take your first steps into the Mozilla ecosystem. They're all about small changes, sometimes as little as a few lines, but they're a great way to learn about setting up your development environment, navigating Bugzilla, and making contributions to the Mozilla codebase. Visit firefox-dev.tools - we list Firefox Developer Tools bugs for new contributors. Student Projects - are larger projects, such as might be suitable for a university student for credit. Of course, if you are not a student, feel free to fix on...
Developer guide
ce Performance guides and utilities to help you make your code perform well (and to play nicely with others). The Mozilla platform Information about the workings of the Mozilla platform. Mozilla Much more additional information about Mozilla coding practices. Adding APIs to the navigator object How to augment the window.navigator object with additional APIs. Interface Compatibility Guidelines for modifying scriptable and binary APIs in Mozilla. Customizing Firefox Information about creating customized versions of Firefox. Task-Graph Generation What controls the jobs that run on a push to version control? How can you change that? Obsolete Build Caveats and Tips A place to put build tips which are no longer relevant to building the latest version of the code from main but are re...
Error codes returned by Mozilla APIs
not exist. XXX currently unused - consider removing. NS_ERROR_CONNECTION_REFUSED (0x804B000D) NS_ERROR_NET_TIMEOUT (0x804B000E) NS_ERROR_IN_PROGRESS (0x804B000F) The requested action could not be completed while the object is busy. Implementations of nsIChannel.asyncOpen() will commonly return this error if the channel has already been opened (and has not yet been closed). NS_ERROR_OFFLINE (0x804B0010) NS_ERROR_NO_CONTENT (0x804B0011) Returned from nsIChannel.asyncOpen() to indicate that OnDataAvailable will not be called because there is no content available. This is used by helper app style protocols (for example, mailto). NS_ERROR_UNKNOWN_PROTOCOL (0x804B0012) The URI scheme corresponds to an unknown protocol handler. NS_ERROR_PORT_ACCESS_NOT_ALLOWED (0x804B0013) NS_...
Frame script loading and lifetime
Loading frame scripts To load a frame script use the loadFrameScript() function. This line of code loads a frame script into the currently selected tab. The script just writes "foo" to the command line: // chrome script var mm = gBrowser.selectedBrowser.messageManager; mm.loadFrameScript('data:,dump("foo\\n")', true); loadFrameScript() takes two mandatory parameters: A URL that points to the frame script you want to load A boolean flag, allowDelayedLoad Note: if the message manager is a global frame message manager or a window message manager, loadFrameScript() may load the script multiple times, once in each applicable frame. chrome: URLs Extension developers usually use a chrome:// URL to refer to the frame scripts. To define the mapping between a chrome:// URL and a fra...
HTMLIFrameElement.getStructuredData()
Specification Not part of any specification. ...
mozbrowsererror
A custom object. detail The detail property returns an anonymous JavaScript object with the following properties: type A DOMString representing the type of error that occurred. ...
::-moz-tree-cell
Activated by the properties attribute. Associated elements <xul:treecell> Style properties background border margin outline padding visibility ...
::-moz-tree-row
ing the Web: it will not work for every user. There may also be large incompatibilities between implementations and the behavior may change in the future. The ::-moz-tree-row CSS pseudo-element is used to select rows and apply styles to tree rows. Associated elements treerow Syntax treechildren::-moz-tree-row { style properties } Style properties background border margin outline padding display -moz-appearance Examples treechildren::-moz-tree-row( foo bar ) { margin: 2%; } ...where... <treerow properties="foo">...</treerow> ...
overflow-clip-box
andard and is not on a standards track. Do not use it on production sites facing the Web: it will not work for every user. There may also be large incompatibilities between implementations and the behavior may change in the future. The overflow-clip-box CSS property specifies relative to which box the clipping happens when there is an overflow. It is short hand for the overflow-clip-box-inline and overflow-clip-box-block properties. /* Keyword values */ overflow-clip-box: padding-box; overflow-clip-box: content-box; /* Two values */ overflow-clip-box: padding-box content-box; overflow-clip-box: content-box content-box; /* Global values */ overflow-clip-box: inherit; overflow-clip-box: initial; overflow-clip-box: unset; Note: On Gecko, by default, padding-box is used everywhere, b...
MozBeforePaint
You can determine this value by looking at window.mozAnimationStartTime. ...
Geckoview-Junit Tests
ied class name including the package, e.g. org.mozilla.geckoview.test.ContentDelegateTest. To run just one test: mozilla-central$ mach geckoview-junit <class>#<test> To run more than one test: mozilla-central$ mach geckoview-junit <class1>#<test1> <class2>#<test2> mach geckoview-junit also supports running a list of tests that are specified in a text file. Each test must be listed on its own line. For example: <class1>#<test1> <class2> <class3>#<test2> <class3>#<test3> To run the tests specified in the file: mozilla-central$ mach geckoview-junit --test-filters-file <path-to-filter-file> Disabling one failing test There is no manifest listing the geckoview junit tests. To disable a single test, edit the source code and insert JUnit's @Ignore annotation before the existing @Test an...
Getting Started with Chat
re still useful for our new home. Please see https://wiki.mozilla.org/Matrix for up-to-date information. General Rules and Etiquette Once you have your client set up (see software below) and are connected, there are some basic rules you should follow to ensure the most enjoyable and productive experience: As with all Mozilla forums and events, agreeing to our Community Participation Guidelines is a requirement for participation. Try to keep messages as concise as possible. If you have something long to post, a code snippet for example, use paste.mozilla.org and paste the generated URL in IRC instead. When addressing someone directly, try to use name: message format. For example, "ashughes: good morning!" Every channel has its own topic. Try to keep your messages within that subject...
How to add a build-time test
lled as a standalone executable, a few things must be done. For standalone executables, if one sets up the right variables, then the rules.mk file will do lots of magic and most of the heavy lifting. A simple example of adding a test is in . Note that the following variables are supplied by the rules.mk file: CPPSRCS, SIMPLE_PROGRAMS, RUN_TEST_PROGRAM. XPCShell tests Here are the simple guidelines for adding an xpcshell test to the build system. For now, enclose your test-related code (in the makefile) with ifdef ENABLE_TESTS Run the test program from the "check" target in the makefile. (example to run the TestCookie program) In the test program: If the test fails, exit with a non-zero status and/or print the string "FAIL" to stdout If the test passes, exit with a zero ...
Introduction to Layout in Mozilla
ering Content sink has "notification limits" Efficiency vs. responsiveness trade-off Frame construction runs to completion CSS parsing runs to completion Reflow runs to completion (mostly) Painting runs to completion Future (?) Tech Talks Content model and DOM - jst, jkeiser Parser and content sink (esp. ...
JavaScript Tips
lways returns the original variable if it succeeds. XPConnect knows all about tearoffs and modifies the object that you QueryInterface or instanceof to cache all its known interfaces. When passing an object to an XPCOM method it is helpful if the object you pass is an XPCOM object, so that the C++ method access a C++ object. However, this is not always necessary or desirable. For instance the offline observer declared above is a JavaScript object that is registered with an XPCOM object, so that the call back from XPCOM executes the JavaScript method. Some XPCOM methods expect an object that implements several interfaces thus requiring you to write a QueryInterface method. However, in JavaScript this is quite simple even in the case of a weak reference which in C++ requires a helper class: v...
Sqlite.jsm
odule is a promise-based wrapper around the Storage/SQLite interface. Sqlite.jsm offers some compelling advantages over the low-level Storage XPCOM interfaces: Automatic statement management. Sqlite.jsm will create, manage, and destroy statement instances for you. You don't need to worry about caching created statement instances, destroying them when you are done, etc. This translates to fewer lines of code to talk to SQLite. All operations are asynchronous. Use of synchronous Storage APIs is discouraged because they block the main thread. All the functionality in Sqlite.jsm is asynchronous. Easier memory management. Since Sqlite.jsm manages statements for you, it can perform intelligent actions like purging all cached statements not in use, freeing memory in the process. There is even a ...
Using JavaScript code modules
s "modules" and is used by XUL Runner and Firefox. Code modules are simple JavaScript files with a .js or .jsm extension. <alias> must be unique to your add-on, as the application and other extensions share the same namespace for all aliases. ...
Bootstrapping a new locale
enses cp -R mozilla-1.9.x/security/manager/locales/ ab-CD/security cp -R mozilla-1.9.x/toolkit/locales/ ab-CD/toolkit Getting started Change your directory to the new working directory so you are in the ~/[your working directory]/[ab-CD]/ path and can start localizing. ...
Index
It is aimed at Mozilla and extension developers. 42 gettext Internationalization, Localizability, Localization gettext lets you define and use singular and plural forms of a string. To take advantage of this functionality, you need to use a different keyword (i.e. different gettext function name) for string which are su...
Localization and Plurals
calizing to the browser's current locale as well as getting methods to localize to a desired plural rule. The latter ability of specifying a plural rule is useful for extensions because the extension doesn't necessarily have to be localized to the browser's locale. Loading PluralForm.jsm Loading the PluralForm module from JavaScript is simple with Components.utils.import. Just put the following line somewhere that will be evaluated before you want to use PluralForm. At the top of your JavaScript file is fine. Components.utils.import("resource://gre/modules/PluralForm.jsm"); Methods: get These methods make use of the browser's current locale specified by chrome://global/locale/intl.properties's pluralRule value. /** * Get the correct plural form of a word based on the number * * @param...
Localization content best practices
ns belonging to different categories and are treated differently by the grammar), case and inflections (changes are made to a word to indicate differences in meaning or use) and so on. In modern English, such features are rare and are mainly restricted to plural -s and verb forms (e.g. go > went is a form of inflection). Examples from other languages: Gender in German: nouns can be either masculine, feminine or neuter. The most obvious impact is that the definite article which in English is always the can either be der, die or das. To complicate matters, if the grammatical context changes, the article will change: Der Text 'the text' changes to Wollen Sie den Text speichern? 'Do you want to save the text?' Suffixes in Basque: where English tends to use expressions such as 'to the' or 'from...
Localizing with Pontoon
venian) Switches between languages to localize. Go Opens project-resource-locale selection. Progress indicator Displays your progress on the resource being localized. More details are available in the popup. User menu Allows for user-specific tasks, like commiting to repository, downloading files and signing out. Info menu Gives important information, like the anticipated project timeline and a list of keyboard shortcuts. Alright, how about we do some translating now? Translate strings When using Pontoon for localization, you have a couple of options to translate your strings. You can translate in-context, out-of-context, or a combination of the two. We'll start with looking at in-context translation. In-context Pontoon's in-context translation mode is what puts it abo...
Localization technical reviews
ser/defines.inc) contains the names of all contributors that a localization team would like to credit the work to. Localizers can specify the team responsible for the work by listing the name just after the MOZ_LANGPACK_CREATOR. The team can also wrap contributors with <em:contributor> tags just after the MOZ_LANGPACK_CONTRIBUTORS section. Make sure that the the text content is wrapped with emptyLines. Leading comments are OK, but watch out for #filter emptyLines #define ... # comment #define ... #unfilter emptyLines In toolkit/defines.inc, the native name of the language is specified, which is used as description for the built language packs. region.properties Though locales might like to specify changes from the beginning, the region.properties files will be reverted to en-US. Cha...
Setting up the infrastructure
s-po.sh will give you a bird's-eye view on the statistics of translated, fuzzy and missing strings for each locale. Create en-US locale (locale/LC_MESSAGES/) in the locale folder. Create an empty filed named messages.po in the locale/LC_MESSAGES folder. Create new locales by repeating steps 4 and 5 for each of them. Review the English content following the web content localizability guidelines. Review your code following the web applications localizability guidelines. Run extract-po.sh. Restart Apache to reload gettext files (necessary for any text changes). Merge the l10n branch back to main trunk (if the l10n branch was created in step 1). Copy files over to SVN. Set up the staging server. Set up a cronjob to svn up every n minutes. Set up a cronjob to run compile-mo.
Basics
a 6 [ f ( a ) + 4 f ( a + b 2 ) + f ( b ) ] - ( b - a ) 5 4 ! 5 ! f ( 4 ) ( ? ) , a <= ? <= b | x | = { - x if x < 0 x otherwise You can also typeset 2D mathematical constructs such as matrices. The following example shows the i-th step of the multiplication of a matrix A by a vector x (notice how ai1 , ... , ain , x1 are on the same baseline, other alignments are possible): i-th row [ a11 a12 a13 ... a1n : : : ... : ai1 ai2 ai3 ... ain : : : : an1 an2 an3 ... a n n ] [ x1 x2 x3 : xn ] In Mozilla, MathML runs inside the main browser. So it responds to other browser operations such as the zoom (try View -> Text Zoom), a...
Test
If not, please consider installing some MathML fonts. ...
MathML3Testsuite
not able to explain Gecko's rendering. However, any report is welcome on the Tracking bug for the MathML testsuite. Characters Blocks Symbols Variants EntityNames NumericRefs UTF8 General Clipboard GenAttribs Math Presentation CSS DynamicExpressions GeneralLayout ScriptsAndLimits TablesAndMatrices TokenElements Topics Accents BiDI ElementaryMathExamples EmbellishedOp LargeOp LineBreak Nesting StretchyChars WhiteSpace TortureTests ErrorHandling Original Document Information Author(s): Frederic Wang Other Contributors: Last Updated Date: May 26, 2010 Copyright Information: Portions of this content are (C) 2010 by individual mozilla.org contributors; content available under a Creative Commons license | Details. ...
MathML In Action
seeing nifty equations throughout this page? No? Too bad. Here is a screenshot of what you are missing. Download a MathML-enabled Mozilla build to remedy this sad situation. You already have a MathML-enabled build but what you see on the screenshot is not what you get? In that case you are probably missing some crucial MathML fonts. Now that you are well-equipped, you should be able to see this inline equation with varying accents: x ^ + xy ^ + xyz ^ . Next to it is this tiny formula, det | a c b d | = a d - b c , which can also be typeset in displaystyle as det | a b c d | = a d - b c . Mathematical typesetting is picky. MathML in Mozilla aims at complying with the MathML specification so that What You See Is What You Markup, or to put it another way What Y...
Various MathML Tests
2 + 4 * x + p q = 0 , with this <mfrac> hanging here d * T ( i + j n ) + p y * q p x * b x + a + c d in the middle of a lot of running text to try to explain what this means to those who care to read. Testing MathML <merror>, <mtext>: This is a text in mtext This is a text in merror Testing <maction>: Click to toggle between expressions, and watch the status line onmouseover/onmouseout: statusline#First Expression First Expression statusline#Second Expression Second Expression statusline#And so on... And so on.. Click the expression below to see several definitions of pi: ? = 3.14159265358... ? = 2i Log 1-i 1+i ? = 2 . 2 2 . 2 2 + 2 . 2 2 + 2 + 2 ... ? 4 = 1 2 + 12 2 + 32 2 + 52 ...
MathML Demo: <mo> - operator, fence, separator, or accent
es as in the following example [ [ A B ] + [ B A ] ] + [ A B ] LaTeX fences that are built into fractions (\binom, etc.) are not stretchy, but they are taller in displays. Emulating this behavior in MathML would require a context sensitive transaltion. Further, non-stretchy fences aren't usually desirable. Hence we script binomial fences as stretchy in MathML. Some examples of inline fractions ( 8 - 5 8 ) + [ 1 2 ] + ? 1 2 2 ? + ? 1 x y x + 1 ? + | e - 2 ? t ? | with built in fences. Same expression in a display. ( 8 - 5 8 ) + [ 1 2 ] + ? 1 2 2 ? + ? 1 x y x + 1 ? + | e - 2 ? t ? | ...
Mozilla Web Developer FAQ
rs sent by the server by using the LiveHTTPHeaders extension or by using the Web sniffer. Class names and ids are case-sensitive. The element selectors are case-sensitive with XML. Style sheet processing instructions are only allowed in the prolog of XML documents. Also, they only work in XML documents--not in documents served as text/html. width and height do not apply to non-replaced inline elements such as (by default) <span>. text-align: center; centers inline content within a block. It does not (and should not) center the block box itself. A block is centered by setting its margin-left and margin-right to auto and its width to a value that makes the block narrower than its containing block. It is also possible, although not very likely, that you are seeing a bug. JavaScript d...
Mozilla Style System Documentation
IPresContext::ResolveStyleContextFor, nsIPresContext::ResolvePseudoStyleContextFor, and.nsIPresContext::ResolveStyleContextForNonElement There is also a fourth method, nsIPresContext::ProbePseudoStyleContextFor, which creates a style context only if there are style rules that match the pseudo-element. This is useful for the pseudo-elements defined in the CSS specification (:before, :after, :first-line, :first-letter), but few of Mozilla's custom pseudo-elements, many of which are hacks for further formatting objects that we create. The pres context forwards these calls to its style set object (StyleSetImpl, interface nsIStyleSet), which does the real work (and also maintains the lists of stylesheets and owns the rule tree). These methods may all return an existing style context rather than a n...
Activity Monitor, Battery Status Menu and top
show up more quickly. All of these battery status menu observations are difficult to make reliably and so should be treated with caution. It is clear, however, that the window used by the battery status menu is measured in seconds or minutes, which is much less than the 8 hour window used for "Average Energy Impact" in Activity Monitor. top top is similar to Activity Monitor, but is a command-line utility. To see power-related measurements, invoke it as follows. top -stats pid,command,cpu,idlew,power -o power -d Note: -a and -e can be used instead of -d to get different counting modes. See the man page for details. It will show periodically-updating data like the following. PID COMMAND %CPU IDLEW POWER 50300 firefox ...
GC and CC logs
e the buttons under "Save GC & CC logs." "Save concise" will generate a smaller CC log, "Save verbose" will provide a more detailed CC log. (The GC log will be the same size in either case.) With multiprocess Firefox, you can't record logs from the content process, due to sandboxing. You'll need to disable sandboxing by setting MOZ_DISABLE_CONTENT_SANDBOX=t when you run Firefox. From the commandline TLDR: if you just want shutdown GC/CC logs to debug leaks that happen in our automated tests, you probably want something along the lines of: MOZ_DISABLE_CONTENT_SANDBOX=t MOZ_CC_LOG_DIRECTORY=/full/path/to/log/directory/ MOZ_CC_LOG_SHUTDOWN=1 MOZ_CC_ALL_TRACES=shutdown ./mach ... As noted in the previous section, with multiprocess Firefox, you can't record logs from the content process, due...
GPU performance
harder than with CPUs because of the asynchronous and massively parallel architecture. Tools PIX - Can do timing of Direct3D calls. Works reasonably well with Firefox. See also Debugging With PIX. NVIDIA PerfHUD - Last I checked required a special build to be used. NVIDIA Parallel Nsight - Haven't tried. AMD GPU ShaderAnalyzer - Will compile a shader and show the machine code and give static pipeline estimations. Not that useful for Firefox because all of our shaders are pretty simple. AMD GPU PerfStudio - I had trouble getting this to work, and can't remember whether I actually did or not. Intel Graphics Performance Analyzers - Haven't tried. APITrace - Open source, works OK. PVRTrace - Doesn't seem to emit traces on android/Nexus S. Looks like it's designed for X11-based linux-ARM devices, ...
Intel Power Gadget
erstanding the Power Gadget output The following screenshot (from the Mac version) demonstrates the available measurements. The three panes display the following information: Power: Shows power estimates for the package and the cores ("IA"). These are reasonably useful for power profiling purposes, but Mozilla's rapl utility provides these along with GPU and RAM estimates, and in a command-line format that is often easier to use. Frequency: Shows operating frequency measurements for the cores ("IA") and the GPU ("GT"). These measurements aren't particularly useful for power profiling purposes. Temperature: Shows the package temperature. This is interesting, but again not useful for power profiling purposes. Specificially, the temperature is a proxy measurement that is affected by proc...
Leak-hunting strategies and tips
useful. It may just involve setting the XPC_SHUTDOWN_HEAP_DUMP environment variable to a file name, but I haven't tested that.) Post-processing of stack traces On Mac and Linux, the stack traces generated by our internal debugging tools don't have very good symbol information (since they just show the results of dladdr). The stacks can be significantly improved (better symbols, and file name / line number information) by post-processing. Stacks can be piped through the script tools/rb/fix_stacks.py to do this. These scripts are designed to be run on balance trees in addition to raw stacks; since they are rather slow, it is often much faster to generate balance trees (e.g., using make-tree.pl for the refcount balancer or diffbloatdump.pl --use-address for trace-malloc) andthen run the balanc...
Power profiling overview
t RAPL. Tools that can take RAPL readings include the following. tools/power/rapl: all planes; Linux and Mac. Intel Power Gadget: PKG and PP0 planes; Windows, Mac and Linux. powermetrics: PKG plane; Mac. perf: all planes; Linux. turbostat: PKG, PP0 and PP1 planes; Linux. Of these, tools/power/rapl is generally the easiest and best to use because it reads all power planes, it's a command line utility, and it doesn't measure anything else. Proxy measurements The next best measurements are proxy measurements, i.e. measurements of things that affect power consumption such as CPU activity, GPU activity, wakeup frequency, C-state residency, disk activity, and network activity. Some of these are measured on a global basis, and some can be measured on a per-process basis. Some can also be ...
Profiling with Instruments
elect "Time Profiler" from the "Choose a profiling template for:" dialog. In the top left, next to the record and pause button, there will be a "[machine name] > All Processes". Click "All Processes" and select "firefox" from the "Running Applications" section. Click the record button (red circle in top left) Wait for the amount of time that you want to profile Click the stop button Command line tools There is instruments and iprofiler. How do we monitor performance counters (cache miss etc.)? Instruments has a "Counters" instrument that can do this. Memory profiling Instruments will record a call stack at each allocation point. The call tree view can be quite helpful here. Switch from "Statistics". This malloc profiling is done using the malloc_logger infrastructure (similar to Mall...
Profiling with Xperf
Xperf is part of the Microsoft Windows Performance Toolkit, and has functionality similar to that of Shark, oprofile, and (for some things) dtrace/Instruments. For stack walking, Windows Vista or higher is required; I haven't tested it at all on XP. This page applies to xperf version 4.8.7701 or newer. To see your xperf version, either run 'xperf' on a command line with no arguments, or start 'xperfview' and look at Help -> About Performance Analyzer. (Note that it's not the first version number in the About window; that's the Windows version.) If you have an older version, you will experience bugs, especially around symbol loading for local builds. Installation For all versions, the tools are part of the latest Windows 7 SDK (SDK Version 7.1). Use the web installer to install at ...
Profiling with the Gecko Profiler and Local Symbols on Windows
longer needed. The profiler automatically reads symbols from the pdb files that are generated during the build process. You probably need a 64 bit build of Firefox for this to work, though. It looks like we consume too much memory when creating the symbol table for this to work in 32 bit Firefox builds. Unfortunately, 32 bit is still the default when building Firefox locally. You need to add the lines ac_add_options --target=x86_64-pc-mingw32 and ac_add_options --host=x86_64-pc-mingw32 to your mozconfig in order to build a 64 bit build of Firefox. Profiling local talos runs If you would like to use the Gecko Profiler with a local talos run of a local build of Firefox for Windows, you will need to point talos to a zipfile containing breakpad-style symbols for your build. Follow the steps bel...
Reporting a Performance Problem
w it Capturing and sharing a profile While the profiler is recording, reproduce the performance problem. If possible let the problem manifest itself for 5-10 seconds. Press Ctrl+Shift+2 or click on the profiler toolbar icon in the top right and select 'Capture'. Try to do this within a few seconds from reproducing the performance problem as only the last few seconds are recorded. If the timeline has a large red block it's a good sign. The data will open in a new tab. Wait until the "Symbolicating call stacks" notification disappears before sharing the profile. There will be a button in the top right labeled 'Publish' which will allow you to upload this profile and once completed will write out a link. Before uploading, the publish button asks you what data you'd like to publish to o...
Scroll-linked effects
can find good ways to support them in the compositor. Currently there are a few proposals for APIs that would allow such effects, and they all have their advantages and disadvantages. The proposals currently under consideration are: Web Animations: A new API for precisely controlling web animations in JavaScript, with an additional proposal to map scroll position to time and use that as a timeline for the animation. CompositorWorker: Allows JavaScript to be run on the compositor thread in small chunks, provided it doesn't cause the framerate to drop. Scroll Customization: Introduces a new API for content to dictate how a scroll delta is applied and consumed. As of this writing, Mozilla does not plan to support this proposal, but it is included for completeness. Call to action If you h...
about:memory
egated into totals for the whole browser, as the following example shows. ...
Phishing: a short definition
A relatively simple, yet effective, phishing scheme is sending an email with a fake invoice of a person's favorite shopping site. ...
A brief guide to Mozilla preferences
or both Firefox and Thunderbird. A preference is read from a file, and can call up to four methods: pref(), user_pref(), sticky_pref() and lockPref(). All preferences files may call pref(), user_pref() and sticky_pref(), while the config file in addition may call lockPref(). Preferences files To protect privacy by preventing inadvertent loading of a preferences file in the browser, the first line of the file is made un-parseable and skipped on loading. The only exception to this is user.js . On application launch, several preferences files are loaded. They are: Default preference files Firefox ships default preferences in several files, all in the application directory: greprefs.js - preferences shared by all applications using the Mozilla platform services/common/services-c...
ui.textSelectBackground
tBackground saves the color in which the background of a text selection in the user interface or in content will be styled. Type:string with RGB hex value as color code Default value:#EF0FFF (blue) [1] Exists by default: no Application support: before Gecko 1.7 Status: Active; last updated 2015-09-21 Introduction: Pushed to trunk on 2000-04-13 Bugs: bug 34704 [1]: nsXPLookAndFeel.cpp, line 628, retrieved 2015-09-21 ...
ui.textSelectForeground
electForeground saves the color in which the text of a text selection in the user interface or the content will be styled. Type:string with RGB hex value as color code Default value:#FFFFFF (white) [1] Exists by default: no Application support: before Gecko 1.7 Status: Active; last updated 2015-09-21 Introduction: Pushed to trunk on 2000-04-13 Bugs: bug 34704 [1]: nsXPLookAndFeel.cpp, line 635, retrieved 2015-09-21 ...
Preferences system
es> <preference id="pref1" name="pref.name" type="bool"/> </preferences> .. UI elements that refer to the preferences above, e.g.: <checkbox id="check1" preference="pref1" label="&check1.label;" accesskey="&check1.accesskey;"/> </prefpane> <prefpane id="pane2" label="&pane2.title;" src="chrome://uri/to/pane.xul"/> </prefwindow> Pane content can be specified inline or an external chrome URI supplied for pane content to be loaded in via a dynamic overlay. You should be careful to read the HIGs for the platforms you are targeting and use the XUL preprocessor if necessary to set different window titles as appropriate. You should also be careful to specify the width of the window (in em) as appropriate using the preprocessor for each targeted platform, as well ...
A guide to searching crash reports
n the remaining column cells also let you perform a narrower subsequent search with that link's value added to the search criteria. A narrower search You can add criteria to perform a narrower search. For example, to perform a search for all Mac crash reports that occurred while JavaScript garbage collection was running, do the following. Add "Mac OS X" to the "Platform" field. Select "New line", and then choose a field ("is garbage collecting") and an operator ("is true"). The operators available for each field depends on its type. With these criteria added the search form looks like the following screenshot. After clicking on "Search" we get results like those in the following screenshot. The number of crash reports matching this search is in the thousands, i.e. much smaller t...
L20n HTML Bindings
ender": "feminine" } } </script> This data will be available context-wide to all localized strings. For instance, a string could use the information about the user's gender to provide two variants of the translation, like in the example below. See L20n by Example to learn more about L20n's syntax. <invited[$user.gender] { feminine: "{{ $user.name }} has invited you to her circles.", masculine: "{{ $user.name }} has invited you to his circles.", *unknown: "{{ $user.name }} has invited you to their circles." }> Based on the context data defined above, this will produce: Jane has invited you to her circles. Monolingual mode L20n can also operate in the so-called monolingual mode, when there is only one locale available. It doesn't have any specific locale code (internally, it's cal...
L20n Javascript API
move an event listener previously registered with addEventListener. ctx.updateData(ctxdata: Object) Update the context data which will be available to all entities in the context. The ctxdata is an object which extends the context data per key and per level of hierarchy. In other words, the following two calls: ctx.updateData({ user: { name: "Bob" } }); ctx.updateData({ user: { gender: "masculine" } }); will make the internally-stored context data look like this: { "user" : { "name": "Bob", "gender": "masculine" } } ctx.getSync(id: String, ctxdata: Object?) Retrieve a string value of an entity called id. If passed, ctxdata is a simple hash object with a list of variables that extend the context data available for the evaluation of this entity. Returns a string. ctx...
Midas editor module security preferences
r own add-on or Firefox-internal code, and be sure to restore the default settings when you're done! Changing the preferences in Firefox Quit Firefox. If you have Quick Launch running (on Windows, this is an icon in the toolbar), quit that too. Find your Firefox profile directory. Open the user.js file from that directory in a text editor. If there's no user.js file, create one. ...
NSPR build instructions
The easiest way to get these tools is to install the MozillaBuild package. Introduction The top level of the NSPR source tree is the mozilla/nsprpub directory. Although nsprpub is a subdirectory under mozilla, NSPR is independent of the Mozilla client source tree. Building NSPR consists of three steps: run the configure script. You may override the compilers (the CC environment variable) or specify options. ...
Date and Time
This chapter describes the date and time functions in NSPR. NSPR represents time in two ways, absolute time and clock/calendar time. NSPR provides types and constants for both representations, and functions to convert time values between the two. Absolute time representation treats time instants as points along the time line. A time instant is represented by its position on the time line relative to the origin, called the epoch. NSPR defines the epoch to be midnight (00:00:00) 1 January 1970 UTC (Coordinated Universal Time). In this form, time is just a point on the time line. There is no notion of time zone. Clock/calendar time, used for human interfaces, represents time in the familiar year, month, day, hour, minute, second components. In this form, the time zone information is impo...
I/O Functions
PR_TOP_IO_LAYER (PRDescIdentity)-2 #define PR_NSPR_IO_LAYER (PRDescIdentity)0 PR_INVALID_IO_LAYER: An invalid layer identify (for error return). PR_TOP_IO_LAYER: The identity of the top of the stack. PR_NSPR_IO_LAYER: The identity for the layer implemented by NSPR. ...
PR_ASSERT
ession ); Parameters The macro has this parameter: expression Any valid C language expression that evaluates to TRUE or FALSE. Returns Nothing Description This macro evaluates the specified expression. When the result is zero (FALSE) the application terminates; otherwise the application continues. The macro converts the expression to a string and passes it to PR_Assert, using file and line parameters from the compile-time environment. This macro compiles to nothing if compile-time options are not specified to enable logging. ...
PR_Assert
tes arguments to the log and terminates execution. Syntax #include <prlog.h> void PR_Assert ( const char *s, const char *file, PRIntn ln); Parameters The function has these parameters: s A string to be displayed in the log. file The file name of the compilation unit containing this function call. ln The line number within the specified file of this function call. Returns Nothing Description This function displays data in the log. Normally an application would not call this function directly; use PR_ASSERT instead. ...
PR_CWait
s changed. While the thread is waiting, it exits the monitor (just as if it had called PR_CExitMonitor as many times as it had called PR_CEnterMonitor). When the wait has finished, the thread regains control of the monitor's lock with the same entry count as before the wait began. The thread waiting on the monitor resumes execution when the monitor is notified (assuming the thread is the next in line to receive the notify) or when the interval specified in the timeout parameter has been exceeded. When the thread resumes execution, it is the caller's responsibility to test the state of the monitored data to determine the appropriate action. ...
PR_STATIC_ASSERT
UE or FALSE. An expression which cannot be evaluated at compile time will cause a compiler error; see PR_ASSERT for a runtime alternative. Returns Nothing Description This macro evaluates the specified expression. When the result is zero (FALSE) program compilation will fail with a compiler error; otherwise compilation completes successfully. The compiler error will include the number of the line for which the compile-time assertion failed. This macro may only be used in locations where an extern function declaration may be used. ...
Function_Name
Syntax #include <headers.h> ReturnType Function_Name( ParamType ParamName, ParamType ParamName, ); Parameters ParamName Sample: in pointer to a CERTCertDBHandle representing the certificate database to look in ParamName Sample: in pointer to an SECItem whose type must be siDERCertBuffer and whose data contains a DER-encoded certificate Description Long description of this function, what it does, and why you would use it. Describe all side-effects on "out" parameters. ...
Encrypt Decrypt MAC Keys As Session Objects
= NULL; const char *dbdir = NULL; const char *inFileName = NULL; const char *outFileName = NULL; const char *noiseFileName = NULL; secuPWData pwdata = { PW_NONE, 0 }; char * progName = strrchr(argv[0], '/'); progName = progName ? ...
Encrypt and decrypt MAC using token
= NULL; const char *dbdir = NULL; const char *inFileName = NULL; const char *outFileName = NULL; const char *noiseFileName = NULL; secuPWData pwdata = { PW_NONE, 0 }; char * progName = strrchr(argv[0], '/'); progName = progName ? ...
NSS FAQ
Mozilla › Projects › NSS › FAQ
help jump start the integration process. However, there is little or no documentation currently available for the rest of the NSS API. If your application requires sophisticated certificate management, smart card support, or hardware acceleration, your integration effort will be more extensive. Where can I download the NSS tools? Binary builds of NSS for several platforms including the command-line tools can be downloaded from http://ftp.mozilla.org/pub/mozilla.o...y/nss/releases/. NSPR, which you will need as well, can be downloaded from http://ftp.mozilla.org/pub/mozilla.org/nspr/releases/. How can I learn more about TLS? See https://developer.mozilla.org/docs/Glossary/TLS. Licensing Questions How is NSS licensed? NSS is available under the Mozilla Public License, version 2. Is NSS ...
4.3.1 Release Notes
u to build the JSS's matching JNI shared library. We provide the jss4.jar in case you do not want to obtain your own JCE code signing certificate. JSS is a JCE provider and therefore the jss4.jar must be signed. ftp://ftp.mozilla.org/pub/mozilla.org/security/jss/releases/JSS_4_3_1_RTM. Documentation Documentation for JSS 4.3.1 is available as follows: Build Instructions for JSS 4.3.1 Javadoc [online] [zipped] Read the instructions on using JSS. Source may be viewed with a browser (via the MXR tool) at http://mxr.mozilla.org/mozilla/source/security/jss/ The RUN TIME behavior of JSS can be affected by the NSS Environment Variables. Platform Information You can check out the source from CVS by cvs co -r JSS_4_3_1_RTM JSS JSS 4.3.1 works with JDK versions 4 or higher we suggest the lates...
4.3 Release Notes
ect you to build the JSS's matching JNI shared library. We provide the jss4.jar in case you do not want to obtain your own JCE code signing certificate. JSS is a JCE provider and therefore the jss4.jar must be signed. https://archive.mozilla.org/pub/security/jss/releases/JSS_4_3_RTM/ Documentation Documentation for JSS 4.3 is available as follows: Build Instructions for JSS 4.3 Javadoc [online] [zipped] Read the instructions on using JSS. Source may be viewed with a browser (via the MXR tool) at http://mxr.mozilla.org/mozilla/source/security/jss/ The RUN TIME behavior of JSS can be affected by the NSS Environment Variables. Platform Information JSS 4.3 works with JDK versions 4 or higher we suggest the latest. JSS 4.3 requires NSS 3.12 or higher. JSS 4.3 requires NSPR 4.7.1...
JSS
Mozilla › Projects › NSS › JSS
ing JSS to get you started with development after you've built and downloaded it. Release Notes 4.3.1 Release Notes 4.3 Release Notes Older Release Notes Build Instructions Building JSS 4.4.x Building JSS 4.3.x Older Build Instructions Download or View Source Download binaries, source, and javadoc View the source online Testing JSS tests Frequently Asked Questions JSS FAQ Information on JSS planning can be found at wiki.mozilla.org, including: NSS FIPS Validation NSS Roadmap page Community View Mozilla Cryptography forums... Mailing list Newsgroup RSS feed Related Topics Security ...
NSS_3.12.1_release_notes.html
New and revised documents available since the release of NSS 3.11 include the following: Build Instructions for NSS 3.11.4 and above NSS Shared DB Compatibility NSS 3.12.1 shared libraries are backward compatible with all older NSS 3.x shared libraries. A program linked with ol...
NSS_3.12.2_release_notes.html
Bug 432260: [[@ pkix_pl_HttpDefaultClient_HdrCheckComplete - PKIX_PL_Memcpy] crashes when there is no content-length header in the http response Bug 436599: PKIX: AIA extension is not used in some Bridge CA / known certs configuration Bug 437804: certutil -R for cert renewal should derive the subject from the cert if none is specified. Bug 444974: Crash upon reinserti...
NSS 3.12.4 release notes
in libPKIX Bug 391434: avoid multiple encoding/decoding of PKIX_PL_OID to and from ascii string Bug 405297: Problems building nss/lib/ckfw/capi/ with MingW GCC Bug 420991: libPKIX returns wrong NSS error code Bug 427135: Add super-H (sh3,4) architecture support Bug 431958: Improve DES and SHA512 for x86_64 platform Bug 433791: Win16 support should be deleted from NSS Bug 449332: SECU_ParseCommandLine does not validate its inputs Bug 453735: When using cert9 (SQLite3) DB, set or change master password fails Bug 463544: warning: passing enum* for an int* argument in pkix_validate.c Bug 469588: Coverity errors reported for softoken Bug 470055: pkix_HttpCertStore_FindSocketConnection reuses closed socket Bug 470070: Multiple object leaks reported by tinderbox Bug 470479: IO timeout during cert fe...
NSS 3.14.2 release notes
.2 NSS will now make use of the Intel AES-NI and AVX instruction sets for hardware-accelerated AES-GCM on 64-bit Linux systems. Note: the new assembly code requires GNU as version 2.19 or newer. On Red Hat Enterprise Linux 5.x systems, install the binutils220 package and add /usr/libexec/binutils220 to the beginning of your PATH environment variable. Initial manual pages for some NSS command line tools have been added. They are still under review, and contributions are welcome. The documentation is in the docbook format and can be rendered as HTML and UNIX-style manual pages using an optional build target. New Types: in certt.h cert_pi_useOnlyTrustAnchors in secoidt.h SEC_OID_MS_EXT_KEY_USAGE_CTL_SIGNING Notable Changes in NSS 3.14.2 Bug 805...
NSS 3.14 release notes
(but is discouraged) by setting the environment variable of "NSS_HASH_ALG_SUPPORT=+MD5" or by using the NSS_SetAlgorithmPolicy function. Note that SSL cipher suites with "MD5" in their names are NOT disabled by this change; those cipher suites use HMAC-MD5, not plain MD5, and are still considered safe. Maximum key sizes for RSA and Diffie-Hellman keys have been increased to 16K bits. Command line utilities tstclnt, strsclnt, and selfserv have changed. The old options to disable SSL 2, SSL 3 and TLS 1.0 have been removed and replaced with a new -V option that specifies the enabled range of protocol versions (see usage output of those tools). Bugs fixed in NSS 3.14 This Bugzilla query returns all the bugs fixed in NSS 3.14: https://bugzilla.mozilla.org/buglist.cgi?list_id=4643675;resolutio...
NSS 3.15.4 release notes
times return unencrypted, unauthenticated data from PR_Recv New in NSS 3.15.4 New Functionality Implemented OCSP querying using the HTTP GET method, which is the new default, and will fall back to the HTTP POST method. Implemented OCSP server functionality for testing purposes (httpserv utility). Support SHA-1 signatures with TLS 1.2 client authentication. Added the --empty-password command-line option to certutil, to be used with -N: use an empty password when creating a new database. Added the -w command-line option to pp: don't wrap long output lines. New Functions CERT_ForcePostMethodForOCSP CERT_GetSubjectNameDigest CERT_GetSubjectPublicKeyDigest SSL_PeerCertificateChain SSL_RecommendedCanFalseStart SSL_SetCanFalseStartCallback New Types CERT_REV_M_FORCE_POST_METHOD_FOR_...
NSS 3.16 release notes
rypt should not return SECSuccess for invalid keys. Bug 974693: Fix a memory corruption in sec_pkcs12_new_asafe. Bug 956082: If the NSS_SDB_USE_CACHE environment variable is set, skip the runtime test sdb_measureAccess. The built-in roots module has been updated to version 1.97, which adds, removes, and distrusts several certificates. The atob utility has been improved to automatically ignore lines of text that aren't in base64 format. The certutil utility has been improved to support creation of version 1 and version 2 certificates, in addition to the existing version 3 support. Bugs fixed in NSS 3.16 This Bugzilla query returns all the bugs fixed in NSS 3.16: https://bugzilla.mozilla.org/buglist.cgi?resolution=FIXED&classification=Components&query_format=advanced&product=NSS&target_mil...
NSS 3.17.3 release notes
CN = GTE CyberTrust Global Root SHA1 Fingerprint: 97:81:79:50:D8:1C:96:70:CC:34:D8:09:CF:79:44:31:36:7E:F4:74 CN = Thawte Server CA SHA1 Fingerprint: 23:E5:94:94:51:95:F2:41:48:03:B4:D5:64:D2:A3:A3:F5:D8:8B:8C CN = Thawte Premium Server CA SHA1 Fingerprint: 62:7F:8D:78:27:65:63:99:D2:7D:7F:90:44:C9:FE:B3:F3:3E:FA:9A CN = America Online Root Certification Authority 1 SHA-1 Fingerprint: 39:21:C1:15:C1:5D:0E:CA:5C:CB:5B:C4:F0:7D:21:D8:05:0B:56:6A CN = America Online Root Certification Authority 2 SHA-1 Fingerprint: 85:B5:FF:67:9B:0C:79:96:1F:C8:6E:44:22:00:46:13:DB:17:92:84 The following CA certificates had the Websites and Code Signing trust bits turned off OU = Class 3 Publi...
NSS 3.18 release notes
ad: Source tarballs: https://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/NSS_3_18_RTM/src/ New in NSS 3.18 New Functionality When importing certificates and keys from a PKCS#12 source, it's now possible to override the nicknames, prior to importing them into the NSS database, using new API SEC_PKCS12DecoderRenameCertNicknames. The tstclnt test utility program has new command-line options -C, -D, -b and -R. Use -C one, two or three times to print information about the certificates received from a server, and information about the locally found and trusted issuer certificates, to diagnose server side configuration issues. It is possible to run tstclnt without providing a database (-D). A PKCS#11 library that contains root CA certificates can be loaded by tstclnt, which ma...
NSS 3.22 release notes
Pseudorandom functions based on hashes other than SHA-1 are now supported with PBKDF (bug 554827). PK11_CreatePBEV2AlgorithmID() now supports SEC_OID_PKCS5_PBKDF2 with cipherAlgTag and prfAlgTag set to SEC_OID_HMAC_SHA256, SEC_OID_HMAC_SHA224, SEC_OID_HMAC_SHA384, or SEC_OID_HMAC_SHA512. Enforce an External Policy on NSS from a config file (bug 1009429) you can now add a config= line to pkcs11.txt (assuming you are using sql databases), which will force NSS to restrict the application to certain cryptographic algorithms and protocols. A complete list can be found in NSS Config Options. New Functions in pk11pub.h PK11_SignWithMechanism - This function is an extended version PK11_Sign(). PK11_VerifyWithMechanism - This function is an extended version of PK11...
NSS 3.24 release notes
etStapledOCSPResponses, and SSL_SetSignedCertTimestamps. SSL_ConfigServerCert automatically determines the certificate type from the certificate and private key. The caller is no longer required to use SSLKEAType explicitly to select a "slot" into which the certificate is configured (which incorrectly identifies a key agreement type rather than a certificate). Separate functions for configuring Online Certificate Status Protocol (OCSP) responses or Signed Certificate Timestamps are not needed, since these can be added to the optional SSLExtraServerCertData struct provided to SSL_ConfigServerCert. Also, partial support for RSA Probabilistic Signature Scheme (RSA-PSS) certificates has been added. Although these certificates can be configured, they will not be used by NSS in this version. For f...
Enc Dec MAC Output Public Key as CSR
NULL; const char *inFileName = NULL; const char *outFileName = NULL; const char *certReqFileName = NULL; const char *noiseFileName = NULL; secuPWData pwdata = { PW_NONE, 0 }; char * progName = strrchr(argv[0], '/'); progName = progName ? ...
Enc Dec MAC Using Key Wrap CertReq PKCS10 CSR
const char *outFileName = NULL; char *certReqFileName = NULL; char *certFileName = NULL; const char *noiseFileName = NULL; PK11SlotInfo *slot = NULL; char * progName = strrchr(argv[0], '/'); progName = progName ? ...
Encrypt Decrypt_MAC_Using Token
= NULL; const char *dbdir = NULL; const char *inFileName = NULL; const char *outFileName = NULL; const char *noiseFileName = NULL; secuPWData pwdata = { PW_NONE, 0 }; char * progName = strrchr(argv[0], '/'); progName = progName ? ...
NSS Sample Code Sample1
digest value with the adminstrator of the // secondary host. [Need support for digest check values] // 5. The primary host exports (wraps) the symmetric key using the // secondary host's RSA key. The wrapped value is sent back to // the secondary host. // 6. The administrator of the secondary host verifies that the wrapped // key data came from the primary host. The same methods outlined // in step 4 may be used here. // 7. The secondary host unwraps the the key using its own RSA private key. // NOTE: currently NSS does not support permanent symmetric keys. // The secondary host may store the wrapped value that was received // from the primary in a file, and unwrap it each time the key is required // (such as at server startup). // NSS actually has some support f...
NSS Sample Code Sample_2_Initialization of NSS
LOptStatus status; SECStatus rv; SECStatus rvShutdown; char *slotname = "internal"; PK11SlotInfo *slot = NULL; char *dbdir = NULL; char *plainPass = NULL; char *pwFile = NULL; char * progName = strrchr(argv[0], '/'); progName = progName ? ...
NSS Sample Code Sample_3_Basic Encryption and MACing
= NULL; const char *dbdir = NULL; const char *inFileName = NULL; const char *outFileName = NULL; const char *noiseFileName = NULL; secuPWData pwdata = { PW_NONE, 0 }; char * progName = strrchr(argv[0], '/'); progName = progName ? ...
Initialize NSS database - sample 2
LOptStatus status; SECStatus rv; SECStatus rvShutdown; char *slotname = "internal"; PK11SlotInfo *slot = NULL; char *dbdir = NULL; char *plainPass = NULL; char *pwFile = NULL; char * progName = strrchr(argv[0], '/'); progName = progName ? ...
EncDecMAC using token object - sample 3
edFileName[50]; PRFileDesc *inFile; PRFileDesc *outFile; PRBool ascii = PR_FALSE; CommandType cmd = UNKNOWN; const char *command = NULL; const char *dbdir = NULL; const char *inFileName = NULL; const char *outFileName = NULL; const char *noiseFileName = NULL; secuPWData pwdata = { PW_NONE, 0 }; char * progName = strrchr(argv[0], '/'); progName = progName ? ...
sample2
= PR_FALSE; PRBool sigVerify = PR_FALSE; const char *headerFileName = NULL; const char *encryptedFileName = NULL; const char *inFileName = NULL; const char *outFileName = NULL; char *certReqFileName = NULL; char *certFileName = NULL; const char *noiseFileName = NULL; PK11SlotInfo *slot = NULL; char * progName = strrchr(argv[0], '/'); progName = progName ? ...
nss tech note4
ert, SECItem *value); Get decoded value of the subjectKeyID extension. This uses PR_Alloc to allocate buffer for the decoded value, The caller should free up the storage allocated in value->data. ...
nss tech note5
Note: This document contains code snippets that focus on essential aspects of the task and often do not illustrate all the cleanup that needs to be done. ...
NSS Tools sslstrength
Synopsis 1) sslstrength ciphers 2) sslstrength hostname[:port] [ciphers=xyz] [debug] [verbose] [policy=export|domestic] Description The first form simple lists out the possible ciphers. The letter in the first column of the output is used to identify the cipher preferences in the ciphers= command. The second form attempts to connect to the named ssl host. The hostname argument must be present. However, the port number is an optional argument, and if not given, will default to the https port (443). ...
NSS release notes template
or Network Security Services (NSS) 3.XX.y is a patch release for NSS 3.XX. The bug fixes in NSS 3.XX.y are described in the "Bugs Fixed" section below. Distribution Information The HG tag is NSS_3_XX_RTM. NSS 3.XX requires NSPR 4.XX or newer. NSS 3.XX source distributions are available on ftp.mozilla.org for secure HTTPS download: Source tarballs: https://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/NSS_3_XX_RTM/src/ (make a link) New in NSS 3.XX New Functionality either: No new functionality is introduced in this release. This is a patch release to fix ... or: ... ...
Notes on TLS - SSL 3.0 Intolerant Servers
The connection seems terminated and a blank page is displayed. This is the main symptom of the problem when Mozilla based browsers encounter TLS/SSL 3.0 intolerant servers. Cause There are some number of web servers in production today which incorrectly implement the SSL 3.0 specification. This incorrect implementation causes them to reject connection attempts from clients that are compliant with the SSL 3.0 and TLS (aka SSL 3.1) specifications. ...
PKCS11 FAQ
Mozilla › Projects › NSS › PKCS11 › FAQ
mpleteness, it's also a good idea to expose public key objects. NSS falls back to looking for for the existance of public keys to determine if the token may have the corresponding private key while the token is not logged in. How are permanent PKCS #11 objects found by NSS? That is, which PKCS #11 attributes are used in the object searches? Labels? Key IDs? Key types? These are the general guidelines: User certificates are identified by their labels. Certificates and keys are often looked up by the following methods: By looking up all private keys. By looking up all certificates. Certificates may be looked up by label. By convention, all certificates making up a single personality should have the same label (that is, a pair of certificates, one for signing and one for key exc...
PKCS11 Implement
Implementing PKCS #11 for NSS NOTE: This document was originally for the Netscape Security Library that came with Netscape Communicator 4.0. This note will be removed once the document is updated for the current version of NSS. This document supplements the information in PKCS #11: Cryptographic Token Interface Standard, version 2.0 with guidelines for implementors of cryptographic modules who want their products to work with Mozilla client software: How NSS Calls PKCS #11 Functions. Function-specific information organized in the same categories as the PKCS #11 specification. Functions for Different Kinds of Tokens. Summarizes the support NSS expects from different kinds of tokens. Installation. Installing modules and informing the user of changes in the Cryptographic Modules set...
Build instructions
These instructions are outdated. Use the Building NSS page for more recent information. Numerous optional features of NSS builds are controlled through make variables. gmake is GNU make, usually your Linux-distro-regular "make" binary file, unless maybe it is a BSD make. Make variables may be set on the gmake command line, e.g., gmake variable=value variable=value target1 target2 or defined in the environment, e.g. (for POSIX shells), variable=value; export variable gmake target1 target2 Here are some (not all) of the make variables that affect NSS builds: BUILD_OPT: If set to 1, means do optimized non-DEBUG build. Default is DEBUG, non-optimized build. USE_DEBUG_RTL: If set to 1, on Windows, causes build with debug version of the C run-time library. NS_USE_GCC: On...
NSS tools : cmsutil
To run cmsutil, type the command cmsutil option [arguments] where option and arguments are combinations of the options and arguments listed in the following section. Each command takes one option. ...
NSS tools : pk12util
follow the more common legacy type. Using the SQLite databases must be manually specified by using the sql: prefix with the given security directory. For example: # pk12util -i /tmp/cert-files/users.p12 -d sql:/home/my/sharednssdb To set the shared database type as the default type for the tools, set the NSS_DEFAULT_DB_TYPE environment variable to sql: export NSS_DEFAULT_DB_TYPE="sql" This line can be set added to the ~/.bashrc file to make the change permanent. Most applications do not use the shared database by default, but they can be configured to use them. For example, this how-to article covers how to configure Firefox and Thunderbird to use the new shared NSS databases: o https://wiki.mozilla.org/NSS_Shared_DB_Howto For an engineering draft on the changes in the shared NSS ...
NSS reference
The proposed chapters below are based on the chapters of the SSL Reference and the categories of functions in NSS Public Functions. Should a particular page require the use of an underscore, please see the documentation for the Title Override Extension. Building and installing NSS Overview of an NSS application Based on "Overview of an SSL Application" in the SSL Reference. ...
OLD SSL Reference
Upgraded documentation may be found in the Current NSS Reference SSL Reference Newsgroup: mozilla.dev.tech.crypto Writer: Sean Cotter Manager: Wan-Teh Chang Chapter 1 Overview of an SSL Application SSL and related APIs allow compliant applications to configure sockets for authenticated, tamper-proof, and encrypted communications. This chapter introduces some of the basic SSL functions. ...
pkfnc.html
Upgraded documentation may be found in the Current NSS Reference PKCS #11 Functions Chapter 7 PKCS #11 Functions This chapter describes the core PKCS #11 functions that an application needs for communicating with cryptographic modules. In particular, these functions are used for obtaining certificates, keys, and passwords. ...
sslcrt.html
Upgraded documentation may be found in the Current NSS Reference Certificate Functions Chapter 5 Certificate Functions This chapter describes the functions and related types used to work with a certificate database such as the cert7.db database provided with Communicator. ...
sslerr.html
Upgraded documentation may be found in the Current NSS Reference NSS and SSL Error Codes Chapter 8 NSS and SSL Error Codes NSS error codes are retrieved using the NSPR function PR_GetError. In addition to the error codes defined by NSPR, PR_GetError retrieves the error codes described in this chapter. ...
sslintro.html
Upgraded documentation may be found in the Current NSS Reference Overview of an SSL Application Chapter 1 Overview of an SSL Application SSL and related APIs allow compliant applications to configure sockets for authenticated, tamper-proof, and encrypted communications. This chapter introduces some of the basic SSL functions. ...
sslkey.html
Upgraded documentation may be found in the Current NSS Reference Key Functions Chapter 6 Key Functions This chapter describes two functions used to manipulate private keys and key databases such as the key3.db database provided with Communicator. SECKEY_GetDefaultKeyDB SECKEY_DestroyPrivateKey SECKEY_GetDefaultKeyDB Returns a handle to the default key database opened by NSS_Init. ...
ssltyp.html
Upgraded documentation may be found in the Current NSS Reference Selected SSL Types and Structures Chapter 3 Selected SSL Types and Structures This chapter describes some of the most important types and structures used with the functions described in the rest of this document, and how to manage the memory used for them. Additional types are described with the functions that use them or in the header files. ...
NSS_3.12.3_release_notes.html
o disable/enable hash algorithms in cert/CRL signatures Bug 483168: NSS Callback API for looking up a default OCSP Responder URL Bug 483963: Assertion failure in OCSP tests. Bug 484425: Need accessor function to retrieve SymKey handle Bug 484466: sec_error_invalid_args with NSS_ENABLE_PKIX_VERIFY=1 Bug 485127: bltest crashes when attempting rc5_cbc or rc5_ecb Bug 485140: Wrong command line flags used to build intel-aes.s with Solaris gas for x86_64 Bug 485370: crash Bug 485713: Files added by Red Hat recently have missing texts in license headers. Bug 485729: Remove lib/freebl/mapfile.Solaris Bug 485837: vc90.pdb files are output in source directory instead of OBJDIR Bug 486060: sec_asn1d_parse_leaf uses argument uninitialized by caller pbe_PK11AlgidToParam Documentati...
NSS Tools certutil-tasks
Improve certificate listings. Allow for sorting by name and trust. Sorting by trust will return CA certs first. Allow listing and lookup of keys by index and nickname. Improve coherence of key and certificate nicknames. Remove keys "stranded" without a certificate (except for the imminent (????) encryption key for password files). ...
NSS Tools certutil
It can also list, generate, modify, or delete certificates within the cert8.db file and create or change the password, generate new public and private key pairs, display the contents of the key database, or delete key pairs within the key3.db file. Starting from NSS 3.35, the database format was upgraded to support SQLite as described in this document. It means that cert9.db and key4.db files may be targeted instead. ...
NSS Tools cmsutil
Syntax To run cmsutil, type the command cmsutil option [arguments] where option and arguments are combinations of the options and arguments listed in the following section. Each command takes one option. Each option may take zero or more arguments. To see a usage string, issue the command without options. Options and Arguments Options specify an action. Option arguments modify an action. ...
NSS Tools dbck-tasks
The dbck tool should be able to update a databa ...
NSS Tools sslstrength
Synopsis 1) sslstrength ciphers 2) sslstrength hostname[:port] [ciphers=xyz] [debug] [verbose] [policy=export|domestic] Description The first form simple lists out the possible ciphers. The letter in the first column of the output is used to identify the cipher preferences in the ciphers= command. The second form attempts to connect to the named ssl host. The hostname argument must be present. However, the port number is an optional argument, and if not given, will default to the https port (443). ...
NSS tools : cmsutil
Mozilla › Projects › NSS › tools › cmsutil
To run cmsutil, type the command cmsutil option [arguments] where option and arguments are combinations of the options and arguments listed in the following section. ...
NSS tools : pk12util
e common legacy type. Using the SQLite databases must be manually specified by using the sql: prefix with the given security directory. For example: # pk12util -i /tmp/cert-files/users.p12 -d sql:/home/my/sharednssdb To set the shared database type as the default type for the tools, set the NSS_DEFAULT_DB_TYPE environment variable to sql: export NSS_DEFAULT_DB_TYPE="sql" This line can be set added to the ~/.bashrc file to make the change permanent. Most applications do not use the shared database by default, but they can be configured to use them. For example, this how-to article covers how to configure Firefox and Thunderbird to use the new shared NSS databases: o https://wiki.mozilla.org/NSS_Shared_DB_Howto For an engineering draft on the changes i...
Network Security Services
tions on how to build NSS on the different supported platforms. NSS APIs Introduction to Network Security Services Provides an overview of the NSS libraries and what you need to know to use them. NSS SSL Public Functions Summarizes the SSL APIs exported by the NSS shared libraries. NSS SSL Reference API used to invoke SSL operations. NSS API Guidelines Explains how the libraries and code are organized, and guidelines for developing code (naming conventions, error handling, thread safety, etc.) NSS Technical Notes Links to NSS technical notes, which provide latest information about new NSS features and supplementary documentation for advanced topics in programming with NSS. Tools, testing, and other technical details ...
Pork Tool Development
the "oink/renamer_tests" subdirectory. Replacement For the "renamer" tool, a diff file is generated as the AST is traversed, using the visitor pattern. The diff file is generated using the "Patcher" class. source locations AST nodes have a location associated with them; SourceLoc is defined to be an integer corresponding to an string offset. This can be translated to an UnboxedLoc, which has a line and column offset (see renamer.cc:65). macro expansion This section refers to macro expansion when using mcpp (see Installing Pork). For the rename_class.cpp test, generate the file with "gcc -E -Wp,-W0,-K rename_class.cpp > rename_class.cc" and run the renamer with "../renamer -rename Foo Bar rename_class.cc". For terminology, suppose "MY_FOO" --> "Foo". Then any post-location variables refer ...
Rhino documentation
atch execution of scripts. JavaScript Debugger Debugging scripts running in Rhino. JavaScript Compiler Compiling scripts into Java class files. Running the Rhino tests Running the JavaScript test suite with Rhino. Embedding Rhino Embedding tutorial A short tutorial on how to embed Rhino into your application. API Javadoc Reference (Link broken? Try this at Jarvana.) An annotated outline of the programming interface to Rhino (tip only). Scopes and Contexts Describes how to use scopes and contexts for the best performance and flexibility, with an eye toward multithreaded environments. Serialization How to serialize JavaScript objects and functions in Rhino. Runtime A brief description of the JavaScript runtime. Small Footprint Hints for those interested in small-footprint ...
Rhino JavaScript compiler
mpiler translates JavaScript source into Java class files. The resulting Java class files can then be loaded and executed at another time, providing a convenient method for transferring JavaScript, and for avoiding translation cost. Note that the top-level functions available to the shell (such as print) are not available to compiled scripts when they are run outside the shell. Compiler command line java org.mozilla.javascript.tools.jsc.Main [options] file1.js [file2.js...] where options are: -extends java-class-name Specifies that a java class extending the Java class java-class-name should be generated from the incoming JavaScript source file. Each global function in the source file is made a method of the generated class, overriding any methods in the base class by the same name. -im...
Rhino scopes and contexts
oaded but the lazy loading fails if the scope is sealed. ScriptableObject sealedSharedScope = cx.initStandardObjects(null, true); // Force the LiveConnect stuff to be loaded. String loadMe = "RegExp; getClass; java; Packages; JavaAdapter;"; cx.evaluateString(sealedSharedScope , loadMe, "lazyLoad", 0, null); sealedSharedScope .sealObject(); Dynamic Scopes There's one problem with the setup outlined above. Calls to functions in JavaScript use static scope, which means that variables are first looked up in the function and then, if not found there, in the lexically enclosing scope. This causes problems if functions you define in your shared scope need access to variables you define in your instance scope. With Rhino 1.6, it is possible to use dynamic scope. With dynamic scope, functions loo...
Scripting Java
impact on performance since more work is done at each call. In practice this performance cost hasn't been noticeable in real applications. Because overload resolution occurs at runtime, it can fail at runtime. For example, if we call Overload's method g with two integers we get an error because neither form of the method is closer to the argument types than the other: js> o.g(3,4) js:"<stdin>", line 2: The choice of Java method Overload.g matching JavaScript argument types (number,number) is ambiguous; candidate methods are: class java.lang.String g(java.lang.String,int) class java.lang.String g(int,java.lang.String) See Java Method Overloading and LiveConnect 3 for a more precise definition of overloading semantics. Implementing Java Interfaces Now that we can access Java classes, creat...
Rhino serialization
> Here we see a simple case of a function being serialized to a file and then read into a new instance of Rhino and called. Rhino serialization APIs Two new classes, ScriptableOutputStream and ScriptableInputStream, were introduced to handle serialization of Rhino classes. These classes extend ObjectOutputStream and ObjectInputStream respectively. Writing an object to a file can be done in a few lines of Java code: FileOutputStream fos = new FileOutputStream(filename); ScriptableOutputStream out = new ScriptableOutputStream(fos, scope); out.writeObject(obj); out.close(); Here filename is the file to write to, obj is the object or function to write, and scope is the top-level scope containing obj. Reading the serialized object back into memory is similarly simple: FileInputStream fis = new Fi...
SpiderMonkey compartments
partments are used and all JavaScript objects that belong to a certain origin (such as "http://mail.google.com/" or "http://www.bank.com/") are placed in a separate compartment. This has some important implications: All objects created by a website reside in the same compartment and hence are located in the same memory region. This improves cache utilization by reducing false sharing of cache lines. False sharing occurs when we are trying to operate on an object and we have to read an entire cache line of data into the CPU cache. In the old model, JavaScript objects could be co-located with arbitrary other JavaScript objects from other origins. Such cross-origin objects are used together very infrequently, which reduces the number of cache hits we get. In the new model most objects touched...
Creating JavaScript jstest reftests
ript exists in the js/src/tests directories to fetch and reformat the Test262 suite, see test262-update.py. Writing a new test file Please read the high level advice for test writing in the parent article here. jstests has a special requirement: The call to reportCompare in every jstest is required by the test harness. Except in old tests or super strange new tests, it should be the last line of the test. Comparison functions and shared test functionality The jstest runner loads the code in js/src/tests/shell.js for every test. Additionally, it loads every shell.js and broswer.js file in the subdirectories on the path from js/src/tests to the location of your test. If you have functionality several tests share in a given folder, you can add the functionality to the shell.js or bros...
Future directions
rent collector. We would also like to allow WebAssembly to interact with GC-managed data. Parallelism Most machines that run SpiderMonkey have multiple cores, so parallelism is almost certainly part of our future. It will take some experimentation to build the right set of parallel facilities. During that experimentation, we must take care to apply parallelism with conceptual clarity and discipline. The API The SpiderMonkey API is C++. For the near future, we do not intend to provide a stable API, because too many things are changing. Also, we will someday want a more modern C++ API. Going forward from now, the API will likely be semi-stable, but there is no guarantee. The public API is gradually moving from jsapi.h and jsfriendapi.h into header files in js/public. Much more cleanup and...
GCIntegration - SpiderMonkey Redirect 1
ew class hook that is invoked if the object moves. Objects with wrapper caches could implement that hook to find their corresponding C++ object and update the wrapper field to point to the new location. Undoubtedly there will be more esoteric cases. We will need to handle pointers to array slots and string characters specially, since those may actually be pointers into the middle of GC things (inline slots or inline chars). We will need to explore how these situations occur in the browser now, and how best to handle them. Write barriers Generational GC needs its own write barrier. The goal is to keep a list, called the remembered set, of all pointers from the tenured generation into the nursery. So every time a pointer is written somewhere, we need to check if the source is in the tenured g...
64-bit Compatibility
ms. For all intents and purposes they are also 32-bit on 64-bit platforms: intN, uintN JSIntn, JSUintn, JSBool General Problems with Pointers When performing bitwise operations on pointer values, make sure that both operands are 64-bit. The compiler can implicitly sign or zero extend operands with unintended side effects. For example, consider this code: #define POINTER_TAGBITS 3 static inline uintptr_t UnmaskPointer(uintptr_t v) { return v & ~POINTER_TAGBITS; } The value 3 will be inverted to 0xFFFFFFFC, then zero-extended to 0x00000000FFFFFFFC - a subtle and nasty bug, assuming it is unintended. The best way to fix this is to make types explicit, such as: const uintptr_t POINTER_TAGBITS = 3 Or by using a cast inside the macro. This sort of bug happens surprisingly often - see b...
JSAutoByteString
scription void initBytes(char *bytes) Take ownership of the given byte array. char *encodeLatin1(JSContext *cx, JSString *str) Call JS_EncodeString and take ownership of the returned string, and return the string. char *encodeLatin1(js::ExclusiveContext *cx, JSString *str) Call JS::LossyTwoByteCharsToNewLatin1CharsZ, or allocate string and copy the content of JSLinearString::latin1Chars, and take the ownership of the string. This may fail if str is not linear. char *encodeUtf8(JSContext *cx, JS::HandleString str) Call JS_EncodeStringToUTF8 and take ownership of the returned string, and return the string. void clear() Free the owned string. You should call this before calling encode* methods or initBytes method if a string is already o...
JS_ASSERT_STRING_IS_FLAT
This article covers features introduced in SpiderMonkey 1.8.5 Assert a string is flattened. Syntax static MOZ_ALWAYS_INLINE JSFlatString * JS_ASSERT_STRING_IS_FLAT(JSString *str) { MOZ_ASSERT(JS_StringIsFlat(str)); return (JSFlatString *)str; } Name Type Description str JSString * String to examine. Description JS_ASSERT_STRING_IS_FLAT asserts the string is flattened, and returns a pointer to JSFlatString. See Also MXR ID Search for JS_ASSERT_STRING_IS_FLAT JS_StringIsFlat bug 609440 ...
JS_BufferIsCompilableUnit
_THREADSAFE build, the caller must be in a request on this JSContext. obj JS::HandleObject The global object, or NULL. utf8 const char * String containing the script to compile. length size_t The length of utf8 in characters. Description Given a buffer, return false if the buffer might become a valid JavaScript statement with the addition of more lines. Otherwise return true. The intent is to support interactive compilation - accumulate lines in a buffer until JS_BufferIsCompilableUnit is true, then pass it to the compiler. See Also MXR ID Search for JS_BufferIsCompilableUnit JS::Evaluate JS::Compile JS::CompileOffThread JS::CompileFunction JS_DecompileScript ...
JS_DumpHeap
ally, for consistency. JSTRACE_OBJECT = 0x00, JSTRACE_STRING = 0x01, JSTRACE_SYMBOL = 0x02, JSTRACE_SCRIPT = 0x03, // Shape details are exposed through JS_TraceShapeCycleCollectorChildren. JSTRACE_SHAPE = 0x04, // The kind associated with a nullptr. JSTRACE_NULL = 0x06, // A kind that indicates the real kind should be looked up in the arena. JSTRACE_OUTOFLINE = 0x07, // The following kinds do not have an exposed C++ idiom. JSTRACE_BASE_SHAPE = 0x0F, JSTRACE_JITCODE = 0x1F, JSTRACE_LAZY_SCRIPT = 0x2F, JSTRACE_TYPE_OBJECT = 0x3F, JSTRACE_LAST = JSTRACE_TYPE_OBJECT }; Description See bug 378261 for detail. When tracing a thing, the GC needs to know about the layout of the object it is looking at. There are a fixed number of ...
JS_FORGET_STRING_FLATNESS
This article covers features introduced in SpiderMonkey 1.8.5 Convert JSFlatString to JSString. Syntax static MOZ_ALWAYS_INLINE JSString * JS_FORGET_STRING_FLATNESS(JSFlatString *fstr) { return (JSString *)fstr; } Name Type Description fstr JSFlatString * A string to convert Description JS_FORGET_STRING_FLATNESS converts JSFlatString * to JSString *. See Also MXR ID Search for JS_FORGET_STRING_FLATNESS JSFlatString JSString bug 609440 ...
JS_GetGCParameter
GCs are high- or low- frequency. JSGC_DYNAMIC_MARK_SLICE / "dynamicMarkSlice" If true, high-frequency GCs will use a longer mark slice. JSGC_ALLOCATION_THRESHOLD / "allocationThreshold" Lower limit after which we limit the heap growth. The heap will be collected if it is greater than: MAX(allocThreshold, lastSize) * thresholdFactor, This establishes allocThreshold as a baseline or default heap size. JSGC_ALLOCATION_THRESHOLD_FACTOR / "allocationThresholdFactor" These thresholds (as percentages) are compared with the zone threshold (above) to decide when to begin an incremental collection. JSGC_ALLOCATION_THRESHOLD_FACTOR_AVOID_INTERRUPT is used when a GC is already in progress for other zones and we may wish to avoid interrupting it. Additionally i...
JS_NewRegExpObject
ing that contains a regular expression. length size_t The length of bytes or chars, in characters. flags unsigned Regular expression flags. See below. Flags Name Description RegExp constructor flag JSREG_FOLD Fold uppercase to lowercase. i JSREG_GLOB Global execution, creates array of matches. g JSREG_MULTILINE Treat ^ and $ as begin and end of line. m JSREG_STICKY Only match starting at lastIndex. y Description JS_NewRegExpObject and JS_NewUCRegExpObject create a new RegExp instance. The flags from the built-in RegExp constructor properties ignoreCase, global, multiline, and sticky are OR'd in with the provided flags parameter. JS_NewRegExpObjectNoStatics and JS_NewUCRegEx...
JS_SetOptions
N_GO Caller of JS_CompileScript et al promises to execute the compiled script once only, in the same scope object used for compilation. The caller may not modify objects on the scope chain between compilation and execution. This enables compile-time scope chain resolution of consts (a performance optimization). MXR ID Search for JSOPTION_COMPILE_N_GO JSOPTION_ATLINE //@line number ["filename"] option supported for the XUL preprocessor and kindred beasts. MXR ID Search for JSOPTION_ATLINE JSOPTION_XML Obsolete since JSAPI 15 ECMAScript for XML (E4X) support: parse <!-- --> as a token, not backward compatible with the comment-hiding hack used in HTML script tags. MXR ID Search for JSOPTION_XML JSOP...
JSAPI reference
Monkey 17 JS_DefineFunctions enum PropertyDefinitionBehavior Added in SpiderMonkey 38 JS_NewFunction JS::GetSelfHostedFunction Added in JSAPI 31 JS::NewFunctionFromSpec Added in JSAPI 45 JS_NewFunctionById Added in SpiderMonkey 17 Obsolete since JSAPI 44 JS_CloneFunctionObject Obsolete since JSAPI 36 RegExps JS_NewRegExpObject JSREG_FOLD JSREG_GLOB JSREG_MULTILINE JSREG_STICKY JS_NewUCRegExpObject JS_NewRegExpObjectNoStatics JS_NewUCRegExpObjectNoStatics JS_SetRegExpInput JS_ClearRegExpStatics JS_ObjectIsRegExp Added in SpiderMonkey 17 JS_GetRegExpFlags Added in SpiderMonkey 17 JS_GetRegExpSource Added in SpiderMonkey 17 JS_ExecuteRegExp JS_ExecuteRegExpNoStatics JS_ClearRegExpRoots Obsolete since JavaScript 1.8.5 Serialization s...
SpiderMonkey 45
ect (bug 1159469) JS::SetSize (bug 1159469) JS::SetHas (bug 1159469) JS::SetDelete (bug 1159469) JS::SetAdd (bug 1159469) JS::SetClear (bug 1159469) JS::SetKeys (bug 1159469) JS::SetValues (bug 1159469) JS::SetEntries (bug 1159469) JS::SetForEach (bug 1159469) JS::ExceptionStackOrNull (bug 814497) JS::CopyAsyncStack (bug 1160307) JS::GetSavedFrameSource (bug 1216819) JS::GetSavedFrameLine (bug 1216819) JS::GetSavedFrameColumn (bug 1216819) JS::GetSavedFrameFunctionDisplayName (bug 1216819) JS::GetSavedFrameAsyncCause (bug 1216819) JS::GetSavedFrameAsyncParent (bug 1216819) JS::GetSavedFrameParent (bug 1216819) JS::BuildStackString (bug 1133191) JS::FlushPerformanceMonitoring (bug 1181175) JS::ResetPerformanceMonitoring (bug 1181175) JS::DisposePerformanceMonitoring (bug 1...
SpiderMonkey 52
SpiderMonkey 52 is the JavaScript engine that shipped in Firefox 52. ...
SpiderMonkey releases
working as an embeddable source package. We are very limited in our ability to support older versions, including those labeled as "releases" on this page. The easiest way to fetch the version corresponding to the current Firefox release is to visit the treeherder page for the release repository and click on the first SM(pkg) link you see. That will open a small window in the bottom left with a line like "artifact uploaded: mozjs-57.0.1.tar.bz2". Past releases SpiderMonkey 52 SpiderMonkey 45 SpiderMonkey 38 SpiderMonkey 31 SpiderMonkey 24 SpiderMonkey 17 SpiderMonkey 1.8.8 SpiderMonkey 1.8.7 SpiderMonkey 1.8.5 SpiderMonkey 1.8 ...
SavedFrame
from chrome compartments (A -> B -> C). To view everything, use an XrayWrapper. This is the default wrapper. To see the stack as the content compartment sees it, waive the xray wrapper with Components.utils.waiveXrays: const contentViewOfStack = Components.utils.waiveXrays(someStack); Accessor Properties of the SavedFrame.prototype Object source The source URL for this stack frame, as a string. line The line number for this stack frame. column The column number for this stack frame. functionDisplayName Either SpiderMonkeyaEUR(TM)s inferred name for this stack frameaEUR(TM)s function, or null. asyncCause If this stack frame is the asyncParent of other stack frames, then this is a string representing the type of asynchronous call by which this frame invoked its children. For example, if thi...
SpiderMonkey: The Mozilla JavaScript runtime
itten in C and C++. It is used in various Mozilla products, including Firefox, and is available under the MPL2. Standalone source code releases can be found on the Releases page. Guides Building SpiderMonkey Build Documentation How to get SpiderMonkey source code, build it, and run the test suite. Using SpiderMonkey Introduction to the JavaScript shell Documentation of the command-line JavaScript shell, js. JSAPI User Guide This guide provides an overview of SpiderMonkey and describes how you can embed engine calls in your applications to make them JavaScript-aware. JSAPI cookbook Shows the JSAPI translation of some commonly used JavaScript expressions and statements. GC Rooting Guide Guide on how to write code compatible with the Generational GC in SpiderMonkey. How to ...
compare-locales
ocales/l10n.toml. The details of the configuration file are described in the l10n-config docs. You pass the path to the toml file and the parent dir of the localizations as first arguments, followed by the locale codes of the locales you want to compare. ...
Mozinfo
dictionary, mozinfo.info, that contain these values. mozinfo also exports: choices: a dictionary of possible values for os, bits, and processor main: the console_script entry point for mozinfo unknown: a singleton denoting a value that cannot be determined unknown has the string representation "UNKNOWN". unknown will evaluate as False in python: if not mozinfo.os: ... # unknown! Command Line Usage MozInfo comes with a command line, mozinfo which may be used to diagnose one's current system. Example output: os: linux version: Ubuntu 10.10 bits: 32 processor: x86 Three of these fields, os, bits, and processor, have a finite set of choices. You may display the value of these choices using mozinfo --os, mozinfo --bits, and mozinfo --processor. mozinfo --help documents command-line u...
Using RAII classes in Mozilla
In this case, the implementation must use the MOZ_GUARD_OBJECT_NOTIFIER_PARAM_IN_IMPL macro to add to the implementation: nsAutoScriptBlocker::nsAutoScriptBlocker(JSContext *cx MOZ_GUARD_OBJECT_NOTIFIER_PARAM_IN_IMPL) { MOZ_GUARD_OBJECT_NOTIFIER_INIT; nsContentUtils::AddScriptBlocker(cx); } or, if it is the only parameter: ns...
The Rust programming language
In addition, Rust offers zero-cost abstractions, move semantics, guaranteed memory safety, threads with no data races, trait-based generics, pattern matching, type inference, and efficient C bindings, with a minimum runtime size. To learn more about Rust, you can: Watch the videos below for a closer look at the power and benefits Rust provides. Read the book The Rust Programming Language online. Download the Rust compiler, check out examples, and learn everything you could possibly wish to know at the Rust official web site. Rust and the future of systems programming Unlocking the power of parallelism with Rust Rust for web developers Safe systems programming with Rust Growing the Rust community Putting Rust into production at Mozilla ...
Handling Mozilla Security Bugs
o, and by instead choosing to report bugs through the standard Bugzilla processes, the bug reporter is doing a positive service to the Mozilla project; thus it makes sense that the bug reporter should be able to decide when the relevant Bugzilla data should be made public. However, we will ask all individuals and organizations reporting security bugs through Bugzilla to follow the voluntary guidelines below: Before making a security bug world-readable, please provide a few days notice to the Mozilla security bug group by sending an email to the private security bug group mailing list. Please try not to keep bugs in the security-sensitive category for an unreasonably long amount of time. Please try to be understanding and accommodating if a Mozilla distributor has a legitimate need to kee...
A Web PKI x509 certificate primer
f" Security Notes There are several organizations that provide recommendations regarding the security parameters for key/hash sizes given current computational power. For the end date of the root cert created following the instructions in this page (year 2017). These are the recomendations of bit sizes (from http://www.keylength.com/): Asymmetric ECC(Key) Hash Linestra(2004) 1902 172 172 Ecrypt 2012 2432 224 224 NIST 2012 2048 224 224 ANSSI 2010 4096 200 256 RFC 3766 2358 200 --- BSI 1976 256 256 In other words, SHA1 is now deprecated for new uses. We should use at least 3072 key sizes and at least a 256 ECC curve. Thus the recommendation here is for th...
Signing Mozilla apps for Mac OS X
your new Developer ID into the Keychain Access application on your Mac. If the "Developer ID" radio button is greyed out you probably have a group account. These types of accounts only allow for the "Agent" role to create Developer IDs. Contact the person who created your group Apple Developer Account if you get stuck here. The codesign tool Apple provides a tool called codesign; this command-line application is used to add a signature to an application bundle. The man page for codesign is available online, or you can simply type "man codesign" in a Terminal window. The main options of note are: -s your-signing-identity Lets you specify the signing certificate you want to sign the application with your-signing-identity is the name of your certificate. --keychain /path/to/keychain Let...
Animated PNG graphics
Mozilla › Tech › APNG
It has the same structure as an 'IDAT' chunk, except preceded by a sequence number. At least one 'fdAT' chunk is required for each frame. The compressed datastream is then the concatenation of the contents of the data fields of all the 'fdAT' chunks within a frame. When decompressed, the datastream is the complete pixel data of a PNG image, including the filter byte at the beginning of each scanline, similar to the uncompressed data of all the 'IDAT' chunks. It utilizes the same bit depth, color type, compression method, filter method, interlace method, and palette (if any) as the default image. Byte offset Field name Field type Description 0 sequence_number unsigned int Sequence number of the animation chunk, starting from 0. 4 frame_data ...
Gecko Roles
OLE_HELPBALLOON Displays a Help topic in the form of a ToolTip or Help balloon. ROLE_CHARACTER Represents a cartoon-like graphic object, such as Microsoft Office Assistant, which is displayed to provide help to users of an application. ROLE_LIST Represents a list box, allowing the user to select one or more items. ROLE_LISTITEM Represents an item in a list. ROLE_OUTLINE Represents an outline or tree structure, such as a tree view control, that displays a hierarchical list and allows the user to expand and collapse branches. ROLE_OUTLINEITEM Represents an item in an outline or tree structure. ROLE_PAGETAB Represents a page tab, it is a child of a page tab list. ROLE_PROPERTYPAGE Represents a property sheet. ROLE_INDICATOR Repre...
AT Development
Accessibility Architecture How the accessibility hierarchy is implemented in Mozilla (some issues aren't addressed by previous guide). ...
DocShell
Docshell is the second iteration of what originally started out as WebShell. At the moment, the transition from WebShell to DocShell is not fully completed, but the long-term goal is to remove WebShell and switch over entirely to DocShell. nsWebBrowser project page (outlines the design of nsWebBrowser and DocShell). Overview of a URI load up though dispatch to a content handler. Overview of a URI load in general (more bird's-eye view). Overview of how Downloads work. DocShell Wiki. ...
Life After XUL: Building Firefox Interfaces with HTML
bug 1446829. This page gathers technical solutions to common problems encountered by teams shipping HTML-based interfaces inside Firefox. Background: Discussion of how to replace XUL is ongoing within the Platform team. ...
Places Developer Guide
visit_id; var from_visit; try { // Here we can't use the "executeAsync" method since have to return a // result right-away. while (sql_stmt.executeStep()) { from_visit = sql_stmt.row.from_visit; } } finally { sql_stmt.reset(); } return from_visit; } Note: The <cdata><![CDATA[ xxx ]]></cdata>.toString() notation is E4X and it makes possible to write multi-line strings in JavaScript. This is very useful when writing long SQL statements. Searching History Queries are executed through the history service. The example below shows how to search through browser history, and to iterate over the results. var history = Cc["@mozilla.org/browser/nav-history-service;1"] .getService(Ci.nsINavHistoryService); var query = history.getNewQuery(); // Spe...
Using the Places history service
sily. When the user starts browsing (for example, by typing in a link or following a bookmark), a new session ID is created. New visits get the same session ID as their referrer. This means that one "session" is comprised of going to a new page, and following a bunch of links or redirects. A session is ended when a new URL is typed in or selected from bookmarks. These session IDs allow the dotted lines separating related pages in the history view to be easily computed. Creating the history service The Places history service's contract ID is "@mozilla.org/browser/nav-history-service;1": var historyService = Components.classes["@mozilla.org/browser/nav-history-service;1"] .getService(Components.interfaces.nsINavHistoryService); It also responds to the old cont...
places.sqlite Database Troubleshooting
along with all of its contents (history). Close Firefox and ensure it's done closing in your task manager. Before you proceed, make a backup of the Firefox profile folder, in any case. Create a folder to use temporarily for this work, such as my_work_folder. Copy places.sqlite-corrupt from the Firefox profile folder to the work folder. Download the latest precompiled binary Sqlite command-line shell from: https://www.sqlite.org/download.html Extract sqlite3 executable into the work folder. Open a terminal window and navigate to the work folder. Then open an sqlite shell: my_work_folder> sqlite3 places.sqlite-corrupt sqlite> PRAGMA integrity_check; If the result IS OK, this guide won't help; stop here and please file a bug. sqlite> .clone places.sqlite sqlite> PRAGMA user_ver...
extIExtension
ranch The preferences object for the extension. Defaults to the "extensions.<extensionid>." branch. storage readonly attribute extISessionStorage The storage object for the extension. events readonly attribute extIEvents The events object for the extension. supports: "uninstall" Methods FIXME: See also See extApplication.js line:395 for the implementation of firstRun. A preference "install-event-fired" under your extensions preferences branch (e.g. extensions.YOUR_EXTENSION_ID.install-event-fired) will be set to false after your extension has been installed. You may need to reset this preference in about:config during testing. Also, see the FUEL (Firefox), STEEL (Thunderbird) and SMILE (SeaMonkey) pages. ...
XPCOM glue
Mozilla › Tech › XPCOM › Glue
ib at the same time. For XULRunner 1.9, on Linux you should use either the .pc files. For example: pkg-config --cflags --libs libxul.pc These instructions are for Mozilla 1.8 and above. When using a SDK from Mozilla 1.7 or earlier, you must define MOZILLA_STRICT_API when using any form of the glue. Linux and Mac: Make sure the Gecko libraries are listed after your object (.o) files on the link line. Linux and Mac: Write the linker options exactly as stated (just replacing the /path/to/sdk/), otherwise you get an undefined symbol: ...NS_TableDrivenQI...QITableEntry... at runtime (not compile time) (in debug builds) or your module just won't load (in optimized builds). In principle, #include "mozilla-config.h" should also work, if it's the first #include in .cpp, but preprocessor option is...
An Overview of XPCOM
zed, modules that are not necessary right away can be "lazy loaded", or not loaded at all, which can improve the performance of your application. Maintenance Even when you are not updating a component, designing your application in a modular way can make it easier for you to find and maintain the parts of the application that you are interested in. Mozilla has over four million lines of code, and no single individual understands the entire codebase. The best way to tackle a project of this size is to divide it into smaller, more manageable pieces, use a component programming model, and to organize related sets of components into modules. The network library, for example, consists of components for each of the protocols, HTTP, FTP, and others, which are bundled together and l...
Preface
of information in the book and make things easier to scan. The goal is to use as few formats as possible, but to distinguish the various different types of information clearly. Format Description bold component names appear in bold in the text monospace code listings, interface names and members of interfaces (e.g., createInstance()) appear in monospaced font. Lines of code are placed in separate boxes. Additionally, filenames and directories appear in monospaced font. italic variables appear in italic. Important terms and new concepts are also italicized the first time they appear in the text. Those terms are either explained immediately after they are cited, or else the reader is referred to a section in the book where they are described in de...
Resources
This material may be distributed only subject to the terms and conditions set forth in the Open ...
Using XPCOM Components
ore with a technology called XPConnect. XPConnect allows interface methods defined via XPIDL to be called from JavaScript, as part of JavaScript objects that represent instances of components like the CookieManager. XPConnect is what binds the application code to the user interface of the Mozilla browser, to other Gecko-based XUL, and to JavaScript environments like xpcshell, which is a command-line JavaScript interpreter and XPCOM tool is built with Mozilla. See http://www.mozilla.org/scriptable/ for more information about XPConnect and JavaScript. This isn't quite all there is to it, of course, but this shows an important aspect of XPCOM. The contractual arrangements that XPCOM enforces open up the way to binary interoperability - to being able to access, use, and reuse XPCOM components...
Detailed XPCOM hashtable guide
ities of PLDHash (callback functions, the ops structure, etc). You should read xpcom/glue/nsTHashtable.h. To use nsTHashtable, you must declare an entry-class in a pre-defined format. This entry class contains the key and the data that you are hashing (just like PLDHash, above). It also declares functions that manipulate the key. In most cases, the functions of this entry class can be entirely inline. For examples of entry classes, see the declarations at xpcom/glue/nsHashKeys.h. The template parameter is the entry class. You must use the Init() function to initalize the table properly. At this point, use the functions PutEntry/GetEntry/RemoveEntry to alter the hashtable. The Iterator class will do iteration, but beware that the iteration will occur in a seemingly-random order (no sorting). ...
Receiving startup notifications
es, for example. Receiving startup notifications in Gecko 2.0 (Firefox 4) and later In order to improve startup times, changes were made to the XPCOM startup process. See The startup process for details on how this now works, if you're interested in specifics. The important thing to note is that now instead of registering with the Category Manager programmatically as was done in the past, you add lines to your chrome.manifest to let the application handle it for you. For example: category profile-after-change MyComponent @foobar/mycomponent;1 Important: In the past, the contract ID of the category entry started with "service," if the component was implemented as a service. This is no longer the case, so be sure to remove that when migrating existing code. Additionally, the earliest startup tim...
Components.utils.evalInSandbox
); console.log(result); // 17 console.log(mySandbox.x); // 7 Operations on objects you insert into this sandbox global scope do not carry privileges into the sandbox: mySandbox.foo = Components; // this will give a "Permission Denied" error Components.utils.evalInSandbox("foo.classes", mySandbox); Optional Arguments You can optionally specify the JS version, filename, and line number of the code being evaluated. For instance: var x = Components.utils.evalInSandbox( "let x = 1;", sandbox, "1.8", // "latest" is recognized as a special case "http://foo.com/mycode.js", 25 ); The above will execute code using JavaScript 1.8. Any exceptions raised by the evaluated code will show as originating from the above URL. The evaluated code is assumed to start at line 2...
Components.utils.unload
resource:/// or resource://app/) as these may be in use by other extensions and the application. Only unload modules you include as part of your extension. Syntax Components.utils.unload( url ); Parameters url The "resource://" URL of the script to unload. This must be the same URL that was used to load the script. Example You can unload a module called MyModule.jsm using the following line of code: Components.utils.unload("resource://myaddon/modules/MyModule.jsm"); Note: Currently Components.utils.unload clears the global object of an unloaded module. This may cause modules to misbehave after unloading even if you have a reference to them. See bug 769253 See also bug 481603 The documentation in xpccomponents.idl The tests in js/xpconnect/tests/unit/ ...
Architecture basics
XPCOM is like COM, for Windows. It lets you get pointers to components inside Mozilla, and it lets you talk about their interfaces as well. XPConnect is what lets JavaScript talk with Mozilla guts, the XPCOM system. You can imagine it like a bridge between JavaScript code, and Mozilla guts. xpcshell is a command line interface to Mozilla JavaScript. It's an interactive interpreter -- it gives you a shell that talks straight to Mozilla, via JavaScript's XPConnect bridge into it. ...
Folders
The folder classes all implement the nsIMsgFolder interface. There are currently three folder classes - nsLocalMailFolder, nsImapMailFolder, and nsNewsFolder. They all inherit from nsMsgDBFolder, which implements a lot of the core functionality. RSS feeds are implemented by nsLocalMailFolder. Each line in the folder pane corresponds to a folder object. Folders have a number of interesting attributes: parent subfolder server uri flags and methods getDatabase ( how to get a database of the messages in the folder.) updateFolder (gets new messages for that folder, if applicable, e.g., pop3 inboxes, imap folders, news folders, rss folders) ...
nsACString
ular nsACString instance depends on the context in which it is used. If used with XPIDL, then the character encodings of the corresponding XPIDL data types applies. nsACString may even hold data with embedded null bytes. Thus, the length of the data contained in the nsACString should be determined by calling the nsACString::Length() method. The methods defined on nsACString are implemented as inline wrappers around the XPCOM string functions, prefixed with NS_CString. See, for example, NS_CStringGetData. See also nsACString::Length() NS_CStringGetData nsEmbedCString ...
nsACString_internal
ss Declaration nsTSubstring is the most abstract class in the string hierarchy. It represents a single contiguous array of characters, which may or may not be null-terminated. This type is not instantiated directly. A sub-class is instantiated instead. For example, see nsTString. NAMES: nsAString for wide characters nsACString for narrow characters Many of the accessors on nsTSubstring are inlined as an optimization. <map id="classes" name="classes"> <area alt="" coords="456,5,605,53" href="http://developer.mozilla.org/en/nsACString_internal" shape="rect" title="nsACString_internal"> <area alt="" coords="415,101,497,149" href="http://developer.mozilla.org/en/nsCString" shape="rect" title="nsCString"> <area alt="" coords="521,101,689,149" href="http://developer.mozilla.org/en/nsDependentCS...
nsAString
a particular nsAString instance depends on the context in which it is used. If used with XPIDL, then the character encodings of the corresponding XPIDL data types applies. nsAString may even hold data with embedded null values. Thus, the length of the data contained in the nsAString should be determined by calling the nsAString::Length method. The methods defined on nsAString are implemented as inline wrappers around the XPCOM string functions, prefixed with NS_String. See, for example, NS_StringGetData. See Also nsAString::Length, EndReading, NS_StringGetData, nsEmbedString ...
nsAString_internal
ss Declaration nsTSubstring is the most abstract class in the string hierarchy. It represents a single contiguous array of characters, which may or may not be null-terminated. This type is not instantiated directly. A sub-class is instantiated instead. For example, see nsTString. NAMES: nsAString for wide characters nsACString for narrow characters Many of the accessors on nsTSubstring are inlined as an optimization. <map id="classes" name="classes"> <area alt="" coords="415,5,553,53" href="http://developer.mozilla.org/en/nsAString_internal" shape="rect" title="nsAString_internal"> <area alt="" coords="379,101,451,149" href="http://developer.mozilla.org/en/nsString" shape="rect" title="nsString"> <area alt="" coords="475,101,635,149" href="http://developer.mozilla.org/en/nsDependentSubstr...
nsEmbedCString
tring] An alias for the abstract string type this class specializes. Methods nsEmbedCString Constructors for nsEmbedCString. get The get function returns a const pointer to the string's null-terminated, internal buffer. Operators operator= This operator is a shortcut for the inherited nsACString::Assign family of functions. Remarks The methods defined on nsEmbedCString are implemented as inline wrappers around the XPCOM string functions, prefixed with NS_CString. See, for example, NS_CStringContainerInit. See Also NS_CStringContainerInit, nsACString ...
nsEmbedString
[nsAString] An alias for the abstract string type this class specializes. Methods nsEmbedString Constructors for nsEmbedString. get The get function returns a const pointer to the string's null-terminated, internal buffer. Operators operator= This operator is a shortcut for the inherited nsAString::Assign family of functions. Remarks The methods defined on nsEmbedString are implemented as inline wrappers around the XPCOM string functions, prefixed with NS_String. See, for example, NS_StringContainerInit. See Also NS_StringContainerInit, nsAString ...
nsIAccessibleEvent
attributes changed. Also see EVENT_TEXT_ATTRIBUTE_CHANGED. Gecko 1.9.2 note This event is never sent in versions of Gecko prior to 1.9.2, even though the constant existed. EVENT_PAGE_CHANGED 0x005A 0x0056 A slide changed in a presentation document or a page boundary was crossed in a word processing document. EVENT_LAST_ENTRY 0x005D 0x0057 Help make sure event map does not get out-of-line. EVENT_CREATE 0x8000 EVENT_DESTROY 0x8001 EVENT_DESCRIPTIONCHANGE 0x800D EVENT_PARENTCHANGE 0x800F EVENT_HELPCHANGE 0x8010 EVENT_DEFACTIONCHANGE 0x8011 EVENT_ACCELERATORCHANGE 0x8012 EVENT_MENUSTART 0x0004 EVENT_MENUEND 0x0005 EVENT_MENUPOPUPSTART 0x0006 EVENT_MENUPOPUPEND 0x0007 EVENT_CAPTURESTART 0x0008 EVENT_CAPTUREEND 0...
nsIAccessibleRole
ARACTER 32 Represents a cartoon-like graphic object, such as Microsoft Office Assistant, which is displayed to provide help to users of an application. ROLE_LIST 33 Represents a list box, allowing the user to select one or more items. It is used for xul:listbox, html:select@size, role="list". See also ROLE_LIST_ITEM. ROLE_LISTITEM 34 Represents an item in a list. See also ROLE_LIST. ROLE_OUTLINE 35 Represents an outline or tree structure, such as a tree view control, that displays a hierarchical list and allows the user to expand and collapse branches. Is is used for role="tree". ROLE_OUTLINEITEM 36 Represents an item in an outline or tree structure. It is used for role="treeitem". ROLE_PAGETAB 37 Represents a page tab, it is a child of a page tab list. It is used for xul:tab, role="...
nsIAccessibleText
Description TEXT_OFFSET_END_OF_TEXT -1 Will be treated as the equal to the end of the text. TEXT_OFFSET_CARET -2 Will be treated as the caret position. Text Boundary Constants Constant Value Description BOUNDARY_CHAR 0 BOUNDARY_WORD_START 1 BOUNDARY_WORD_END 2 BOUNDARY_SENTENCE_START 3 Do not use in new code. BOUNDARY_SENTENCE_END 4 Do not use in new code. BOUNDARY_LINE_START 5 BOUNDARY_LINE_END 6 BOUNDARY_ATTRIBUTE_RANGE 7 Coordinate Type Constants Obsolete since Gecko 1.9 (Firefox 3)This feature is obsolete. Although it may still work in some browsers, its use is discouraged since it could be removed at any time. Try to avoid using it. Constant Value Description COORD_TYPE_SCREEN 0 COORD_TYPE_WINDOW 1 Methods addSelection() void ad...
nsIAlertsService
incipal principal, Optional in boolean inPrivateBrowsing, Optional ); Parameters imageUrl A URL identifying the image to display in the notification alert. title The title for the alert. text The text to display in the alert, explaining the alert condition. The text must not be too long, otherwise it might be truncated to a platform-specific length. If the text is too long, try to use line returns in the text to have it split and displayed over multiple lines. textClickable Optional If true, if the user clicks on it, the listener is notified; when hovered the notification background becomes lighter and the cursor turns to a pointer. Prior to Gecko 32 the text was made to look like a link. cookie Optional A blind cookie the alert passes back to the consumer during alert listene...
nsIAppShell
cko 1.9 void suspendNative(); Attributes Attribute Type Description eventloopNestingLevel unsigned long The current event loop nesting level. Read only. Methods Create() Obsolete since Gecko 1.9 (Firefox 3) Creates an application shell. void Create( inout int argc, inout string argv ); Parameters argc The number of parameters passed in on the command line. argv A direct reference to the parameter array. DispatchNativeEvent() Obsolete since Gecko 1.9 (Firefox 3) After event dispatch execute app specific code. void DispatchNativeEvent( in PRBool aRealEvent, in voidPtr aEvent ); Parameters aRealEvent Event is real or a null placeholder (Macintosh). aEvent Void pointer to native event structure. exit() Exit the handle...
nsICache
yDescriptor for more details. Requires the cache entry to reside in persistent storage. That is typically on a system's hard disk. STORE_ON_DISK_AS_FILE 3 The storage policy of a cache entry determines the device(s) to which it belongs. See nsICacheSession and nsICacheEntryDescriptor for more details. Requires the cache entry to reside in persistent storage, and in a separate file. STORE_OFFLINE 4 The storage policy of a cache entry determines the device(s) to which it belongs. See nsICacheSession and nsICacheEntryDescriptor for more details. Requires the cache entry to reside in persistent, reliable storage for offline use. NOT_STREAM_BASED 0 All entries for a cache session are stored as streams of data or as objects. This constant specify that cache session is not a stream based ent...
nsIClassInfo
LETON bit set, then the value of this attribute specifies a ClassID through which this class can be accessed as a service using nsIServiceManager.getService(). This attribute is similar to the classID attribute; however, this attribute exists so that C++ callers can avoid allocating and freeing a nsCID object, as would happen if they used classID. Read only. Violates the XPCOM interface guidelines Exceptions thrown NS_ERROR_NOT_AVAILABLE If the class does not have a ClassID contractID string A contractID through which an instance of this class can be created, or null. If the flags attribute has the SINGLETON bit set, then the value of this attribute specifies a ContractID through which this class may be accessed as a service using nsIServiceMan...
nsIContentSecurityPolicy
sIURI aContentLocation, in nsIURI aRequestOrigin, in nsISupports aContext, in ACString aMimeType, in nsISupports aExtra); Attributes Attribute Type Description allowsEval boolean Whether this policy allows eval and eval-like functions such as setTimeout("code string", time). Calls to this may trigger violation reports when queried, so this value should not be cached. Read only. allowsInlineScript boolean Whether this policy allows in-page script. Calls to this may trigger violation reports when queried, so this value should not be cached. Read only. isInitialized boolean Set to true when the Content Security Policy has been read in and parsed and is ready to enforce. This is a barrier for the nsDocument so it doesn't load any sub-content until either it knows that a Content Secur...
nsIContentView
ID that can be used in conjunction with nsIDOMWindowUtils to change the actual document, instead of just how it is transformed; this is a 64-bit unsigned integer. Read only. scrollX float Horizontal scroll offset in chrome-document CSS pixels. When this view is active (that is it is being painted because it's in the visible region of the screen), this value is at first lined up with the content's scroll offset. Note: When this view becomes inactive, the new content view will have scroll values that are reset to the default. Read only. scrollY float Horizontal scroll offset in chrome-document CSS pixels. Read only. viewportHeight float Height of the viewport in chrome-document CSS pixels. Read only. viewportWidth ...
nsIDOMFile
This is also used by the DataTransfer object to describe files dragged into a web application using drag and drop. Note that in Gecko, this interface currently inherits from nsISupports, but in the File API specification, it should be a Blob. ...
nsIDOMNSHTMLDocument
e Gecko 2.0 (Firefox 4 / Thunderbird 3.3 / SeaMonkey 2.1) void write( [optional] in DOMString text ); Parameters text The string to write to the document. writeln() Obsolete since Gecko 2.0 (Firefox 4 / Thunderbird 3.3 / SeaMonkey 2.1) void writeln( [optional] in DOMString text ); Parameters text The string to write to the document. A newline is automatically appended. Implemented by Classes that implement this interface: nsHTMLDocument class: content/html/document/src/nsHTMLDocument.h ...
nsIDOMWindow2
changed in Gecko 1.9 (Firefox 3) Because nsIDOMWindow is frozen, this interface was introduced in Firefox 3 (Gecko 1.9) to allow DOM windows to take on new features. DOM windows implement nsIDOMWindow2, which is a subclass of nsIDOMWindow. In Gecko 7.0 this interface has been merged into nsIDOMWindow. Attributes Attribute Type Description applicationCache nsIDOMOfflineResourceList The application cache object for this window. Read only. windowRoot nsIDOMEventTarget The window root for this window. This is useful for connecting event listeners to this window as well as every other window nested in that window root. Not accessible from scripts. Read only. See also DOM nsIDOMWindow ...
nsIDOMXULLabeledControlElement
ssKey DOMString This should be set to a character that is used as a shortcut key. This should be one of the characters that appears in the label for the element. When the user presses the appropriate modifier and the access key, the element will be focused and/or activated from anywhere in the window. On non-Macintosh platforms, the character on the element's label matching the access key is underlined. Note: The access key is copied to any associated label element. command DOMString This property reflects the element's command attribute. crop DOMString This property reflects the element's crop attribute. image DOMString This property reflects the element's image attribute. label DOMString This property reflects the element's label attribute. ...
nsIDirIndexListener
x); void onInformationAvailable(in nsIRequest aRequest, in nsISupports aCtxt, in AString aInfo); Methods onIndexAvailable() Called for each directory entry. void onIndexAvailable( in nsIRequest aRequest, in nsISupports aCtxt, in nsIDirIndex aIndex ); Parameters aRequest The request. aCtxt Opaque parameter aIndex New index to add. onInformationAvailable() Called for each information line. void onInformationAvailable( in nsIRequest aRequest, in nsISupports aCtxt, in AString aInfo ); Parameters aRequest The request. aCtxt Opaque parameter aInfo New info to add. ...
nsIEditorSpellCheck
boolean enableSelectionChecking ); Parameters editor The nsIEditor on which to enable spell checking. enableSelectionChecking If true, the spell checker is initialized only for checking the current selection; otherwise, it's initialized for checking the entire document. This affects the behavior of GetNextMisspelledWord()). For spell checking clients with no modal UI (such as inline spell checkers), this flag is not relevant. RemoveWordFromDictionary() Removes a word from the current personal dictionary. void RemoveWordFromDictionary( in wstring word ); Parameters word The word to remove from the current personal dictionary. ReplaceWord() Call this function to modally replace one (or all) occurrences of a word with another word. void ReplaceWord( in wstring m...
nsIException
the location that caused the error, which may or may not be a source file location. For example, standard language errors would generally have the same location as their top stack entry. File parsers may put the location of the file they were parsing. null indicates "no data" Read only. inner nsIException An inner exception that triggered this, if available. Read only. lineNumber PRUint32 Valid line numbers begin at '1'. '0' indicates unknown. Read only. location nsIStackFrame A stack trace, if available. Read only. message string A custom message set by the thrower. [binaryname(MessageMoz)] Read only. name string The name of the error code (A string representation of result) Read only. result nsresult ...
nsIFeedEntry
n content nsIFeedTextConstruct The full text of the entry's content. This comes from the atom:content and/or content:encoded fields. enclosures nsIArray An array of all the enclosures included in the entry. These are used by podcasts, photocasts, and so forth. mediaContent nsIArray An array of all the enclosures or other media that might be displayed inline in the entry. parent nsIFeedContainer A reference to the entry's parent, which is either a feed (nsIFeed or another entry. published AString A string indicating the date on which the entry was published, in RFC822 format. This date is parsable by both JavaScript (via Date.parse()) and mail code. Note, that the related updated attribute is available from the nsIFeedCo...
nsIFileInputStream
open and the seek occurs, it will happen naturally. (The file will only be reopened if it is closed for some reason.) DEFER_OPEN 1<<4 If this is set, the file will be opened (i.e., a call to PR_Open() done) only when we do an actual operation on the stream, or more specifically, when one of the following is called: Seek() Tell() Available() Read() ReadLine() DEFER_OPEN is useful if we use the stream on a background thread, so that the opening and possible stating of the file happens there as well. Note: Using this flag results in the file not being opened during the call to init. This means that any errors that might happen when this flag is not set would happen during the first read. Also, the file is not locked when init is called,...
nsIHttpChannel
This should be set to false, for example, if the application knows that the corresponding document is likely to be very large. This attribute is true by default, though other factors may prevent pipelining. This attribute may only be set before the channel is opened. Exceptions thrown NS_ERROR_FAILURE If set after the channel has been opened...
nsIINIParserWriter
writing to an INI-format configuration file. 1.0 66 Introduced Gecko 1.9.2 Inherits from: nsISupports Last changed in Gecko 13.0 (Firefox 13.0 / Thunderbird 13.0 / SeaMonkey 2.10) This interface provides methods that allow writing to INI-format configuration files. INI files contain zero or more sections, denoted by a name in square brackets, followed by zero or more lines of text with a property name on the left, then an equals sign ("="), then the value of the property. To create an nsIINIParserWriter object, you use the nsIINIParserFactory interface to create a parser, then nsISupports.QueryInterface() that to get an nsIINIParserWriter, like this: let writer = Components.classes["@mozilla.org/xpcom/ini-processor-factory;1"]. .getService...
nsIJetpack
r() for a particular message. void unregisterReceivers( in AString aMessageName ); Parameters aMessageName The name of the message to unregister all callbacks from. evalScript() This asynchronously sends code to the Jetpack process for evaluation. The code will be evaluated using at least JavaScript 1.8.1. When evaluated, the script's global scope will include all privileged APIs. Individual lines of the form //@line 1 "foo.js" can be used to specify filename and line number information for debugging purposes. void evalScript( in AString aScript ); Parameters aScript The full contents of the script to evaluate in the Jetpack process. createHandle() This creates an opaque handle that can transparently be exchanged between processes. nsIVariant createHandle(); Parameters None. Return ...
nsIJumpListBuilder
n all calls if taskbar functionality is not supported by the operating system. maxListItems short The maximum number of jump list items the current desktop can support. Read only. Constants Constant Value Description JUMPLIST_CATEGORY_TASKS 0 Tasks are common actions performed by users within the application. A task can be represented by an application shortcut and associated command line parameters or a URI. Task lists should generally be static lists that do not change often, if at all - similar to an application menu. Tasks are given the highest priority of all lists when space is limited. JUMPLIST_CATEGORY_RECENT 1 Recent lists are based on Window's recent document lists. The lists are generated automatically by Windows. Applications that use recent or frequent lists should ...
nsIMemory
Scriptable This interface represents a generic memory allocator. Inherits from: nsISupports Last changed in Gecko 0.9.6 nsIMemory is used to allocate and deallocate memory segments from a heap. The implementation is free to define the heap. NS_GetMemoryManager returns the global nsIMemory instance. Method overview voidPtr alloc(in size_t size); Violates the XPCOM interface guidelines void free(in voidPtr ptr); Violates the XPCOM interface guidelines void heapMinimize(in boolean immediate); boolean isLowMemory(); Deprecated since Gecko 2.0 voidPtr realloc(in voidPtr ptr, in size_t newSize); Violates the XPCOM interface guidelines Methods alloc Allocates a block of memory of a particular size. voidPtr alloc( in size_t size ); P...
nsIMessageWakeupService
send from childprocessmessagemanagers will be heard. Requesting wakeups To request a wakeup, a wakeup condition must be registered with the category manager in the "wakeup-request" category. The easiest way to do this is to add the appropriate entry to the chrome manifest that registers your component (see category in "Chrome registration"). To indicate a wakeup request in a manifest file, add a line that looks something like this: category wakeup-request nsComponent @mozilla.org/myservice;1,nsIMyInterface,getService,myMessage1,myMessage2[,..] The category entry value consists of a comma separate string that contains: The contract ID for your component (e.g. "@mozilla.org/myservice;1"). The string name of interface to instantiate the component as (e.g. "nsIMyInterface"). The method to ...
nsIMimeConverter
in long encodedWordSize); Parameters header The string to encode into the MIME-encoded form. structured Whether or not this string may contain <> blocks which should not be encoded (e.g., the From and To headers). mailCharset The charset to encode into. fieldnamelen The length of the header field including the colon and space (": "). encodedWordSize The maximum line length of the encoded string. decodeMimeHeaderToCharPtr() void setStringProperty(in string propertyName, in string propertyValue); Parameters propertyName The name of the property to set. propertyValue The value of the property. decodeMimeHeader() string getStringProperty(in string propertyName); Parameters propertyName The name of the property to ret...
nsIMsgDBView
dUpdating boolean Suppress command updating. Used during folder loading. db nsIMsgDatabase Readonly: The current database of messages. supportsThreading boolean Readonly: Does the current database support threading? searchSession nsIMsgSearchSession The current search session. removeRowOnMoveOrDelete boolean Readonly: usingLines boolean Readonly: Use lines for size. If false kB are used. Methods open() Opens a folder in the database. void open(in nsIMsgFolder folder, in nsMsgViewSortTypeValue sortType, in nsMsgViewSortOrderValue sortOrder, in nsMsgViewFlagsTypeValue viewFlags, out long count); Parameters folder The nsIMsgFolder to open. sortType A nsMs...
nsIMsgFilterCustomAction
true if valid */ boolean isValidForType(in nsMsgFilterTypeType type, in nsMsgSearchScopeValue scope); /** * After the user inputs a particular action value for the action, determine * if that value is valid. * * @param actionValue The value entered. ...
nsIMsgSearchSession
nipulate search sessions within Thunderbird. To create an instance, use: var searchSession = Components.classes["@mozilla.org/messenger/searchSession;1"] .createInstance(Components.interfaces.nsIMsgSearchSession); To use the instance append search terms, set the scope, and then call search(). ...
nsIParserUtils
Methods convertToPlainText() Converts HTML to plain text. AString convertToPlainText( in AString src, in unsigned long flags, in unsigned long wrapCol ); Parameters src The HTML source to parse (C++ callers are allowed but not required to use the same string for the return value.) flags Conversion option flags defined in nsIDocumentEncoder. wrapCol Number of characters per line; 0 for no auto-wrapping. Return value The plain text conversion of the HTML specified in src. parseFragment() Parses markup into a sanitized document fragment. nsIDOMDocumentFragment parseFragment( in AString fragment, in unsigned long flags, in boolean isXML, in nsIURI baseURI, in nsIDOMElement element ); Parameters fragment The input markup. flags Sanitization option fla...
nsIPluginHost
fter that, then it assumes there is http headers in the input buffer and continue to search for end of headers (CRLFCRLF or LFLF). It will *always malloc()* output buffer (caller is responsible to free it) if input buffer starts with LF, which comes from 4.x spec http://developer.netscape.com/docs/manuals/communicator/plugin/pgfn2.htm#1007754 "If no custom headers are required, simply add a blank line ('\n') to the beginning of the file or buffer.", it skips that '\n' and considers rest of the input buffer as data. If "Content-length" string and end of headers is found it substitutes single LF with CRLF in the headers, so the end of headers always will be CRLFCRLF (single CR in headers, if any, remain untouched) else it puts "Content-length: "+size_of_data+CRLFCRLF at the beginning of the outp...
nsIPrincipal
e, out string grantedList, out string deniedList, out boolean isTrusted ); Parameters prefBranch On return, contains the preference branch to which the preferences pertain. id A semi-unique ID relating to either the fingerprint or the origin. subjectName A name identifying the entity the principal represents; this may be an empty string. grantedList Space-delineated list of capabilities which are explicitly granted by a preference. deniedList Space-delineated list of capabilities which are explicitly denied by a preference. isTrusted true if the certificate is a codebase trusted one. Native code only!isCapabilityEnabled boolean isCapabilityEnabled( in string capability, in voidPtr annotation ); Parameters capability Missing...
nsIPrivateBrowsingService
view void removeDataFromDomain(in AUTF8String aDomain); Attributes Attribute Type Description autoStarted boolean Indicates whether or not private browsing was started automatically at application launch time. This is only ever true if privateBrowsingEnabled is also true. Read only. lastChangedByCommandLine boolean Indicates whether or not the last private browsing mode transition was performed on the command line (using either the -private or -private-toggle switches) rather than the user interface. Read only. privateBrowsingEnabled boolean Indicates whether or not private browsing mode is currently enabled. You may also turn private browsing mode on and of...
nsIPropertyBag
Services.appinfo.OS simply tells us WINNT only, this is not helpful to differentiate between Windows XP, Vi...
nsISelection
" collapses the selection to the end of the selection and applies the movement direction/granularity to the collapsed() selection. "extend()" leaves the start of the selection unchanged, and applies movement direction/granularity to the end of the selection. direction Can be one of { "forward", "backward", "left", "right" } granularity Can be one of { "character", "word", "line", "lineboundary" } removeAllRanges() Removes all nsIDOMRanges from the current selection. void removeAllRanges(); Parameters None removeRange() Removes a range from the current selection. void removeRange( in nsIDOMRange range ); Parameters range selectAllChildren() Adds all children of the specified node to the selection. void selectAllChildren( in nsIDOMNode parentNode ); Paramete...
nsISelection3
xtend" } "move" collapses the selection to the end of the selection and applies the movement direction/granularity to the collapsed selection. "extend" leaves the start of the selection unchanged, and applies movement direction/granularity to the end of the selection. direction Can be one of { "forward", "backward", "left", "right" } granularity Can be one of { "character", "word", "line", "lineboundary" } See also nsISelection ...
nsISelectionPrivate
Attribute Type Description canCacheFrameOffset boolean Frame Offset cache can be used just during calling nsEditor::EndPlaceHolderTransaction. EndPlaceHolderTransaction will give rise to reflow/refreshing view/scroll, and call times of nsTextFrame::GetPointFromOffset whose return value is to be cached. See bug 35296 and bug 199412 Native code only! interlinePosition boolean type short Returns the type of the selection (see nsISelectionController for available constants). Read only. Constants Constant Value Description ENDOFPRECEDINGLINE 0 STARTOFNEXTLINE 1 TABLESELECTION_NONE 0 TABLESELECTION_CELL 1 TABLESELECTION_ROW 2 ...
nsIStackFrame
ample, standard language errors would generally have the same location as their top stack entry. File parsers may put the location of the file they were parsing, and so forth. null indicates "no data" Read only. language PRUint32 See nsIProgrammingLanguage for a list of language constants. Read only. languageName string See nsIProgrammingLanguage for a list of language constants. Read only. lineNumber PRInt32 Valid line numbers begin at '1'. '0' indicates unknown. Read only. name string The name of the function at this point in the stack. Read only. sourceLine string The location of this function in filename Read only. Example To output the stack at a particular location: var s = Components.stack; while(s) { console.log(s.name); s = s.caller; } Methods toString() A generic for...
nsIStringBundleService
nts. Typically used to format a message received by a nsIProgressEventSink's onStatus method. wstring formatStatusMessage( in nsresult aStatus, in wstring aStatusArg ); Parameters aStatus The status code. This is mapped into a string ID and and used in the string lookup process (see nsIErrorService). aStatusArg The status message argument(s). Multiple arguments can be separated by newline ('\n') characters. Return value The formatted message. See also Code snippets : Miscellaneous : Using string bundles from JavaScript How to localize html pages, xul files, and js/jsm files from bootstrapped add-ons. The localizing js/jsm files uses the nsIStringBundleService: Bootstrapped Extensions :: Localization (L10n) nsIStringBundle ...
nsIThreadEventFilter
more information. You should implement this interface and its acceptEvent() method, then pass the object implementing it as the filter. xpcom/threads/nsIThreadInternal.idlScriptable Please add a summary to this article. Last changed in Gecko 1.9 (Firefox 3) Inherits from: nsISupports Method overview boolean acceptEvent(in nsIRunnable event);Violates the XPCOM interface guidelines Methods Violates the XPCOM interface guidelines acceptEvent() This method is called to determine whether or not an event may be accepted by a nested event queue. (see nsIThreadInternal.PushEventQueue()) Warning: This method must not make any calls on the thread object. boolean acceptEvent( in nsIRunnable event ); Parameters event The event being dispatched. Retur...
nsITransferable
kPNGImageMime image/png PNG image. kJPEGImageMime image/jpeg JPEG image. kJPGImageMime image/jpg JPEG image. kGIFImageMime image/gif GIF image. kFileMime application/x-moz-file An arbitrary file (is this an nsIFile?) kURLMime text/x-moz-url A Mozilla URL object; this is a text string containing the URL, a newline (\n), then the title of the page. kURLDataMime text/x-moz-url-data A string containing only a URL. kURLDescriptionMime text/x-moz-url-desc A string containing only a description. kURLPrivateMime text/x-moz-url-priv The same as kURLDataMIme, except intended for private use only. kNativeImageMime application/x-moz-nativeimage An image in G...
nsIWebProgressListener
ly exclusive (that is an onStateChange() event may indicate some combination of these flags). Constant Value Description STATE_IS_REQUEST 0x00010000 This flag indicates that the state transition is for a request, which includes but is not limited to document requests. (See below for a description of document requests.) Other types of requests, such as requests for inline content (for example images and stylesheets) are considered normal requests. STATE_IS_DOCUMENT 0x00020000 This flag indicates that the state transition is for a document request. This flag is set in addition to STATE_IS_REQUEST. A document request supports the nsIChannel interface and its loadFlags attribute includes the nsIChannel::LOAD_DOCUMENT_URI flag. A document reque...
nsIXULTemplateBuilder
ue datasource object that is used for the template. This object is created by the getDataSource method of the query processor. May be null if the datasource has not been loaded yet. Set this attribute to use a different datasource and rebuild the template. For an RDF datasource, this will be the same as the database. For XML this will be the nsIDOMNode for the datasource document or node for an inline reference (such as #name). Other query processors may use other types for the datasource. database nsIRDFCompositeDataSource Readonly: The composite datasource that the template builder observes and uses to create content. This is used only for RDF queries and is maintained for backwards compatibility. It will be the same object as the datasource property. For non-RDF queries, it will always b...
NS_IF_RELEASE
This page still needs some work, help to improve it! Summary Macro Decrements the reference count of a pointer by one. This macro also sets the pointer to NULL. ...
NS_CStringAppendData
Data [in] A raw character array to copy into this string. aDataLength [in] The length of aData, measured in storage units. If equal to PR_UINT32_MAX, then aData is assumed to be null-terminated. Otherwise, aData need not be null-terminated. Return Values The NS_CStringAppendData function returns NS_OK if successful. Otherwise, it returns an error code. Remarks This function is defined inline as a wrapper around NS_CStringSetDataRange. Example nsCStringContainer str; NS_CStringContainerInit(str); NS_CStringSetData(str, "hello"); NS_CStringAppendData(str, " world"); const char* data; NS_CStringGetData(str, &data); printf("%s\n", data); // prints out "hello world" NS_CStringContainerFinish(str); History This function was frozen for Mozilla 1.7. See bug 239123 for details. See...
NS_CStringCutData
aCutStart [in] The starting index of the section to remove, measured in storage units. aCutLength [in] The length of the section to remove, measured in storage units. Pass PR_UINT32_MAX to specify the length from aCutStart to the end of the string. Return Values The NS_CStringCutData function returns NS_OK if successful. Otherwise, it returns an error code. Remarks This function is defined inline as a wrapper around NS_CStringSetDataRange . Example Code nsCStringContainer str; NS_CStringContainerInit(str); NS_CStringSetData(str, "hello world"); // remove " world" portion of string NS_CStringCutData(str, 5, PR_UINT32_MAX); const char* data; NS_CStringGetData(str, &data); printf("%s\n", data); // prints out "hello" NS_CStringContainerFinish(str); History This functio...
NS_CStringInsertData
ers. aData [in] A raw character array to copy into this string. aDataLength [in] The length of aData, measured in storage units. If equal to PR_UINT32_MAX, then aData is assumed to be null-terminated. Otherwise, aData need not be null terminated. Return Values The NS_CStringInsertData function returns NS_OK if successful. Otherwise, it returns an error code. Remarks This function is defined inline as a wrapper around NS_CStringSetDataRange. Example Code nsCStringContainer str; NS_CStringContainerInit(str); NS_CStringSetData(str, "hello"); NS_CStringInsertData(str, 5, " world"); const char* data; NS_CStringGetData(str, &data); printf("%s\n", data); // prints out "hello world" NS_CStringContainerFinish(str); History This function was frozen for Mozilla 1.7. See bug 2391...
NS_StringAppendData
aData [in] A raw character array to copy into this string. aDataLength [in] The length of aData, measured in storage units. If equal to PR_UINT32_MAX, then aData is assumed to be null-terminated. Otherwise, aData need not be null terminated. Return Values The NS_StringAppendData function returns NS_OK if successful. Otherwise, it returns an error code. Remarks This function is defined inline as a wrapper around NS_StringSetDataRange Note: GCC requires the -fshort-wchar option to compile this example since PRUnichar is an unsigned short. This example should compile by default under MSVC. Example Code nsStringContainer str; NS_StringContainerInit(str); NS_StringSetData(str, L"hello"); NS_StringAppendData(str, L" world"); const PRUnichar* data; NS_StringGetData(str, &d...
NS_StringCutData
utStart [in] The starting index of the section to remove, measured in storage units. aCutLength [in] The length of the section to remove, measured in storage units. Pass PR_UINT32_MAX to specify the length from aCutStart to the end of the string. Return Values The NS_StringCutData function returns NS_OK if successful. Otherwise, it returns an error code. Remarks This function is defined inline as a wrapper around NS_StringSetDataRange. Note: GCC requires the -fshort-wchar option to compile this example since PRUnichar is an unsigned short. This example should compile by default under MSVC. Example Code nsStringContainer str; NS_StringContainerInit(str); NS_StringSetData(str, L"hello world"); // remove " world" portion of string NS_StringCutData(str, 5, PR_UINT32_MAX); ...
NS_StringInsertData
aData [in] A raw character array to copy into this string. aDataLength [in] The length of aData, measured in storage units. If equal to PR_UINT32_MAX, then aData is assumed to be null-terminated. Otherwise, aData need not be null terminated. Return Values The NS_StringInsertData function returns NS_OK if successful. Otherwise, it returns an error code. Remarks This function is defined inline as a wrapper around NS_StringSetDataRange . Note: GCC requires the -fshort-wchar option to compile this example since PRUnichar is an unsigned short. This example should compile by default under MSVC. Example Code nsStringContainer str; NS_StringContainerInit(str); NS_StringSetData(str, L"hello"); NS_StringInsertData(str, 5, L" world"); const PRUnichar* data; NS_StringGetData(st...
nsMsgMessageFlags
sage has been flagged/starred Expunged 0x00000008 Indicates whether or not the message is deleted (but not compacted) HasRe 0x00000010 Indicates whether or not 'Re: ' should be added to the head of the subject to get the proper subject. Elided 0x00000020 Indicates whether or not the thread rooted at this message is open or closed in the UI. Offline 0x00000080 Indicates whether or not we have this message in the offline cache. Watched 0x00000100 Indicates whether or not this thread is being watched. SenderAuthed 0x00000200 Partial 0x00000400 Indicates whether or not the body we have is a complete message. Queued 0x00000800 Indicates whether or not the message is queued to be...
nsMsgViewCommandType
hown as read expandAll 11 Expand all threads. collapseAll 12 Collapse all threads. copyMessages 13 Copy the selected messages. Use with nsIMsgDBView.doCommandWithFolder() to select the destination folder. moveMessages 14 Move the selected messages. Use with nsIMsgDBView.doCommandWithFolder() to select the destination folder. selectAll 15 Select all messages. downloadSelectedForOffline 16 Download the selected messages for offline. downloadFlaggedForOffline 17 Download all flagged messages for offline. selectThread 18 Select the entire thread. selectFlagged 19 Select all flagged messages. cmdRequiringMsgBody 20 Used with nsIMsgDBView.getCommandStatus() to determine if commands requiring the message body (i.e. reload or print preview) are available. label0 21 Att...
Troubleshooting XPCOM components registration
OK in the top right, check for any missing dependencies using File -> Open -> firefox.exe (or equivalent). Also check that the function NSGetModule is exported. You can also use the Profiling feature of Dependency Walker to view failed module loads while running your application. Open the Profile menu and select Start Profiling.... In the dialog that appears, you can provide command line parameters and click OK to start the application. You will see any modules that failed to load in the module list. Note: You should delete compreg.dat from your profile before doing this. Note that even your version of MSVC may matter; your test machine may not have the C runtime libraries (msvcr70.dll / msvcp70.dll for MSVC 7.0, and similarly named files for 7.1 and 8.0) ...
Using the Gecko SDK
on to this rule. ...
Weak reference
eference, but arrange to Release it out-of-band; this must be before the destructor, which would otherwise never be called. You might hold a raw pointer (without AddRefing and Releaseing it), and avoid using it in cases where it might dangle. See also The source xpcom/base/nsIWeakReference.idl xpcom/glue/nsWeakReference.h xpcom/glue/nsWeakReference.cpp XPCOM ownership guidelines Using nsCOMPtr Original Document Information Author: Scott Collins Last Updated Date: September 23, 2000 Copyright Information: Portions of this content are (C) 1998-2007 by individual mozilla.org contributors; content available under a Creative Commons license | Details. ...
XPCOM tasks
over nsISupportsArray? 5.1 We want to provide some mechanism for user-specific components in a multi-user environment. 5.1 Fix the shutdown issues that complicate life for embedding applications. Things we need to evangelize We need to keep up-to-date documentation, samples, and have brown-bags to keep people informed. We've been doing this, but it should be in the plan. General XPCOM guidelines. See, e.g., XPCOM Code FAQ, IDL Author's Guide, and Implementing QueryInterface. Writing and using components and modules. Building ownership models that work (see XPCOM ownership guidelines), using raw pointers, nsCOMPtr (see The nsCOMPtr User's Manual), nsIWeakReference (see nsIWeakReference), nsCWeakReference, and (across threads) proxies (see nsISupports proxies). Original Document Info...
wrappedJSObject
XPConnect wrapping Now let's get a reference to our component. In this example we use getService, but as long as we get the reference from XPCOM, our component gets wrapped by XPConnect in the same way: var comp = Components.classes["@myself.com/my-component;1"].getService(); If we try to call the hello() method we defined in our component implementation, we get: > comp.hello(); TypeError on line 1: comp.hello is not a function This happens because, as we mentioned earlier, comp is not the HelloWorld JS object itself, but an XPConnect wrapper around it: > dump(comp); [xpconnect wrapped nsISupports] The idea of these wrappers is to make the JavaScript-implemented XPCOM components look just like any other XPCOM component to the user. This also makes the public interface of the componen...
XPCOM
ponent developers and embedders can link against. It allows developers to link only against the frozen XPCOM method symbols and maintain compatibility with multiple versions of XPCOM.XPCOM guideThese articles provide tutorials and usage documentation for XPCOM, including how to use it in your own projects and how to build XPCOM components for your Firefox add-ons and the like.XPCOM ownership guidelines...naturally. If you create a temporary object, obviously it's up to you to destroy it. That's a sure sign of ownership. If you create an object with a longer lifespan, you will own it until you give ownership away.XPCOM referenceThis reference describes the interfaces and functions provided by the XPCOM library. In addition, it details the various helper classes and functions, as well as the com...
xpidl
Mozilla › Tech › XPIDL › xpidl
e Gnome project. The xpidl compiler is now part of the build process, allowing us to generate headers used by the XPCOM components. Please check the Build Documentation for further information on where to get libIDL and glib. Using xpidl To add an IDL file to the build, use the XPIDLSRCS makefile variable. ...
Mozilla technologies
licize application usage for the purpose of notifying a user's friends of the applications which their friends are using. It is not meant as a general application messaging system. Toolkit APIThe Mozilla Toolkit is a set of programming interfaces (APIs) built on top of Gecko which provide advanced services to XUL applications. These services include:Viewing and searching Mozilla source code onlineSource code for all Mozilla projects hosted in the Mercurial repositories can be searched and viewed online using Searchfox, a fast indexed search engine that runs on AWS.XML ExtrasThe XML Extras module contains several features that allow developers to treat XML as data i.e. not as just another document format. The module is structured as a drop-in component and exposes its XML-as-data features b...
The Valgrind Test Job
nd test job builds the browser and runs it under Valgrind, which can detect various common memory-related errors. This job only runs on Linux64, which is the platform best suited to running Valgrind. Running the Valgrind test job locally Valgrind works best on Linux. It also works on Mac, though sometimes not as well. Building You need a Valgrind-enabled build of Firefox. Add the following lines to your mozconfig file. ac_add_options --enable-valgrind ac_add_options --disable-jemalloc Running To run the Valgrind test job locally, run the following command. mach valgrind-test See also the general instructions for using Valgrind with Mozilla code. Understanding errors For each problem that Valgrind finds, it emits a message describing the problem, along with a stack trace indicati...
Buddy icons in mail
d matching the email, the icon will not appear. If there is a card, but no screenname, the icon will not appear. And finally, if there is no icon, the icon will not appear. The reason this file name scheme was chosen was is this is how Netscape 7.0 IM stores buddy icons on disk. So if you use NIM, and you use buddy icons, this will just work for free. Notes: You do not have to be online to use this feature. We do not show any buddy icon if you are in "collapsed" header mode. ...
DB Views (message lists)
message list) is driven by classes that implement nsIMsgDBView and inherit from nsMsgDBView. These are the main view classes: nsMsgThreadedDBView - (implementation) nsMsgSearchDBView - (implementation) nsMsgQuickSearchDBView - (implementation) nsMsgXFVirtualFolderDBView - (implementation) nsMsgGroupView - (implementation) Usually, a view object has parallel arrays, which map directly to lines in the message list: m_keys Message header key m_flags 32 bits, combination of message header flags and view-only flags (e.g., collapsed) m_level The indentation level when in threaded mode. m_folders Cross-folder views only (nsMsgSearchDBView and its descendant, nsMsgXFVirtualFolderDBView) Most of the time, the thread pane is driven by an nsMsgThreadedDBView object (even when we're ...
nsIMsgCloudFileProvider
his account. If this value is not known, returns -1. lastError ACString Readonly: The last error message received from the server. Constants The following constants are used for the status codes passed to the onStopRequest functions of the nsIRequestObserver's used by the asynchronous methods of nsIMsgCloudFileProvider. Constant Value Description offlineErr 0x80550014 Returned when it appears that there is no active network connection. authErr 0x8055001e Returned when authorizing has failed. uploadErr 0x8055311a Returned when uploading has failed for an unknown reason. uploadWouldExceedQuota 0x8055311b Returned when uploading has failed because the user has exceeded their storage quota. ...
Mailnews and Mail code review requirements
p Approvals for Intermittently Failing ("Orange") Test Fixes/Debugging In order to make it easier to debug and fix tests that fail intermittently ("intermittent orange" tests), we have created the following two rubber-stamps based on this proposal on the tb-planning mailing list. The procedure to use these is to be sure to: include "rs=simple-orange-fix" or "rs=orange-debugging" in the first line of the commit message paste a link to the pushed commit with the rubber stamp in the bug make sure you pasted a link to any try-server pushes of the patch in the bug rs=simple-orange-fix Requirements: The patch is fixing an intermittent orange test failure. The patch is a change exclusively to test logic. The patch has identified a likely problem and fixes it; no commenting out tests/c...
Demo Addon
on(myListener); At first, a new Gloda query for finding messages is created. The subject is assigned as search criterion. In the Gloda query result listener the variable aCollection is a GlodaCollections. It contains a collection of GlodaConversation objects which itself is a thread that contains one or more GlodaMessages. For every Gloda message subject, date and author is extracted. The last line of this example executes the Gloda query. Download Demo Addon Download ...
Add Option to Context Menu
master/gatekeeper/there.is.only.xul"> <popup id="mailContext"> <menuitem id="my_option" label="My option concise and cool label" oncommand="alert('Hi')"/> </popup> </overlay> For Thunderbird 2 and 3 in the same XPI If our extension needs to support Thunderbird 2 and 3 we need to make custom overlays for each version. This can be reached by adding these lines to the chrome.manifest file: overlay chrome://messenger/content/mailWindowOverlay.xul chrome://myaddon/content/tbOverlay-tb2.xul appversion<3.0 overlay chrome://messenger/content/mailWindowOverlay.xul chrome://myaddon/content/tbOverlay-tb3.xul appversion=>3.0 Than we need two overlay XUL files with content from examples above. Note: If our extension supports more Mozilla applications (for exa...
Using the Multiple Accounts API
Preference: mail.server.server.cleanup_inbox_on_exit - boolean, should we purge the inbox when we quit? Preference: mail.server.server.dual_use_folders - boolean - can folders contain both folders and messages? Preference: mail.server.server.empty_trash_on_exit boolean, (should not be imap-specific) - should we empty this server's trash when we quit? Preference: mail.server.server.offline_download - boolean, is this server marked for offline download? Preference: mail.server.server.override_namespaces - boolean, should we override namespaces on this server? Preference: mail.server.server.max_cached_connections - integer, max number of connections left open to the server Preference: mail.server.server.empty_trash_threshhold integer, (should not be imap-specific) max k o...
libmime content type handlers
that is useful for the user * * Note: These will all register by their content type prefixed by the * following: mimecth:text/vcard * * libmime will then use nsComponentManager::ContractIDToCLSID() to * locate the appropriate Content Type handler */ #ifndef nsIMimeContentTypeHandler_h_ #define nsIMimeContentTypeHandler_h_ typedef struct { PRBool force_inline_display; } contentTypeHandlerInitStruct; #include "prtypes.h" #include "nsISupports.h" #include "mimecth.h" // {20DABD99-F8B5-11d2-8EE0-00A024A7D144} #define NS_IMIME_CONTENT_TYPE_HANDLER_IID \ { 0x20dabd99, 0xf8b5, 0x11d2, \ { 0x8e, 0xe0, 0x0, 0xa0, 0x24, 0xa7, 0xd1, 0x44 } } class nsIMimeContentTypeHandler : public nsISupports { public: static const nsIID& GetIID() { ...
Using the Mozilla source server
ting the switch to Mercurial, you'll need cvs.exe, added to your PATH (the cvs.exe from MozillaBuild has problems, use this one instead) Note: Do not use the CVS from MozillaBuild, it will not work! Set up symbols Follow the instructions for Using the Mozilla symbol server. Once the symbol path is set you must now enable Source Server. Using the source server in WinDbg In the WinDbg command line, type .srcfix and hit enter. This enables source server support. Now, when you click on a frame in the "Calls" window, WinDbg will prompt you about running cvs to download the associated source code. If you click "Yes", WinDbg will display *BUSY* in the status bar while it downloads the source, and then it will automatically open the file and highlight the current line. Using the source ...
Using the Mozilla symbol server
st of paths to files, all relative to the directory the BLAH-symbols.txt file is found in. The source server In addition to symbols, Mozilla also has a source server, letting you do source-level debugging and inspection on demand. Troubleshooting: Symbols will not download If symbols will not download no matter what you do, the problem may be that Internet Explorer has been set to the Work Offline mode. You will not receive any warnings of this in Windbg, Visual C++ or Visual Studio. Even using the command line with symchk.exe to download symbols will fail. This is because Microsoft uses Internet Explorer's internet & proxy settings to download the symbol files. Check the File menu of Internet Explorer to ensure "Work Offline" is unchecked. ...
Working with windows in chrome code
rt and open, and many other objects available from inside a window. The functionality isn't lost, however -- you just have to use the XPCOM components directly instead of using convenient shortcuts. Of course, this doesn't matter if you just store data in the component. Learning to create XPCOM components takes time. There are several articles and books about creating XPCOM components online. Using FUEL Application object The FUEL library has been deprecated as of Firefox 41 The FUEL JavaScript library has a simple method for sharing data between windows. The Application object supports a storage property which can be used to store data globally. This method is a simplified form of the XPCOM singleton method. Application.storage.set(keyname, data); var data = Application.stor...
Declaring and Using Callbacks
is a type of function pointer, and adds a special case to its constructor. In the ordinary case, invoking the type object creates a regular CData object containing a pointer to the data. However, if the first argument is a function, js-ctypes creates a special object (known internally as a CClosure) that wraps the JavaScript function within an ordinary C function. This can all be done in a single line of code, like so: var callback = ctypes.FunctionType(...).ptr(function(...) {...}); Note: The use of .ptr() here isn't a method call; we're accessing a property that dynamically creates a callable object, and then invoking the result. If two arguments are passed to the callback constructor, the second is used as the this parameter: function myJSCallback() { alert(this.message); }; var rec...
Declaring types
urns a char * and accepts a pointer to a tm structure. const asctime = lib.declare("asctime", ctypes.default_abi, ctypes.char.ptr, struct_tm.ptr); var theTime = new struct_tm; theTime.tm_hour = 3; theTime.tm_min = 15; ... var timeStr = asctime(theTime.address()); // Pass a pointer to the tm struct var jsString = timeStr.readString(); // Convert the C string to JavaScript The last line converts the C string returned by the libc asctime() function into a JavaScript string by calling the CData readString() method. For another example see here: GetCursorPos Opaque structures An opaque structure is one whose content fields are not known, or are not intended to be accessed directly. They can also be used to handle forward declarations, by declaring a structure as opaque if it nee...
PKCS #11 Netscape Trust Objects - Network Security Services
This is not a new design, but documentation of the method already in use. ...
Flash Activation: Browser Comparison - Plugins
In each browser, the decision to enable Flash is made by users on a per-site basis. ...
Browser Side Plug-in API - Plugins
Pushes the popups-enabled state. NPN_ReloadPlugins Reloads all plug-ins in the Plugins directory. NPN_RequestRead Requests a range of bytes for a seekable stream. NPN_SetValue Sets windowless plug-in as transparent or opaque. NPN_SetValueForURL Allows a plug-in to change the stored information associated with a URL, in particular its cookies. NPN_Status Displays a message on the status line of the browser window. NPN_UserAgent Returns the browser's user agent field. NPN_Version Returns version information for the Plug-in API. NPN_Write Pushes data into a stream produced by the plug-in and consumed by the browser. ...
Plug-in Development Overview - Plugins
: Use the NPN_UserAgent method to read this information. To determine whether plug-in and the browser versions are compatible and possibly provide alternative processing for different versions: Use the NPN_Version method to check for changes in major and minor version numbers. For information about using these methods, see Version, UI, and Status Information. Displaying Messages on the Status Line Functionally, your plug-in is seamlessly integrated into the browser and operates as an addition to current browser capabilities. To make the user feel that the plug-in is part of the the browser user interface, your plug-in can emulate the browser behavior by providing status line messages. Use the NPN_Status method to display a message on the status line. For information about using this meth...
Plugin Roadmap for Firefox - Plugins
4 - Update on NPAPI Deprecation November 2014 - The Final Countdown for NPAPI August 2016 - Flash and Chrome December 2016 - Roll-out plan for HTML5 by Default July 2017 - Saying Goodbye to Flash in Chrome Microsoft Edge and Internet Explorer April 2016 - Putting Users in Control of Flash December 2016 - Extending User Control of Flash with Click-to-Run July 2017 - Flash on Windows Timeline August 2019 - Update on removing Flash from Microsoft Edge and Internet Explorer Apple Safari June 2016 - Next Steps for Legacy Plug-ins July 2017 - Adobe Announces Flash Distribution and Updates to End ...
Preferences System
es> <preference id="pref1" name="pref.name" type="bool"/> </preferences> .. UI elements that refer to the preferences above, e.g.: <checkbox id="check1" preference="pref1" label="&check1.label;" accesskey="&check1.accesskey;"/> </prefpane> <prefpane id="pane2" label="&pane2.title;" src="chrome://uri/to/pane.xul"/> </prefwindow> Pane content can be specified inline or an external chrome URI supplied for pane content to be loaded in via a dynamic overlay. You should be careful to read the HIGs for the platforms you are targeting and use the XUL preprocessor if necessary to set different window titles as appropriate. You should also be careful to specify the width of the window (in em) as appropriate using the preprocessor for each targeted platform, as well ...
DOM Inspector FAQ - Firefox Developer Tools
hey are not in the DOM generated by the original document. Okay, what if I don't want to see those anonymous nodes? You can hide anonymous nodes in inspector by unchecking the View > Show Anonymous Content menu item. I see a lot of empty #text nodes that I don't see in the original document. What are they, why are they there, and how can I get rid of them? Those text nodes are actually the newlines and spacing between the elements. Please see bug 26179 for a lengthy discussion of why they are there. The good news is, you can hide these whitespace nodes in inspector by unchecking the View > Show Whitespace Nodes menu item. Note that not all empty text nodes will be hidden. Those nodes whose white-space CSS property value prevents the user-agent from collapsing sequences of whitespace will ...
DOM Inspector internals - Firefox Developer Tools
s of development changes can be seen by simply switching away from the current viewer and back. Knowing this about the way viewers are written, we should now be at a place where we can look at the way the DOM Inspector source is organized. Source code organization The contents of the top-level directory for the DOM Inspector repository should look like base/ js/ inspector-cmdline.js Makefile.in build/ install.js Makefile.in resources/ content/ ... locale/ ... skin/ ... Makefile.in install.rdf jar.mn Makefile.in makefiles.sh Almost all the interesting stuff is in resources/content/. Its contents should resemble the following: extensions/ ... ...
Break on DOM mutation - Firefox Developer Tools
ected. When you execute the code, the debugger will pause execution when the DOM mutation occurs. In the following example, the selected node (the unordered list) is modified by adding a new child node. The panel on the right shows that execution is "Paused on DOM mutation" and you, as with any other breakpoint, you can see the call stack and view any Watch expressions you may have set up. Inline variable preview New in Firefox 71, the source pane now gives you an instant preview of the variables on each line of code you've stepped through. See Set a breakpoint > Inline variable preview for more information. ...
Pretty-print a minified file - Firefox Developer Tools
t source icon () at the bottom of the source pane. The debugger formats the source and displays it as a new file with a name like: "{ } [original-name]". After you click the icon, the source code looks like this: The Pretty print source icon is available only if the source file is minified (i.e., not an original file), and is not already "prettified". Note: if you want to prettify some inline JavaScript code, just double click the code in the inspector pane. ...
Set an XHR breakpoint - Firefox Developer Tools
s Enter. Note: If you enter a key word instead of a URL, code execution will pause on any call to a URL that contains that keyword. When your code breaks on an XHR request, the righthand pane will have two additional sections: Call stack The list of functions that were executed in order ot get to the currently executing code. Click on an item in the call stack to jump to the associated line in the code display. Scopes A list of the values that are in scope in the function, method, or event handler where the break occurred. Inline variable preview New in Firefox 71, the source pane now gives you an instant preview of the variables on each line of code you've stepped through. See Set a breakpoint > Inline variable preview for more information. ...
Source map errors - Firefox Developer Tools
s. Source map missing or inaccessible The source map resource can be missing or inaccessible. The fix here is to make sure the file is being served and is accessible to the browser Invalid source map The source map data can be invalid -- either simply not a JSON file at all, or with an incorrect structure. Typical error messages here are: SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data Error: "version" is a required argument Original source missing An original source may be missing. You may encounter this when trying to open one of the original sources in the debugger. The message looks a little different in this case: In this case, the error will also be displayed in the source tab in the debugger: NetworkError when attempting to fetch ...
Debugger.Object - Firefox Developer Tools
the call d.makeDebuggeeValue(o) returns a Debugger.Object instance that presentso as it would be seen by code ind's compartment. decompile([pretty]) If the referent is a function that is debuggee code, return the JavaScript source code for a function definition equivalent to the referent function in its effect and result, as a string. Ifpretty is present and true, produce indented code with line breaks. If the referent is not a function that is debuggee code, return undefined. call(this,argument, ...) If the referent is callable, call it with the giventhis value andargument values, and return a completion value describing how the call completed.This should be a debuggee value, or { asConstructor: true } to invoke the referent as a constructor, in which case SpiderMonkey provides an...
Deprecated tools - Firefox Developer Tools
ll also see a warning message about its removal. Scratchpad Scratchpad is deprecated as of Firefox 70 (bug 1565380), and will be removed as of Firefox 72 (bug 1519103). Description Scratchpad provided an environment for experimenting with JavaScript code. You can write, run, and examine the result of code that interacts with the web page. Alternatives In Firefox 71+, you can write multi-line JavaScript code in the Web Console Editor Mode, making it similar to the Scratchpad. The Editor Mode can be triggered clicking on the icon on the right of the console input, or with Ctrl + B (Cmd + B on macOS) When in Editor Mode, the Enter key adds a new line in the input, and you can evaluate the expression using Ctrl + Enter (Cmd + Enter on macOS). When evaluating, the input isn't cleared,...
Basic operations - Firefox Developer Tools
d to find a snapshot file on disk. Comparing snapshots Starting in Firefox 45, you can diff two heap snapshots. The diff shows you where memory was allocated or freed between the two snapshots. To create a diff, click the button that looks like a Venn diagram next to the camera icon (before Firefox 47, this looked like a "+/-" icon): You'll be prompted to select the snapshot to use as a baseline, then the snapshot to compare. The tool then shows you 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. Recording call stacks The Memory tool can tell you exactly where in your code you are allocating memory. However, recording this information has a run-time cost, so you must ask the tool to record memo...
Dominators view - Firefox Developer Tools
where in your code the objects are being allocated. This option is called "Allocation Stack" in Firefox 46. To enable this, you must check the box labeled "Record call stacks" before you run the code that allocates the objects. Then take a snapshot, then select "Call Stack" in the "Label by" drop-down. Now the node's name will contain the name of the function that allocated it, and the file, line number and character position of the exact spot where the function allocated it. Clicking the file name will take you to that spot in the Debugger. Sometimes you'll see "(no stack available)" here. In particular, allocation stacks are currently only recorded for objects, not for arrays, strings, or internal structures. Retaining Paths panel The Retaining Paths panel is new in Firefox 47. ...
CSS Flexbox Inspector: Examine Flexbox layouts - Firefox Developer Tools
ex item: The nav element within the header is both a flex item and a flex container which holds the navigation links: In the CSS pane In the CSS pane's Rules view, any instance of a display: flex declaration gets a small Flexbox icon next to the word flex. 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. The Layout Flex Container section The CSS pane's Layout view includes a collapsible "Flex Container" section. If you expand the section without selecting a flexbox container, it will onl...
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...
Inspect and select colors - Firefox Developer Tools
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. If you click on the color sample, you'll see a color picker popup, enabling you to change the color: If the color is a foreground color, the color picker tells you whether its contrast with the background color meets accessibility guidelines. Hovering the mouse over the contrast message gives a more detailed explanation. The color picker includes an eyedropper icon: clicking this icon enables you to use the eyedropper to select a new color for the element from the page: Clicking the color sample while holding down the Shift key changes the color format: ...
Reposition elements in the page - Firefox Developer Tools
ts by dragging them around the page. If an element has its position property set to absolute, relative or fixed and one or more of the top, bottom , left or right properties, the Box Model view displays a button: If you click that button, two handles appear next to the element: You can use these handles to drag the element around the page. If the element is absolutely positioned, dashed lines are shown representing the offset parent. For relatively positioned elements the dashed lines indicate the original position of the node. The offsets are indicated by a line and a tooltip for each side. ...
Debugging Firefox Desktop - Firefox Developer Tools
you'll need to ensure that both debugger and debuggee have the "Enable browser chrome and add-on debugging toolboxes" and "Enable remote debugging" settings checked in the Developer Tools Settings. You only need to do this once: the setting values persist across restarts. Start the debugger server Next, you need to start the debugger server in the debuggee. Run the debuggee from the command line, passing it the --start-debugger-server option: /path/to/firefox --start-debugger-server Passed with no arguments, --start-debugger-server makes the debugger server listen on port 6000. To use a different port, pass the desired port number: /path/to/firefox --start-debugger-server 1234 Note: in Windows, the start-debugger-server call will only have one dash: firefox.exe -start-debugger-serve...
Validators - Firefox Developer Tools
idating immediately, see the available standards-compliant authoring and development tools. Firefox Extensions for Validation Quick Reference Sidebar Tabs Install DevEdge Toolbox Sidebars for quick access to web development references. Checky Checky adds a submenu to your Netscape or Mozilla context menu that allows you to run whatever page you're on through one of (currently) 18 different online validaton and analysis services. Applications and Services DevEdge Web Tune-Up Wizard This interface to W3C services guides beginning-to-intermediate web authors through the process of updating content to support Netscape 7.x, Mozilla and other browsers that support W3C Standards. W3C HTML Validator The W3C HTML Validator will validate any Web page according to the W3C HTML standards. It is ...
Web Audio Editor - Firefox Developer Tools
udio Editor will now display the graph for the loaded audio context. Here's the graph for the Violent Theremin demo: You can see that it uses three nodes: an OscillatorNode as the source, a GainNode to control the volume, and an GainNode as the destination. Connections to AudioParams Displaying connections to AudioParams is new in Firefox 34. Connections between nodes are displayed as solid lines. 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. This list the values of that node's AudioParam properties. For example, here's wh...
ANGLE_instanced_arrays.drawArraysInstancedANGLE() - Web APIs
e gl.drawArrays() method. In addition, it can execute multiple instances of the range of elements. Note: When using WebGL2, this method is available as gl.drawArraysInstanced() by default. Syntax void ext.drawArraysInstancedANGLE(mode, first, count, primcount); Parameters mode A GLenum specifying the type primitive to render. Possible values are: gl.POINTS: Draws a single dot. gl.LINE_STRIP: Draws a straight line to the next vertex. gl.LINE_LOOP: Draws a straight line to the next vertex, and connects the last vertex back to the first. gl.LINES: Draws a line between a pair of vertices. gl.TRIANGLE_STRIP gl.TRIANGLE_FAN gl.TRIANGLES: Draws a triangle for a group of three vertices. first A GLint specifying the starting index in the array of vector points. count ...
ANGLE_instanced_arrays.drawElementsInstancedANGLE() - Web APIs
Elements() method. In addition, it can execute multiple instances of a set of elements. Note: When using WebGL2, this method is available as gl.drawElementsInstanced() by default. Syntax void ext.drawElementsInstancedANGLE(mode, count, type, offset, primcount); Parameters mode A GLenum specifying the type primitive to render. Possible values are: gl.POINTS: Draws a single dot. gl.LINE_STRIP: Draws a straight line to the next vertex. gl.LINE_LOOP: Draws a straight line to the next vertex, and connects the last vertex back to the first. gl.LINES: Draws a line between a pair of vertices. gl.TRIANGLE_STRIP gl.TRIANGLE_FAN gl.TRIANGLES: Draws a triangle for a group of three vertices. count A GLsizei specifying the number of elements to be rendered. type A GLenum s...
AesGcmParams - Web APIs
A DOMString. This should be set to AES-GCM. iv A BufferSource -- the initialization vector. This must be unique for every encryption operation carried out with a given key. Put another way: never reuse an IV with the same key. The AES-GCM specification recommends that the IV should be 96 bits long, and typically contains bits from a random number generator. Section 8.2 of the specification outlines methods for constructing IVs. Note that the IV does not have to be secret, just unique: so it is OK, for example, to transmit it in the clear alongside the encrypted message. additionalData Optional A BufferSource. This contains additional data that will not be encrypted but will be authenticated along with the encrypted data. If additionalData is given here then the same data must be given ...
AnalyserNode.AnalyserNode() - Web APIs
options Optional fftSize: The desired initial size of the FFT for frequency-domain analysis. The default is 2048. maxDecibels: The desired initial maximum power in dB for FFT analysis. The default is -30. ...
AnalyserNode.frequencyBinCount - Web APIs
2, 64, 128, 256, 512, 1024, 2048, 4096, 8192, and 16384. 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. For more complete applied examples/information, check out our Voice-change-O-matic demo (see app.js lines 128-205 for relevant code). var audioCtx = new (window.AudioContext || window.webkitAudioContext)(); var analyser = audioCtx.createAnalyser(); analyser.minDecibels = -90; analyser.maxDecibels = -10; ... analyser.fftSize = 256; var bufferLength = analyser.frequencyBinCount; console.log(bufferLength); var dataArray = new Uint8Array(bufferLength); canvasCtx.clearRect(0, 0, WIDTH, HEIGHT); fu...
AnalyserNode.getFloatFrequencyData() - Web APIs
For example, for 48000 sample rate, the last item of the array will represent the decibel value for 24000 Hz. If you need higher performance and don't care about precision, you can use AnalyserNode.getByteFrequencyData() instead, which works on a Uint8Array. ...
AnalyserNode.maxDecibels - Web APIs
nDecibels is set, an IndexSizeError exception is thrown. 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. For more complete applied examples/information, check out our Voice-change-O-matic demo (see app.js lines 128-205 for relevant code). var audioCtx = new (window.AudioContext || window.webkitAudioContext)(); var analyser = audioCtx.createAnalyser(); analyser.minDecibels = -90; analyser.maxDecibels = -10; ... analyser.fftSize = 256; var bufferLength = analyser.frequencyBinCount; console.log(bufferLength); var dataArray = new Uint8Array(bufferLength); canvasCtx.clearRect(0, 0, WIDTH, HEIGHT); fu...
AnalyserNode.minDecibels - Web APIs
Decibels is set, an INDEX_SIZE_ERR exception is thrown. 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. For more complete applied examples/information, check out our Voice-change-O-matic demo (see app.js lines 128-205 for relevant code). var audioCtx = new (window.AudioContext || window.webkitAudioContext)(); var analyser = audioCtx.createAnalyser(); analyser.minDecibels = -90; analyser.maxDecibels = -10; ... analyser.fftSize = 256; var bufferLength = analyser.frequencyBinCount; console.log(bufferLength); var dataArray = new Uint8Array(bufferLength); canvasCtx.clearRect(0, 0, WIDTH, HEIGHT); fu...
AnalyserNode.smoothingTimeConstant - Web APIs
ange 0-1 is set, an INDEX_SIZE_ERR exception is thrown. 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. For more complete applied examples/information, check out our Voice-change-O-matic demo (see app.js lines 128-205 for relevant code). If you are curious about the effect the smoothingTimeConstant() has, try cloning the above example and setting analyser.smoothingTimeConstant = 0; instead. You'll notice that the value changes are much more jarring. var audioCtx = new (window.AudioContext || window.webkitAudioContext)(); var analyser = audioCtx.createAnalyser(); analyser.minDecibels = -90; analyser.
Animation.currentTime - Web APIs
Syntax var currentTime = Animation.currentTime; Animation.currentTime = newTime; Value A number representing the current time in milliseconds, or null to deactivate the animation. Examples In the Drink Me/Eat Me game, Alice's height is animated so it can go from small to large or large to small. ...
Animation.onfinish - Web APIs
n the animation completes naturally, as well as when the Animation.finish() method is called to immediately cause the animation to finish up. The "paused" play state supersedes the "finished" play state; if the animation is both paused and finished, the "paused" state is the one that will be reported. You can force the animation into the "finished" state by setting its startTime to document.timeline.currentTime - (Animation.currentTime * Animation.playbackRate). Syntax var finishHandler = Animation.onfinish; Animation.onfinish = finishHandler; Value A function to be called to handle the finish event, or null if no finish event handler is set. Examples Animation.onfinish is used several times in the Alice in Web Animations API Land Growing/Shrinking Alice Game. Here is one instance wh...
Animation.playbackRate - Web APIs
The playback rate is initially 1. Syntax var currentPlaybackRate = Animation.playbackRate; Animation.playbackRate = newRate; Value Takes a number that can be 0, negative, or positive. Negative values reverse the animation. ...
Animation.startTime - Web APIs
An animation's start time is initially unresolved (meaning that it's null because it has no value). ...
AnimationPlaybackEvent - Web APIs
the Web Animations API represents animation events. As animations play, they report changes to their playState through animation events. Constructor AnimationPlaybackEvent.AnimationPlaybackEvent() Constructs a new AnimationPlaybackEvent object instance. Attributes AnimationPlaybackEvent.currentTime The current time of the animation that generated the event. AnimationPlaybackEvent.timelineTime The time value of the timeline of the animation that generated the event. Specifications Specification Status Comment Web AnimationsThe definition of 'AnimationPlaybackEvent' in that specification. Working Draft Editor's draft. ...
AudioBuffer - Web APIs
AudioContext.createBuffer(). Once put into an AudioBuffer, the audio can then be played by being passed into an AudioBufferSourceNode. Objects of these types are designed to hold small audio snippets, typically less than 45 s. For longer sounds, objects implementing the MediaElementAudioSourceNode are more suitable. The buffer contains data in the following format: non-interleaved IEEE754 32-bit linear PCM with a nominal range between -1 and +1, that is, 32bits floating point buffer, with each samples between -1.0 and 1.0. If the AudioBuffer has multiple channels, they are stored in separate buffer. Constructor AudioBuffer() Creates and returns a new AudioBuffer object instance. Properties AudioBuffer.sampleRate Read only Returns a float representing the sample rate, in samples pe...
AudioContext.close() - Web APIs
ell; however, it will forcibly release any system audio resources that might prevent additional AudioContexts from being created and used, suspend the progression of audio time in the audio context, and stop processing audio data. The returned Promise resolves when all AudioContext-creation-blocking resources have been released. This method throws an INVALID_STATE_ERR exception if called on an OfflineAudioContext. Syntax var audioCtx = new AudioContext(); audioCtx.close().then(function() { ... }); await audioCtx.close(); Returns A Promise that resolves with void. Example The following snippet is taken from our AudioContext states demo (see it running live.) When the stop button is clicked, close() is called. When the promise resolves, the example is reset to its beginning state. stopBt...
AudioContext.resume() - Web APIs
Syntax completePromise = audioContext.resume(); Parameters None. Return value A Promise that resolves when the context has resumed. The promise is rejected if the context has already been closed. ...
AudioContext.suspend() - Web APIs
ethod of the AudioContext Interface suspends the progression of time in the audio context, temporarily halting audio hardware access and reducing CPU/battery usage in the process -- this is useful if you want an application to power down the audio hardware when it will not be using an audio context for a while. This method will cause an INVALID_STATE_ERR exception to be thrown if called on an OfflineAudioContext. Syntax var audioCtx = new AudioContext(); audioCtx.suspend().then(function() { ... }); Returns A Promise that resolves with void. The promise is rejected if the context has already been closed. Example The following snippet is taken from our AudioContext states demo (see it running live.) When the suspend/resume button is clicked, the AudioContext.state is queried -- if it is ...
AudioDestinationNode.maxChannelCount - Web APIs
Syntax var audioCtx = new AudioContext(); var myDestination = audioCtx.destination; myDestination.maxChannelCount = 2; Value An unsigned long. ...
AudioListener.setOrientation() - Web APIs
scribes the direction of the face of the listener, that is the direction the nose of the person is pointing towards. The front vector's default value is (0, 0, -1). The up vector, defined by three unitless parameters xUp, yUp and zUp, describes the direction of the top of the listener's head. The up vector's default value is (0, 1, 0). The two vectors must be separated by an angle of 90? -- in linear analysis terms, they must be perpendicular to each other. Syntax var audioCtx = new AudioContext(); var myListener = audioCtx.listener; myListener.setOrientation(0,0,-1,0,1,0); Returns Void. Example In the following example, you can see an example of how the createPanner() method, AudioListener and PannerNode would be used to control audio spatialisation. Generally you will define the p...
AudioNode.connect() - Web APIs
Web › API › AudioNode › connect
nnect(). Fan-in and fan-out are therefore supported. An AudioParam will take the rendered audio data from any AudioNode output connected to it and convert it to mono by down-mixing (if it is not already mono). Next, it will mix it together with any other such outputs, and the intrinsic parameter value (the value the AudioParam would normally have without any audio connections), including any timeline changes scheduled for the parameter. Therefore, it is possible to choose the range in which an AudioParam will change by setting the value of the AudioParam to the central frequency, and to use a GainNode between the audio source and the AudioParam to adjust the range of the AudioParam changes. Specifications Specification Status Comment Web Audio APIThe definition of '...
AudioNode.context - Web APIs
Web › API › AudioNode › context
The read-only context property of the AudioNode interface returns the associated BaseAudioContext, that is the object representing the processing graph the node is participating in. Syntax var aContext = anAudioNode.context; Value The AudioContext or OfflineAudioContext object that was used to construct this AudioNode. Example const AudioContext = window.AudioContext || window.webkitAudioContext; const audioCtx = new AudioContext(); const oscillator = audioCtx.createOscillator(); const gainNode = audioCtx.createGain(); oscillator.connect(gainNode).connect(audioCtx.destination); console.log(oscillator.context); // AudioContext console.log(oscillator.context === audioCtx); // true Specifications Specification Status Comment Web Audio APIThe definition of 'cont...
AudioParam.exponentialRampToValueAtTime() - Web APIs
oParam Interface schedules a gradual exponential change in the value of the AudioParam. The change starts at the time specified for the previous event, follows an exponential ramp to the new value given in the value parameter, and reaches the new value at the time given in the endTime parameter. Note: Exponential ramps are considered more useful when changing frequencies or playback rates than linear ramps because of the way the human ear works. Syntax var AudioParam = AudioParam.exponentialRampToValueAtTime(value, endTime) Parameters value A floating point number representing the value the AudioParam will ramp to by the given time. endTime A double representing the exact time (in seconds) after the ramping starts that the changing of the value will stop. Returns A reference to...
AudioParam.setTargetAtTime() - Web APIs
in startTime and exponentially moves towards the value given by the target parameter. The decay rate as defined by the timeConstant parameter is exponential; therefore the value will never reach target completely, but after each timestep of length timeConstant, the value will have approached target by another 1-e-1?63.2%1 - e^{-1} \approx 63.2%. For the complete formula (which uses a first-order linear continuous time-invariant system), check the Web Audio specification. If you absolutely need to reach the target value by a specific time, you can use AudioParam.exponentialRampToValueAtTime(). However, for mathematical reasons, that method does not work if the current value or the target value is 0. Choosing a good timeConstant As mentioned above, the value changes exponentially, with each ...
AudioParam.setValueCurveAtTime() - Web APIs
Syntax var paramRef = param.setValueCurveAtTime(values, startTime, duration); Parameters values An array of floating-point numbers representing the value curve the AudioParam will change through along the specified duration. ...
AudioParam.value - Web APIs
Web › API › AudioParam › value
ds the time specified by a previous call to setValueAtTime(), the value is changed to the value passed into setValueAtTime(). If any gradiated or ramped value changing methods have been called and the current time is within the time range over which the graduated change should occur, the value is updated based on the appropriate algorithm. These ramped or gradiated value-changing methods include linearRampToValueAtTime(), setTargetAtTime(), and setValueCurveAtTime(). Thus, the value of a parameter is maintained to accurately reflect the state of the parameter over time. Example This example instantly changes the volume of a GainNode to 40%. const audioCtx = new AudioContext(); const gainNode = audioCtx.createGain(); gainNode.gain.value = 0.4; //which is identical to: gainNode.gain.setVal...
AudioParam - Web APIs
or the parameter's nominal (effective) range. AudioParam.value Represents the parameter's current value as of the current time; initially set to the value of defaultValue. Methods AudioParam.setValueAtTime() Schedules an instant change to the value of the AudioParam at a precise time, as measured against AudioContext.currentTime. The new value is given by the value parameter. AudioParam.linearRampToValueAtTime() Schedules a gradual linear change in the value of the AudioParam. The change starts at the time specified for the previous event, follows a linear ramp to the new value given in the value parameter, and reaches the new value at the time given in the endTime parameter. AudioParam.exponentialRampToValueAtTime() Schedules a gradual exponential change in the value of the Audio...
AudioParamDescriptor - Web APIs
Working Draft Initial definition. ...
AudioTrack.language - Web APIs
Syntax var audioTrackLanguage = AudioTrack.language; Value A DOMString specifying the BCP 47 (RFC 5646) format language tag of the primary language used in the audio track, or an empty string ("") if the language is not specified or known, or if the track doesn't contain speech. ...
AudioWorkletGlobalScope - Web APIs
to the console in the constructor of a custom AudioWorkletProcessor. First we need to define the processor, and register it. Note that this should be done in a separate file. ...
AudioWorkletNode.parameters - Web APIs
Working Draft ...
AudioWorkletProcessor.parameterDescriptors (static getter) - Web APIs
Working Draft ...
AudioWorkletProcessor - Web APIs
want custom AudioParams on your node, you can supply a parameterDescriptors property as a static getter on the processor. The array of AudioParamDescriptor-based objects returned is used internally to create the AudioParams during the instantiation of the AudioWorkletNode. The resulting AudioParams reside in the parameters property of the node and can be automated using standard methods such as linearRampToValueAtTime. Their calculated values will be passed into the process() method of the processor for you to shape the node output accordingly. Processing audio An example algorithm of creating a custom audio processing mechanism is: Create a separate file; In the file: Extend the AudioWorkletProcessor class (see "Deriving classes" section) and supply your own process() method in ...
BaseAudioContext.createBuffer() - Web APIs
buffer should have. The default value is 1, and all user agents must support at least 32 channels. length An integer representing the size of the buffer in sample-frames (where each sample-frame is the size of a sample in bytes multiplied by numOfChannels). To determine the length to use for a specific number of seconds of audio, use numSeconds * sampleRate. sampleRate The sample rate of the linear audio data in sample-frames per second. All browsers must support sample rates in at least the range 8,000 Hz to 96,000 Hz. Returns An AudioBuffer configured based on the specified options. Exceptions NotSupportedError One or more of the options are negative or otherwise has an invalid value (such as numberOfChannels being higher than supported, or a sampleRate outside the nominal range...
BaseAudioContext.createWaveShaper() - Web APIs
It is used to apply distortion effects to your audio. Syntax baseAudioCtx.createWaveShaper(); Returns A WaveShaperNode. Example The following example shows basic usage of an AudioContext to create a wave shaper node. For applied examples/information, check out our Voice-change-O-matic demo (see app.js for relevant code). Note: Sigmoid functions are commonly used for distortion curves because of their natural properties. Their S-shape, for instance, helps create a smoother sounding result. ...
BaseAudioContext.currentTime - Web APIs
It starts at 0. Syntax var curTime = baseAudioContext.currentTime; Example var AudioContext = window.AudioContext || window.webkitAudioContext; var audioCtx = new AudioContext(); // Older webkit/blink browsers require a prefix ... ...
Blob() - Web APIs
Web › API › Blob › Blob
bjects, or a mix of any of such objects, that will be put inside the Blob. USVString objects are encoded as UTF-8. options Optional An optional object of type BlobPropertyBag which may specify any of the following properties: type Optional The MIME type of the data that will be stored into the blob. The default value is the empty string, (""). endings Optional How to interpret newline characters (\n) within the contents, if the data is text. The default value, transparent, copies newline characters into the blob without changing them. To convert newlines to the host system's native convention, specify the value native. Return value A new Blob object containing the specified data. Example var aFileParts = ['<a id="a"><b id="b">hey!</b></a>']; // an array consisting of ...
BlobEvent.timecode - Web APIs
Note that the timecode in the first produced BlobEvent does not need to be zero. Syntax var timecode = BlobEvent.timecode Value A DOMHighResTimeStamp. Specifications Specification Status Comment MediaStream RecordingThe definition of 'timecode' in that specification. Working Draft Initial definition. Browser Compatibility The compatibility table on this page is generated from structured data. ...
Bluetooth.getDevices() - Web APIs
The getDevices() method of Bluetooth interface of Web Bluetooth API exposes the Bluetooth devices this origin is allowed to access. This method does not display any permission prompts. Note: This method returns a BluetoothDevice for each device the origin is currently allowed to access, even the ones that are out of range or powered off. The program can detect when a device comes online or into range by watching for BlueTooth advertisements by calling BluetoothDevice.watchAdvertisements() on that device. Syntax var readerPromise = Bluetooth.getDevices(); Parameters None. Return value A Promise that resolves with an array of BluetoothDevices. Exceptions This method doesn't throw any exceptions. Specifications Specification Status Comment Web BluetoothTh...
CSSImageValue - Web APIs
The CSSImageValue interface of the CSS Typed Object Model API represents values for properties that take an image, for example background-image, list-style-image, or border-image-source. The CSSImageValue object represents an <image> that involves an URL, such as url() or image(), but not linear-gradient() or element() . Properties None. Methods None. Examples We create an element <button>Magic Wand</button> We add some CSS, including a background image requesting a binary file: button { display: inline-block; min-height: 100px; min-width: 100px; background: no-repeat 5% center url(https://mdn.mozillademos.org/files/16793/magicwand.png) aqua; } We get the element's style map. We then get() the background-image from the stylemap and stringify it: // get the element c...
CSSKeywordValue.CSSKeywordValue() - Web APIs
The CSSKeywordValue constructor creates a new CSSKeywordValue object which represents CSS keywords and other identifiers. Syntax var cssKeywordValue = new CSSKeywordValue(val) Parameters value Sets or returns the value of the new CSSKeywordValue. Examples The following example resets the CSS display property to its defaults, setting the inline style attribute to style="display: initial" if viewed in the developer tools inspector. #myElement { display: flex; } <div id="myElement">Check the developer tools to see the log in the console and to inspect the style attribute on this div.</div> let keyword = new CSSKeywordValue('initial'); let myElement = document.getElementById('myElement').attributeStyleMap; myElement.set('display', keyword); console.log( myElement.get...
CSSKeywordValue - Web APIs
d anywhere a string is expected it will return the value of CSSKeyword.value. Constructor CSSKeywordValue.CSSKeywordValue() Creates a new CSSKeywordValue object. Properties CSSKeywordValue.value Returns or sets the value of the CSSKeywordValue. Methods Inherits methods from CSSStyleValue. Examples The following example resets the CSS display property to its defaults, setting the inline style attribute to style="display: initial" if viewed in the developer tools inspector. #myElement { display: flex; } <div id="myElement">Check the developer tools to see the log in the console and to inspect the style attribute on this div.</div> let myElement = document.getElementById('myElement').attributeStyleMap; myElement.set('display', new CSSKeywordValue('initial')); console.log...
CSSMathSum - Web APIs
.values[0].value ); // 30 console.log( styleMap.get('width').values[0].unit ); // 'percent' console.log( styleMap.get('width').values[1] ); // CSSUnitValue {value: -20, unit: "px"} console.log( styleMap.get('width').values[1].value ); // -20 console.log( styleMap.get('width').values[1].unit ); // 'px' The specification is still evolving. ...
CSSStyleDeclaration.cssText - Web APIs
To be able to set a stylesheet rule dynamically, see Using dynamic styling information. Not to be confused with stylesheet style-rule CSSRule.cssText. ...
CSSStyleDeclaration.setProperty() - Web APIs
ass="color">Text</button> </div> <div class="box"> <p>Box</p> </div> CSS html { background: orange; font-family: sans-serif; height: 100%; } body { height: inherit; width: 80%; min-width: 500px; max-width: 1000px; margin: 0 auto; } .controls { display: flex; justify-content: space-around; align-items: center; } div button { flex: 1; margin: 20px; height: 30px; line-height: 30px; } .box { display: flex; justify-content: center; align-items: center; height: calc(100% - 70px); } .box p { width: 50%; text-align: center; font-weight: bold; font-size: 40px; height: 150px; line-height: 150px; background: red; border: 5px solid purple; color: white; transition: all 1s; } JavaScript const borderBtn = document.querySelector('.border');...
CSSStyleDeclaration - Web APIs
Via the CSSStyleSheet API. ...
Managing screen orientation - Web APIs
les */ html, body { width : 100%; height: 100%; } body { border: 1px solid black; -moz-box-sizing: border-box; box-sizing: border-box; } p { font : 1em sans-serif; margin : 0; padding: .5em; } ul { list-style: none; font : 1em monospace; margin : 0; padding: .5em; -moz-box-sizing: border-box; box-sizing: border-box; background: black; } li { display: inline-block; margin : 0; padding: 0.5em; background: white; } Once we have some common styles we can start defining a special case for the orientation /* For portrait, we want the tool bar on top */ @media screen and (orientation: portrait) { #toolbar { width: 100%; } } /* For landscape, we want the tool bar stick on the left */ @media screen and (orientation: landscape) { #toolba...
CSS Object Model (CSSOM) - Web APIs
CSS Ty...
CanvasGradient.addColorStop() - Web APIs
position of the color stop. 0 represents the start of the gradient and 1 represents the end; an INDEX_SIZE_ERR is raised if the number is outside that range. color A CSS <color> value representing the color of the stop. A SYNTAX_ERR is raised if the value cannot be parsed as a CSS <color> value. Examples Adding stops to a gradient This example uses the addColorStop method to add stops to a linear CanvasGradient object. The gradient is then used to fill a rectangle. HTML <canvas id="canvas"></canvas> JavaScript const canvas = document.getElementById('canvas'); const ctx = canvas.getContext('2d'); let gradient = ctx.createLinearGradient(0, 0, 200, 0); gradient.addColorStop(0, 'green'); gradient.addColorStop(.7, 'white'); gradient.addColorStop(1, 'pink'); ctx.fillStyle = gradient; ct...
CanvasGradient - Web APIs
It can be used as a fillStyle or strokeStyle. Properties As an opaque object, there is no exposed property. Methods There is no inherited method. CanvasGradient.addColorStop() Adds a new stop, defined by an offset and a color, to the gradient. If the offset is not between 0 and 1, inclusive, an INDEX_SIZE_ERR is raised; if the color can't be parsed as a CSS <color>, a SYNTAX_ERR is raised. ...
CanvasPattern - Web APIs
interface represents an opaque object describing a pattern, based on an image, a canvas, or a video, created by the CanvasRenderingContext2D.createPattern() method. It can be used as a fillStyle or strokeStyle. Properties As an opaque object, this has no exposed property. Methods There are no inherited method. CanvasPattern.setTransform() Applies an SVGMatrix or DOMMatrix representing a linear transform to the pattern. Specifications Specification Status Comment HTML Living StandardThe definition of 'CanvasPattern' in that specification. Living Standard Added setTransform() method in v5. ...
CanvasRenderingContext2D.clearRect() - Web APIs
r in shape, with its top-left corner at (10, 10). The cleared area has a width of 120 and a height of 100. const canvas = document.getElementById('canvas'); const ctx = canvas.getContext('2d'); // Draw yellow background ctx.beginPath(); ctx.fillStyle = '#ff6'; ctx.fillRect(0, 0, canvas.width, canvas.height); // Draw blue triangle ctx.beginPath(); ctx.fillStyle = 'blue'; ctx.moveTo(20, 20); ctx.lineTo(180, 20); ctx.lineTo(130, 130); ctx.closePath(); ctx.fill(); // Clear part of the canvas ctx.clearRect(10, 10, 120, 100); Result Specifications Specification Status Comment HTML Living StandardThe definition of 'CanvasRenderingContext2D.clearRect' in that specification. Living Standard ...
CanvasRenderingContext2D.clip() - Web APIs
Only those parts of the checkerboard pattern that are within the clipping region get drawn. Note: Be aware that the clipping region is only constructed from shapes added to the path. It doesn't work with shape primitives drawn directly to the canvas, such as fillRect(). ...
CanvasRenderingContext2D.drawFocusIfNeeded() - Web APIs
ton2, 20, 80); if (ctx.isPointInPath(x, y)) { button2.focus(); } } function drawButton(el, x, y) { const active = document.activeElement === el; const width = 150; const height = 40; // Button background ctx.fillStyle = active ? 'pink' : 'lightgray'; ctx.fillRect(x, y, width, height); // Button text ctx.font = '15px sans-serif'; ctx.textAlign = 'center'; ctx.textBaseline = 'middle'; ctx.fillStyle = active ? 'blue' : 'black'; ctx.fillText(el.textContent, x + width / 2, y + height / 2); // Define clickable area ctx.beginPath(); ctx.rect(x, y, width, height); // Draw focus ring, if appropriate ctx.drawFocusIfNeeded(el); } Result Specifications Specification Status Comment HTML Living StandardThe definition of 'CanvasRend...
CanvasRenderingContext2D.ellipse() - Web APIs
ull ellipse, the arc begins at an angle of 0 radians (0?), and ends at an angle of 2? radians (360?). HTML <canvas id="canvas" width="200" height="200"></canvas> JavaScript const canvas = document.getElementById('canvas'); const ctx = canvas.getContext('2d'); // Draw the ellipse ctx.beginPath(); ctx.ellipse(100, 100, 50, 75, Math.PI / 4, 0, 2 * Math.PI); ctx.stroke(); // Draw the ellipse's line of reflection ctx.beginPath(); ctx.setLineDash([5, 5]); ctx.moveTo(0, 200); ctx.lineTo(200, 0); ctx.stroke(); Result Various elliptical arcs This example creates three elliptical paths with varying properties. HTML <canvas id="canvas"></canvas> JavaScript const canvas = document.getElementById('canvas'); const ctx = canvas.getContext('2d'); ctx.fillStyle = 'red'; ctx.beginPath(); ctx.
CanvasRenderingContext2D.fillStyle - Web APIs
he Canvas 2D API specifies the color, gradient, or pattern to use inside shapes. The default style is #000 (black). For more examples of fill and stroke styles, see Applying styles and color in the Canvas tutorial. Syntax ctx.fillStyle = color; ctx.fillStyle = gradient; ctx.fillStyle = pattern; Options color A DOMString parsed as CSS <color> value. gradient A CanvasGradient object (a linear or radial gradient). pattern A CanvasPattern object (a repeating image). Examples Changing the fill color of a shape This example applies a blue fill color to a rectangle. HTML <canvas id="canvas"></canvas> JavaScript const canvas = document.getElementById('canvas'); const ctx = canvas.getContext('2d'); ctx.fillStyle = 'blue'; ctx.fillRect(10, 10, 100, 100); Result Creating mul...
CanvasRenderingContext2D.fillText() - Web APIs
ows specifying a maximum width for the rendered text, which the user agent will achieve by condensing the text or by using a lower font size. This method draws directly to the canvas without modifying the current path, so any subsequent fill() or stroke() calls will have no effect on it. The text is rendered using the font and text layout configuration as defined by the font, textAlign, textBaseline, and direction properties. To draw the outlines of the characters in a string, call the context's strokeText() method. Syntax CanvasRenderingContext2D.fillText(text, x, y [, maxWidth]); Parameters text A DOMString specifying the text string to render into the context. The text is rendered using the settings specified by font, textAlign, textBaseline, and direction. x The x-axis coord...
CanvasRenderingContext2D.filter - Web APIs
to an SVG filter element, which may be embedded in an external XML file. blur() A CSS <length>. Applies a Gaussian blur to the drawing. It defines the value of the standard deviation to the Gaussian function, i.e., how many pixels on the screen blend into each other; thus, a larger value will create more blur. A value of 0 leaves the input unchanged. brightness() A CSS <percentage>. Applies a linear multiplier to the drawing, making it appear brighter or darker. A value under 100% darkens the image, while a value over 100% brightens it. A value of 0% will create an image that is completely black, while a value of 100% leaves the input unchanged. contrast() A CSS <percentage>. Adjusts the contrast of the drawing. A value of 0% will create a drawing that is completely black. A value of 100...
CanvasRenderingContext2D.isPointInStroke() - Web APIs
ample checks whether the cursor is in the stroke of an elliptical Path2D path. If yes, the ellipse's stroke becomes green, otherwise it is red. ...
CanvasRenderingContext2D.save() - Web APIs
e CanvasRenderingContext2D.save() method of the Canvas 2D API saves the entire state of the canvas by pushing the current state onto a stack. The drawing state The drawing state that gets saved onto a stack consists of: The current transformation matrix. The current clipping region. The current dash list. The current values of the following attributes: strokeStyle, fillStyle, globalAlpha, lineWidth, lineCap, lineJoin, miterLimit, lineDashOffset, shadowOffsetX, shadowOffsetY, shadowBlur, shadowColor, globalCompositeOperation, font, textAlign, textBaseline, direction, imageSmoothingEnabled. Syntax void ctx.save(); Examples Saving the drawing state This example uses the save() method to save the default state and restore() to restore it later, so that you are able to draw a rect wit...
A basic ray-caster - Web APIs
the camera position and/or orientation are updated, and the rays are cast out. As the rays intersect walls, then they render a vertical sliver of canvas in the color of the wall they've hit, blended with a darker version of the color according to the distance to the wall. The height of the sliver is also modulated by the distance from the camera to the wall, and is drawn centered over the horizon line. The code I ended up with is a regurgitated amalgam of the raycaster chapters from an old Andre LaMotheTricks of the Game Programming Gurus book (ISBN: 0672305070), and a java raycaster I found online, filtered through my compulsion to rename everything so it makes sense to me, and all the tinkering that had to be done to make things work well. Results The canvas in Safari 2.0.1 performed surp...
Basic usage of canvas - Web APIs
xt and draw on it. The <canvas> element has a method called getContext(), used to obtain the rendering context and its drawing functions. getContext() takes one parameter, the type of context. For 2D graphics, such as those covered by this tutorial, you specify "2d" to get a CanvasRenderingContext2D. var canvas = document.getElementById('tutorial'); var ctx = canvas.getContext('2d'); The first line in the script retrieves the node in the DOM representing the <canvas> element by calling the document.getElementById() method. Once you have the element node, you can access the drawing context using its getContext() method. Checking for support The fallback content is displayed in browsers which do not support <canvas>. Scripts can also check for support programmatically by simply testing for...
Finale - Web APIs
Web › API › Canvas API › Tutorial › Finale
ies. New technologies are constantly arriving to make it possible to develop better and more powerful games that can be run in any standards-compliant web browser. Other Web APIs These APIs might be useful when working further with canvas and graphics: WebGL Advanced API for rendering complex graphics, including 3D. SVG Scalable Vector Graphics let you describe images as sets of vectors (lines) and shapes in order to allow them to scale smoothly regardless of the size at which they're drawn. Web Audio The Web Audio API provides a powerful and versatile system for controlling audio on the Web, allowing developers to choose audio sources, add effects to audio, create audio visualizations, apply spatial effects (such as panning) and much more. Questions Stack Overflow Questions ...
Hit regions and accessibility - Web APIs
Fallback content The content inside the <canvas> ... ...
Optimizing canvas - Web APIs
)'; Turn off transparency If your application uses canvas and doesn't need a transparent backdrop, set the alpha option to false when creating a drawing context with HTMLCanvasElement.getContext(). This information can be used internally by the browser to optimize rendering. var ctx = canvas.getContext('2d', { alpha: false }); More tips Batch canvas calls together. For example, draw a polyline instead of multiple separate lines. Avoid unnecessary canvas state changes. Render screen differences only, not the whole new state. Avoid the shadowBlur property whenever possible. Avoid text rendering whenever possible. Try different ways to clear the canvas (clearRect() vs. fillRect() vs. resizing the canvas). With animations, use window.requestAnimationFrame() instead of window.setInter...
Transformations - Web APIs
. restore() Restores the most recently saved canvas state. Canvas states are stored on a stack. Every time the save() method is called, the current drawing state is pushed onto the stack. A drawing state consists of The transformations that have been applied (i.e. translate, rotate and scale - see below). The current values of the following attributes: strokeStyle, fillStyle, globalAlpha, lineWidth, lineCap, lineJoin, miterLimit, lineDashOffset, shadowOffsetX, shadowOffsetY, shadowBlur, shadowColor, globalCompositeOperation, font, textAlign, textBaseline, direction, imageSmoothingEnabled. The current clipping path, which we'll see in the next section. You can call the save() method as many times as you like. Each time the restore() method is called, the last saved state is popped of...
Using channel messaging - Web APIs
ML = e.data; input.value = ''; } We start off by creating a new message channel by using the MessageChannel() constructor. When the IFrame has loaded, we register an onclick handler for our button and an onmessage handler for MessageChannel.port1. Finally we transfer MessageChannel.port2 to the IFrame using the window.postMessage method. Let's explore how the iframe.contentWindow.postMessage line works in a bit more detail. It takes three arguments: The message being sent. For this initial port transfering this message could be an empty string but in this example it is set to 'init'. The origin the message is to be sent to. * means "any origin". An object, the ownership of which is transferred to the receiving browsing context. In this case, we are transferring MessageChannel.port2 t...
Console.group() - Web APIs
Web › API › Console › group
This indents following console messages by an additional level, until console.groupEnd() is called. Note: This feature is available in Web Workers. Syntax console.group([label]); Parameters label Label for the group. Optional. (Chrome 59 tested) Does not work with console.groupEnd(). Using groups in the console Requires Gecko 9.0(Firefox 9.0 / Thunderbird 9.0 / SeaMonkey 2.6) You can use nested groups to help organize your output by visually associating related messages. To create a new nested block, call console.group(). The console.groupCollapsed() method is similar, but the new block is collapsed and requires clicking a disclosure button to read it. ...
Console.groupCollapsed() - Web APIs
Unlike console.group(), however, the new group is created collapsed. The user will need to use the disclosure button next to it to expand it, revealing the entries created in the group. Call console.groupEnd() to back out to the parent group. See Using groups in the console in the console documentation for details and examples. Note: This feature is available in Web Workers. Syntax console.groupCollapsed([label]); Parameters label Label for the group. Optional. Specifications Specification Status Comment Console APIThe definition of 'console.groupCollapsed()' in that specification. ...
Console.groupEnd() - Web APIs
Web › API › Console › groupEnd
See Using groups in the console in the console documentation for details and examples. Note: This feature is available in Web Workers. Syntax console.groupEnd(); Parameters None. Specifications Specification Status Comment Console APIThe definition of 'console.groupEnd()' in that specification. ...
Console.timeStamp() - Web APIs
Web › API › Console › timeStamp
Adds a single marker to the browser's Performance or Waterfall tool. This lets you correlate a point in your code with the other events recorded in the timeline, such as layout and paint events. You can optionally supply an argument to label the timestamp, and this label will then be shown alongside the marker. Note: This feature is available in Web Workers. Syntax console.timeStamp(label); Parameters label Label for the timestamp. Optional. ...
ContentIndex.getAll() - Web APIs
orker.ready; // get our index entries const entries = await registration.index.getAll(); // create a containing element const readingListElem = document.createElement('div'); // test for entries if (!Array.length) { // if there are no entries, display a message const message = document.createElement('p'); message.innerText = 'You currently have no articles saved for offline reading.' readingListElem.append(message); } else { // if entries are present, display in a list of links to the content const listElem = document.createElement('ul'); for (const entry of entries) { const listItem = document.createElement('li'); const anchorElem = document.createElement('a'); anchorElem.innerText = entry.title; anchorElem.setAttribut...
ConvolverNode - Web APIs
Number of inputs 1 Number of outputs 1 Channel count mode "clamped-max" Channel count 1, 2, or 4 Channel interpretation "speakers" Constructor ConvolverNode() Creates a new ConvolverNode object instance. Properties Inherits properties from its parent, AudioNode. ...
CustomElementRegistry.define() - Web APIs
g); // Create some CSS to apply to the shadow dom var style = document.createElement('style'); style.textContent = '.wrapper {' + 'position: relative;' + '}' + '.info {' + 'font-size: 0.8rem;' + 'width: 200px;' + 'display: inline-block;' + 'border: 1px solid black;' + 'padding: 10px;' + 'background: white;' + 'border-radius: 10px;' + 'opacity: 0;' + 'transition: 0.6s all;' + 'position: absolute;' + 'bo...
DOMHighResTimeStamp - Web APIs
dow and Worker contexts. Example To determine how much time has elapsed since a particular point in your code, you can do something like this: let startTime = performance.now(); /* ... do things for a while ... */ let elapsedTime = performance.now() - startTime; Upon completion, the value of elapsedTime is the number of milliseconds that have elapsed since you recorded the starting time in line 1. Specifications Specification Status Comment High Resolution Time Level 2The definition of 'DOMHighResTimeStamp' in that specification. Recommendation Stricter definitions of interfaces and types. High Resolution TimeThe definition of 'DOMHighResTimeStamp' in that specification. Recommendation Initial definition. Browser compatibility ...
DOMLocator - Web APIs
DOMLocator.columnNumber Read only Returns a positive integer or -1. DOMLocator.byteOffset Read only Returns a positive integer or -1. DOMLocator.utf16Offset Read only Returns a positive integer or -1. DOMLocator.relatedNode Read only Returns a positive integer or -1. DOMLocator.uri Read only Returns a positive integer or -1. Methods This interface neither implements, nor inherits, any method. ...
DOMPoint.fromPoint() - Web APIs
ctive values are identical to those in the source point. The point's properties are mutable and may be changed at any time. Examples Creating a mutable point from a read-only point If you have a DOMPointReadOnly object, you can easily create a mutable copy of that point: var mutablePoint = DOMPoint.fromPoint(readOnlyPoint); Creating a 2D point This sample creates a 2D point, specifying an inline object that includes the values to use for x and y. The z and w properties are allowed to keep their default values (0 and 1 respectively). var center = DOMPoint.fromPoint({x: 75, y: -50, z: -55, w: 0.25}); Specifications Specification Status Comment Geometry Interfaces Module Level 1The definition of 'fromPoint()' in that specification. Candidate Recommendation I...
DOMPointReadOnly.fromPoint() - Web APIs
tax const point = DOMPointReadOnly.fromPoint(sourcePoint) Properties sourcePoint A DOMPointInit-compliant object, which includes both DOMPoint and DOMPointReadOnly, from which to take the values of the new point's properties. Return value A new DOMPointReadOnly object (which is identical to the source point). Examples Creating a 2D point This sample creates a 2D point, specifying an inline object that includes the values to use for x and y. The z and w properties are allowed to keep their default values (0 and 1 respectively). const point2D = DOMPointReadOnly.fromPoint({x: 25, y: 25}) Creating a 3D point using an existing point This example creates a point, origPoint, of type DOMPoint, using new DOMPoint(). That point is then used as the input for fromPoint() to create a new poi...
DOMRect.DOMRect() - Web APIs
Web › API › DOMRect › DOMRect
The DOMRect() constructor creates a new DOMRect object. Syntax var myDOMRect = new DOMRect(x, y, width, height); Parameters x The x coordinate of the DOMRect's origin. y The y coordinate of the DOMRect's origin. width The width of the DOMRect. height The height of the DOMRect. Examples To create a new DOMRect, you could run a line of code like so: myDOMRect = new DOMRect(0,0,100,100); // running 'myDOMRect' in the console would then return // DOMRect { x: 0, y: 0, width: 100, height: 100, top: 0, right: 100, bottom: 100, left: 0 } Specifications Specification Status Comment Geometry Interfaces Module Level 1The definition of 'DOMRect()' in that specification. Candidate Recommendation Initial definition. ...
DOMRectReadOnly() - Web APIs
tReadOnly() constructor creates a new DOMRectReadOnly object. Syntax const myDOMRectReadOnly = new DOMRectReadOnly(x, y, width, height) Parameters x The x coordinate of the DOMRectReadOnly's origin. y The y coordinate of the DOMRectReadOnly's origin. width The width of the DOMRectReadOnly. height The height of the DOMRectReadOnly. Examples To create a new DOMPoint, you could run a line of code like so: const myDOMRect = new DOMRectReadOnly(0, 0, 100, 100) // running 'myDOMRect' in the console would then return // DOMRect { x: 0, y: 0, width: 100, height: 100, top: 0, right: 100, bottom: 100, left: 0 } Specifications Specification Status Comment Geometry Interfaces Module Level 1The definition of 'DOMRectReadOnly()' in that specification. Candi...
DataTransfer.clearData() - Web APIs
Data() and clearData() methods. HTML <span class="tweaked" id="source" draggable="true"> Select this element, drag it to the Drop Zone and then release the selection to move the element. ...
DataTransferItem.getAsString() - Web APIs
rs callback A callback function that has access to the data transfer item's string data. See Callback below for details. Return value undefined Callback The callback parameter is a callback function which accepts one parameter: DOMString The drag data item's string data. The callback return value is undefined. Example This example shows the use of the getAsString() method as an inline function in a drop event handler. function drop_handler(ev) { console.log("Drop"); ev.preventDefault(); var data = ev.dataTransfer.items; for (var i = 0; i < data.length; i += 1) { if ((data[i].kind == 'string') && (data[i].type.match('^text/plain'))) { // This item is the target node data[i].getAsString(function (s){ ev.target.appendChild(document.getElementById(s...
DelayNode - Web APIs
Web › API › DelayNode
A DelayNode always has exactly one input and one output, both with the same amount of channels. When creating a graph that has a cycle, it is mandatory to have at least one DelayNode in the cycle, or the nodes taking part in the cycle will be muted. Number of inputs 1 Number of outputs 1 Channel count mode "max" Channel count 2 (not used in the default count mode) Channel interpretation "speakers" Constructor DelayNode() Creates a new instance of an DelayNode object instance. ...
DeprecationReportBody - Web APIs
aining a human-readable description of the deprecation, including information such as what newer feature has superceded it, if any. This typically matches the message a browser will display in its DevTools console when a deprecated feature is used, if one is available. sourceFile A string containing the path to the source file where the deprecated feature was used, if known, or null otherwise. lineNumber A number representing the line in the source file in which the deprecated feature was used, if known, or null otherwise. columnNumber A number representing the column in the source file in which the deprecated feature was used, if known, or null otherwise. Examples In our deprecation_report.html example, we create a simple reporting observer to observe usage of deprecated features on ...
DeviceMotionEvent.rotationRate - Web APIs
grees per second. Note: If the hardware isn't capable of providing this information, this property returns null. Syntax var rotationRate = deviceMotionEvent.rotationRate; Value The rotationRate property is a read only object describing the rotation rates of the device around each of its axes: alpha The rate at which the device is rotating about its Z axis; that is, being twisted about a line perpendicular to the screen. beta The rate at which the device is rotating about its X axis; that is, front to back. gamma The rate at which the device is rotating about its Y axis; that is, side to side. Specifications Specification Status Comment DeviceOrientation Event Specification Editor's Draft Initial definition. ...
Document.caretRangeFromPoint() - Web APIs
ecified coordinates. Syntax var range = document.caretRangeFromPoint(float x, float y); Parameters x A horizontal position within the current viewport. y A vertical position within the current viewport. Returns One of the following: A Range. Null, if x or y are negative, outside viewport, or there is no text entry node. Example Basic demo: When clicking in a paragraph insert a line break at the caret position: HTML <p>Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.</p> JavaScript function insertBreakAtPoint(e) { let range; ...
Document.characterSet - Web APIs
urns the character encoding of the document that it's currently rendered with. (A character encoding is a set of characters and how to interpret bytes into those characters.) A "character set" and a "character encoding" are related, but different. Despite the name of this property, it returns the encoding. Users can override the developer-specified encoding inside the Content-Type header or inline like <meta charset="utf-8">, such as with Firefox's View -> Text Encoding menu. This override is provided to fix incorrect developer-specified encodings that result in garbled text. The properties document.charset and document.inputEncoding are legacy aliases for document.characterSet. Do not use them any more. Syntax var string = document.characterSet; Examples <button onclick="console.lo...
Document.cookie - Web APIs
Web › API › Document › cookie
reated as if the quotes were part of the string, instead of as if they were delimiters surrounding the actual path string. This has been fixed. ;domain=domain (e.g., 'example.com' or 'subdomain.example.com'). If not specified, this defaults to the host portion of the current document location. Contrary to earlier specifications, leading dots in domain names are ignored, but browsers may decline to set the cookie containing such dots. If a domain is specified, subdomains are always included. Note: The domain must match the domain of the JavaScript origin. Setting cookies to foreign domains will be silently ignored. ;max-age=max-age-in-seconds (e.g., 60*60*24*365 or 31536000 for a year) ;expires=date-in-GMTString-format If neither expires nor max-age specified it will expire...
Document.createElement() - Web APIs
t class ExpandingList extends HTMLUListElement { constructor() { // Always call super first in constructor super(); // constructor definition left out for brevity ... } } // Define the new element customElements.define('expanding-list', ExpandingList, { extends: "ul" }); If we wanted to create an instance of this element programmatically, we'd use a call along the following lines: let expandingList = document.createElement('ul', { is : 'expanding-list' }) The new element will be given an is attribute whose value is the custom element's tag name. Note: For backwards compatibility with previous versions of the Custom Elements specification, some browsers will allow you to pass a string here instead of an object, where the string's value is the custom element's tag name...
Document.createElementNS() - Web APIs
This particular example is actually an XUL document with embedded XHTML, however, the recommendation still applies. Specifications Specification Status Comment DOMThe definition of 'Document.createElementNS()' in that specification. Living Standard ...
Document.createTextNode() - Web APIs
Living Standard ...
Document.links - Web APIs
Web › API › Document › links
The links read-only property of the Document interface returns a collection of all <area> elements and <a> elements in a document with a value for the href attribute. Syntax nodeList = document.links Value An HTMLCollection. Example var links = document.links; for(var i = 0; i < links.length; i++) { var linkHref = document.createTextNode(links[i].href); var lineBreak = document.createElement("br"); document.body.appendChild(linkHref); document.body.appendChild(lineBreak); } Specifications Specification Status Comment HTML Living StandardThe definition of 'Document.links' in that specification. Living Standard Document Object Model (DOM) Level 2 HTML SpecificationThe definition of 'document.links' in that specification. Obsolete ...
Document.write() - Web APIs
Web › API › Document › write
otes The text you write is parsed into the document's structure model. In the example above, the h1 element becomes a node in the document. Writing to a document that has already loaded without calling document.open() will automatically call document.open(). After writing, call document.close() to tell the browser to finish loading the page. If the document.write() call is embedded within an inline HTML <script> tag, then it will not call document.open(). For example: <script> document.write("<h1>Main title</h1>") </script> Note: document.write() and document.writeln do not work in XHTML documents (you'll get an "Operation is not supported" [NS_ERROR_DOM_NOT_SUPPORTED_ERR] error in the error console). This happens when opening a local file with the .xhtml file extension or for any docu...
Document.writeln() - Web APIs
Web › API › Document › writeln
Note: document.writeln (like document.write) does not work in XHTML documents (you'll get a "Operation is not supported" (NS_ERROR_DOM_NOT_SUPPORTED_ERR) error on the error console). This is the case if opening a local file with a .xhtml file extension or for any document served with an application/xhtml+xml MIME type. More information is available in the W3C XHTML FAQ. ...
DocumentOrShadowRoot.caretPositionFromPoint() - Web APIs
e DocumentOrShadowRoot interface returns a CaretPosition object, containing the DOM node, along with the caret and caret's character offset within that node. Syntax var caretPosition = document.caretPositionFromPoint(float x, float y); Parameters x The horizontal coordinate of a point. y The vertical coordinate of a point. Returns A CaretPosition object. Example This example inserts line breaks wherever you click. The code for it is below the demo. Demo HTML Content <p>Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.</p> JavaScript...
Introduction to the DOM - Web APIs
't have to do anything special to begin using the DOM. Different browsers have different implementations of the DOM, and these implementations exhibit varying degrees of conformance to the actual DOM standard (a subject we try to avoid in this documentation), but every web browser uses some document object model to make web pages accessible via JavaScript. When you create a script-whether it's inline in a <script> element or included in the web page by means of a script loading instruction-you can immediately begin using the API for the document or window elements to manipulate the document itself or to get at the children of that document, which are the various elements in the web page. Your DOM programming may be something as simple as the following, which displays an alert message by using...
EXT_disjoint_timer_query - Web APIs
WebGL extensions are available using the WebGLRenderingContext.getExtension() method. For more information, see also Using Extensions in the WebGL tutorial. Availability: This extension should be available in WebGL1 contexts only. EXT_disjoint_timer_query_webgl2 is available in WebGL 2 contexts . In WebGL 2, the getQueryObject was renamed to getQueryParameter. ...
EXT_sRGB - Web APIs
Web › API › EXT sRGB
ge2D(), texSubImage2D(), renderbufferStorage() and getFramebufferAttachmentParameter() methods. ext.SRGB_EXT Unsized sRGB format that leaves the precision up to the driver. ext.SRGB_ALPHA_EXT Unsized sRGB format with unsized alpha component. ext.SRGB8_ALPHA8_EXT Sized (8-bit) sRGB and alpha formats. ext.FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT Returns the framebuffer color encoding (gl.LINEAR or ext.SRGB_EXT). Examples var ext = gl.getExtension('EXT_sRGB'); var texture = gl.createTexture(); gl.bindTexture(gl.TEXTURE_2D, texture); gl.texImage2D(gl.TEXTURE_2D, 0, ext.SRGB_EXT, 512, 512, 0, ext.SRGB_EXT, gl.UNSIGNED_BYTE, image); Specifications Specification Status Comment EXT_sRGBThe definition of 'EXT_sRGB' in that specification. Recom...
EffectTiming.direction - Web APIs
The value of direction corresponds directly to AnimationEffectTimingReadOnly.direction in timing objects returned by AnimationEffectReadOnly, KeyframeEffectReadOnly, and KeyframeEffect. ...
EffectTiming.easing - Web APIs
roperties = { easing: single-transition-timing-function } timingProperties.easing = single-transition-timing-function Value A string defining the timing function to use for easing transitions during the animation process. Accepts several pre-defined DOMString values, a steps() timing function like steps(5, end), or a custom cubic-bezier value like cubic-bezier(0.42, 0, 0.58, 1). Defaults to linear. Available values include: linear A constant rate of change, neither accelerating nor deccelerating. cubic-bezier(<number>, <number>, <number>, <number>) Specifies a cubic Bezier timing function. The four numbers specify points P1 and P2 of the curve as (x1, y1, x2, y2). Both x values must be in the range [0, 1] or the definition is invalid. ease A decelerated rate of change, going f...
EffectTiming.fill - Web APIs
Web › API › EffectTiming › fill
When used to persist the effect of an animation indefinitely, however, they have a number of drawbacks: The forwards fill of an animation (or backwards fill if the animation is playing in reverse) will continue to override any changes to specified styl...
EffectTiming - Web APIs
nd switches direction after each iteration (alternate-reverse). Defaults to "normal". duration Optional The number of milliseconds each iteration of the animation takes to complete. Defaults to 0. Although this is technically optional, keep in mind that your animation will not run if this value is 0. easing Optional The rate of the animation's change over time. Accepts the pre-defined values "linear", "ease", "ease-in", "ease-out", and "ease-in-out", or a custom "cubic-bezier" value like "cubic-bezier(0.42, 0, 0.58, 1)". Defaults to "linear". endDelay Optional The number of milliseconds to delay after the end of an animation. This is primarily of use when sequencing animations based on the end time of another animation. Defaults to 0. fill Optional Dictates whether the animation's eff...
Element.animate() - Web APIs
Web › API › Element › animate
nd switches direction after each iteration (alternate-reverse). Defaults to "normal". duration Optional The number of milliseconds each iteration of the animation takes to complete. Defaults to 0. Although this is technically optional, keep in mind that your animation will not run if this value is 0. easing Optional The rate of the animation's change over time. Accepts the pre-defined values "linear", "ease", "ease-in", "ease-out", and "ease-in-out", or a custom "cubic-bezier" value like "cubic-bezier(0.42, 0, 0.58, 1)". Defaults to "linear". endDelay Optional The number of milliseconds to delay after the end of an animation. This is primarily of use when sequencing animations based on the end time of another animation. Defaults to 0. fill Optional Dictates whether the animation's eff...
Element.clientHeight - Web APIs
It includes padding but excludes borders, margins, and horizontal scrollbars (if present). clientHeight can be calculated as: CSS height + CSS padding - height of horizontal scrollbar (if present). When clientHeight is used on the root element (the <html> element), (or on <body> if the document is in quirks mode), the viewport's height (excluding any scrollbar) is returned. This is a special case of clientHeight. Note: This property will round the value to an integer. If you need a fractional value, use element.getBoundingClientRect(). ...
Element.clientLeft - Web APIs
clientLeft is read-only. When layout.scrollbar.side preference is set to 1 or to 3 and when the text-direction is set to RTL, then the vertical scrollbar is positioned on the left and this impacts the way clientLeft is computed. Note: This property will round the value to an integer. If you need a fractional value, use element.getBoundingClientRect(). Note: When an element has display: inline, clientLeft returns 0 regardless of the element's border. Syntax var left = element.clientLeft; Example padding-top Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit i...
Element.clientWidth - Web APIs
It includes padding but excludes borders, margins, and vertical scrollbars (if present). When clientWidth is used on the root element (the <html> element), (or on <body> if the document is in quirks mode), the viewport's width (excluding any scrollbar) is returned. This is a special case of clientWidth. Note: This property will round the value to an integer. If you need a fractional value, use element.getBoundingClientRect(). Syntax var intElemClientWidth = element.clientWidth; intElemClientWidth is an integer corresponding to the clientWidth of element in pixels. ...
Element: dblclick event - Web APIs
ndblclick Examples This example toggles the size of a card when you double click on it. JavaScript const card = document.querySelector('aside'); card.addEventListener('dblclick', function (e) { card.classList.toggle('large'); }); HTML <aside> <h3>My Card</h3> <p>Double click to resize this object.</p> </aside> CSS aside { background: #fe9; border-radius: 1em; display: inline-block; padding: 1em; transform: scale(.9); transform-origin: 0 0; transition: transform .6s; } .large { transform: scale(1.3); } Result Specifications Specification Status UI EventsThe definition of 'dblclick' in that specification. Working Draft Document Object Model (DOM) Level 3 Events SpecificationThe definition of 'dblclick' in that specificat...
Element.getElementsByTagName() - Web APIs
updates itself with the DOM tree automatically. Therefore, there is no need to call Element.getElementsByTagName() with the same element and arguments repeatedly if the DOM changes in between calls. When called on an HTML element in an HTML document, getElementsByTagName lower-cases the argument before searching for it. This is undesirable when trying to match camel-cased SVG elements (such as <linearGradient>) in an HTML document. Instead, use Element.getElementsByTagNameNS(), which preserves the capitalization of the tag name. Element.getElementsByTagName is similar to Document.getElementsByTagName(), except that it only searches for elements that are descendants of the specified element. Syntax elements = element.getElementsByTagName(tagName) elements is a live HTMLCollection of ele...
Element.scrollHeight - Web APIs
congue turpis eleifend. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Cras vulputate libero sed arcu iaculis nec lobortis orci fermentum. ...
Event - Web APIs
Web › API › Event
ClipboardEvent CloseEvent CompositionEvent CSSFontFaceLoadEvent CustomEvent DeviceLightEvent DeviceMotionEvent DeviceOrientationEvent DeviceProximityEvent DOMTransactionEvent DragEvent EditingBeforeInputEvent ErrorEvent FetchEvent FocusEvent GamepadEvent HashChangeEvent IDBVersionChangeEvent InputEvent KeyboardEvent MediaStreamEvent MessageEvent MouseEvent MutationEvent OfflineAudioCompletionEvent OverconstrainedError PageTransitionEvent PaymentRequestUpdateEvent PointerEvent PopStateEvent ProgressEvent RelatedEvent RTCDataChannelEvent RTCIdentityErrorEvent RTCIdentityEvent RTCPeerConnectionIceEvent SensorEvent StorageEvent SVGEvent SVGZoomEvent TimeEvent TouchEvent TrackEvent TransitionEvent UIEvent UserProximityEvent WebGLContextEvent WheelEvent...
FetchEvent.respondWith() - Web APIs
stylesheet is intercepted, then the final URL is used as the base URL for resolving relative @import loads. Note that navigation requests for Windows and iframes do NOT use the final URL. The way the HTML specification handles redirects for navigations ends up using the request URL for the resulting Window.location. This means sites can still provide an "alternate" view of a web page when offline without changing the user-visible URL. Syntax fetchEvent.respondWith( // Promise that resolves to a Response. ); Parameters A Response or a Promise that resolves to a Response. Otherwise, a network error is returned to Fetch. Return value undefined. Exceptions Exception Notes NetworkError A network error is triggered on certain combinations of FetchEvent.requ...
Cross-global fetch usage - Web APIs
to fetch needs to be relative The problem In the past we would resolve the relative URL against the current global, for example: let absolute = new URL(relative, window.location.href) This is not a problem as such. It is just that different APIs that exhibit this kind of behavior were doing it inconsistently with the behavior defined in the spec, which could lead to problems further down the line. The solution In Firefox 60 onwards, Mozilla resolves the relative URL against the global that owns the fetch() function being used (see bug 1432272). So in the case described above, it is resolved against the iframe's location: let absolute = new URL(relative, frame.contentWindow.location.href) There is a lot of discussion in progress about getting new specs to align with this behavior chang...
FileError - Web APIs
Web › API › FileError
ally due to permission problems that occur after a reference to a file has been acquired (for example, the file or directory is concurrently locked by another application). PATH_EXISTS_ERR 12 The file or directory with the same path already exists. QUOTA_EXCEEDED_ERR 10 Either there's not enough remaining storage space or the storage quota was reached and the user declined to give more space to the database. To ask for more storage, see Managing HTML5 Offline Storage. SECURITY_ERR 2 Access to the files were denied for one of the following reasons: The files might be unsafe for access within a Web application. Too many calls are being made on file resources. Other unspecified security error code or situations. ...
FileException - Web APIs
to permission problems that occur after a reference to a file has been acquired (for example, the file or directory is concurrently locked by another application). PATH_EXISTS_ERR 12 The file or directory with the same path already exists. QUOTA_EXCEEDED_ERR 10 Either there's not enough remaining storage space or the storage quota was reached and the user declined to give more space to the database. SECURITY_ERR 2 Access to the files were denied for one of the following reasons: The files might be unsafe for access within a Web application. Too many calls are being made on file resources. Other unspecified security error code or situations. TYPE_MISMATCH_ERR 11 The user has attempted to ...
FileList - Web APIs
Web › API › FileList
ld contain only one file. Starting with Gecko 1.9.2, if the input element's multiple attribute is true, the FileList may contain multiple files. Using the file list All <input> element nodes have a files attribute of type FileList on them which allows access to the items in this list. For example, if the HTML includes the following file input: <input id="fileItem" type="file"> The following line of code fetches the first file in the node's file list as a File object: var file = document.getElementById('fileItem').files[0]; Method overview File item(index); Properties Attribute Type Description length integer A read-only value indicating the number of files in the list. Methods item() Returns a File object representing the file a...
FontFace.display - Web APIs
Web › API › FontFace › display
The lengths of the first two periods depend on the value of the property and the user agent. (See below.) block period The browser invisibly prepares a fallback font. ...
FormData() - Web APIs
Web › API › FormData › FormData
Note: This feature is available in Web Workers. Syntax var formData = new FormData(form) Parameters form Optional An HTML <form> element -- when specified, the FormData object will be populated with the form's current keys/values using the name property of each element for the keys and their submitted value for the values. It will also encode file input content. ...
FormData.append() - Web APIs
Web › API › FormData › append
Blob or File is passed as the second parameter. The default filename for Blob objects is "blob". The default filename for File objects is the file's filename. Note: If you specify a Blob as the data to append to the FormData object, the filename that will be reported to the server in the "Content-Disposition" header used to vary from browser to browser. Returns Void. Example The following line creates an empty FormData object: var formData = new FormData(); // Currently empty You can add key/value pairs to this using FormData.append: formData.append('username', 'Chris'); formData.append('userpic', myFileInput.files[0], 'chris.jpg'); As with regular form data, you can append multiple values with the same name. For example (and being compatible with PHP's naming conventions by adding...
FormData.delete() - Web APIs
Web › API › FormData › delete
The delete() method of the FormData interface deletes a key and its value(s) from a FormData object. Note: This method is available in Web Workers. Syntax formData.delete(name); Parameters name The name of the key you want to delete. Returns Void. Example The following line creates an empty FormData object and prepopulates it with key/value pairs from a form: var formData = new FormData(myForm); You can delete keys and their values using delete(): formData.delete('username'); Specifications Specification Status Comment XMLHttpRequestThe definition of 'delete()' in that specification. Living Standard ...
FormData.get() - Web APIs
Web › API › FormData › get
mData object. If you expect multiple values and want all of them, use the getAll() method instead. Note: This method is available in Web Workers. Syntax formData.get(name); Parameters name A USVString representing the name of the key you want to retrieve. Return value A FormDataEntryValue containing the value. If the key doesn't exist, the method returns null. ...
FormData.getAll() - Web APIs
Web › API › FormData › getAll
h a given key from within a FormData object. Note: This method is available in Web Workers. Syntax formData.getAll(name); Parameters name A USVString representing the name of the key you want to retrieve. Returns An array of FormDataEntryValues whose key matches the value passed in the name parameter. If the key doesn't exist, the method returns an empty list. ...
FormData.has() - Web APIs
Web › API › FormData › has
The has() method of the FormData interface returns a boolean stating whether a FormData object contains a certain key. Note: This method is available in Web Workers. Syntax formData.has(name); Parameters name A USVString representing the name of the key you want to test for. Returns A Boolean. ...
FormData.set() - Web APIs
Web › API › FormData › set
String), when a Blob or File is passed as the second parameter. The default filename for Blob objects is "blob". The default filename for File objects is the file's filename. Note: If you specify a Blob as the data to append to the FormData object, the filename that will be reported to the server in the "Content-Disposition" header used to vary from browser to browser. ...
Fullscreen API - Web APIs
See the article Guide to the Fullscreen API for details on how to use the API. ...
GlobalEventHandlers.oncontextmenu - Web APIs
ation This example pauses a spinning shape whenever you open the context menu. ...
HTMLElement.offsetHeight - Web APIs
ad-only property returns the height of an element, including vertical padding and borders, as an integer. Typically, offsetHeight is a measurement in pixels of the element's CSS height, including any borders, padding, and horizontal scrollbars (if rendered). It does not include the height of pseudo-elements such as ::before or ::after. For the document body object, the measurement includes total linear content height instead of the element's CSS height. Floated elements extending below other linear content are ignored. If the element is hidden (for example, by setting style.display on the element or one of its ancestors to "none"), then 0 is returned. This property will round the value to an integer. If you need a fractional value, use element.getBoundingClientRect(). Syntax var intElem...
HTMLElement.offsetLeft - Web APIs
The HTMLElement.offsetLeft read-only property returns the number of pixels that the upper left corner of the current element is offset to the left within the HTMLElement.offsetParent node. For block-level elements, offsetTop, offsetLeft, offsetWidth, and offsetHeight describe the border box of an element relative to the offsetParent. However, for inline-level elements (such as span) that can wrap from one line to the next, offsetTop and offsetLeft describe the positions of the first border box (use Element.getClientRects() to get its width and height), while offsetWidth and offsetHeight describe the dimensions of the bounding border box (use Element.getBoundingClientRect() to get its position). Therefore, a box with the left, top, width and height of offsetLeft, offsetTop, offsetWidth and o...
HTMLFrameSetElement - Web APIs
ventHandlers.onhashchange Is an EventHandler representing the code to be called when the hashchange event is raised. WindowEventHandlers.onlanguagechange Is an EventHandler representing the code to be called when the languagechange event is raised. WindowEventHandlers.onmessage Is an EventHandler representing the code to be called when the message event is raised. WindowEventHandlers.onoffline Is an EventHandler representing the code to be called when the offline event is raised. WindowEventHandlers.ononline Is an EventHandler representing the code to be called when the online event is raised. WindowEventHandlers.onpagehide Is an EventHandler representing the code to be called when the pagehide event is raised. WindowEventHandlers.onpageshow Is an EventHandler representing the c...
contentDocument - Web APIs
Example of contentDocument var iframeDocument = document.getElementsByTagName("iframe")[0].contentDocument; iframeDocument.body.style.backgroundColor = "blue"; // This would turn the iframe blue. ...
HTMLImageElement.border - Web APIs
border should be drawn. You should not use this property! Instead, you should use CSS to style the border. The border property or its longhand properties to not only set the thickness of the border but to potentially apply a wide variety of other styling options to it. The width, specifically, is controlled using the writing-mode aware border-block-start-width, border-block-end-width, border-inline-start-width, and border-inline-end-width properties. For compatibility (or perhaps other) reasons, you can use the older properties instead (or in addition): border-top-width, border-right-width, border-bottom-width, and border-left-width. Syntax htmlImageElement.border = thickness; let thickness = htmlImageElement.border; Value A DOMString containing an integer value specifying the thickne...
HTMLImageElement.decode() - Web APIs
using a delay while the image loads. Syntax var promise = HTMLImageElement.decode(); Parameters None. Return value A Promise which is resolved once the image data is ready to be used. Exceptions EncodingError A DOMException indicating that an error occurred while decoding the image. Usage notes One potential use case for decode(): when loading very large images (for example, in an online photo album), you can present a low resolution thumbnail image initially and then replace that image with the full-resolution image by instantiating a new HTMLImageElement, setting its source to the full-resolution image's URL, then using decode() to get a promise which is resolved once the full-resolution image is ready for use. At that time, you can then replace the low-resolution image with th...
HTMLMediaElement.controlsList - Web APIs
lect what controls to show on the media element whenever the user agent shows its own set of controls. The DOMTokenList takes one or more of three possible values: nodownload, nofullscreen, and noremoteplayback. Syntax var domTokenList = HTMLMediaElement.controlsList; Value A DOMTokenList. Specifications Specification Status Comment Controls List API: Solution outline Browser Compatibility The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. DesktopMobileChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internetco...
HTMLMediaElement.currentTime - Web APIs
e position within the media at which playback will begin once the play() method is called. Setting currentTime to a new value seeks the media to the given time, if the media is available. For media without a known duration--such as media being streamed live--it's possible that the browser may not be able to obtain parts of the media that have expired from the media buffer. Also, media whose timeline doesn't begin at 0 seconds cannot be seeked to a time before its timeline's earliest time. The length of the media in seconds can be determined using the duration property. Example var video = document.createElement('video'); console.log(video.currentTime); Usage notes Reduced time precision To offer protection against timing attacks and fingerprinting, browsers may round or otherwise adju...
msClearEffects - Web APIs
a standards track. Do not use it on production sites facing the Web: it will not work for every user. There may also be large incompatibilities between implementations and the behavior may change in the future. The msClearEffects method of the HTMLMediaElement, is a proprietary method specific to Internet Explorer and Microsoft Edge. msClearEffects clears all effects from the media pipeline. Syntax HTMLMediaElement.msClearEffects(); Parameters This method has no parameters. Return value This method does not return a value. See also Touch API Microsoft API extensions ...
HTMLMediaElement.msInsertAudioEffect() - Web APIs
Non-standard This feature is non-standard and is not on a standards track. Do not use it on production sites facing the Web: it will not work for every user. There may also be large incompatibilities between implementations and the behavior may change in the future. The HTMLMediaElement.msInsertAudioEffect() method inserts the specified audio effect into the media pipeline. This proprietary method is specific to Internet Explorer and Microsoft Edge. Syntax HTMLMediaElement.msInsertAudioEffect(activatableClassId: DOMString, effectRequired: boolean, config); Parameters activatableClassId A DOMString defining the audio effects class. effectRequired A Boolean which if set to true requires an audio effect to be defined. configOptional An optional Object to ...
HTMLTableElement.rows - Web APIs
lection providing a live-updating list of the HTMLTableRowElement objects representing all of the <tr> elements contained in the table. This provides quick access to all of the table rows, without having to manually search for them. Example myrows = mytable.rows; firstRow = mytable.rows[0]; lastRow = mytable.rows.item(mytable.rows.length-1); This demonstrates how you can use both array syntax (line 2) and the HTMLCollection.item() method (line 3) to obtain individual rows in the table. Specifications Specification Status Comment HTML Living StandardThe definition of 'HTMLTableElement: rows' in that specification. Living Standard ...
HTMLVideoElement.msInsertVideoEffect() - Web APIs
Non-standard This feature is non-standard and is not on a standards track. Do not use it on production sites facing the Web: it will not work for every user. There may also be large incompatibilities between implementations and the behavior may change in the future. The HTMLMediaElement.msInsertVideoEffect() method inserts the specified video effect into the media pipeline. This proprietary method is specific to Internet Explorer and Microsoft Edge. Syntax str = HTMLMediaElement.msInsertVideoEffect(activatableClassId: DOMString, effectRequired: boolean, config); Parameters activatableClassId A DOMString defining the video effects class. effectRequired A Boolean which if set to true requires a video effect to be defined. configOptional An optional Objec...
HTMLVideoElement.msIsLayoutOptimalForPlayback - Web APIs
Microsoft Edge. Syntax HTMLVideoElement.msIsLayoutOptimalForPlayback: DOMString; Value Boolean value set to true indicates that video is being rendered optimally (better performance and using less battery power). If false, improvements can be made to optimize performance. For msIsLayoutOptimalForPlayback to be true, avoid the following: Video elements with Cascading Style Sheets (CSS) outlines set. Rendering a video element through a canvas element. Embedding video elements in a Scalable Vector Graphics (SVG). You can listen to the onMSVideoOptimalLayoutChanged event to be notified when the msIsLayoutOptimalForPlayback property changes. *To enable Stereo 3D playback, msIsLayoutOptimalForPlayback must be true. See also HTMLVideoElement Microsoft API extensions ...
In depth: Microtasks and the JavaScript runtime environment - Web APIs
d its context is removed from the stack and destroyed. The main program exits and its execution context is removed from the execution stack; as there are no contexts remaining on the stack, program execution ends. Using execution contexts in this manner, each program and function is able to have its own set of variables and other objects. Each context additionally tracks the next line in the program that should be run and other information critical to that context's operation. By using the contexts and the context stack in this manner, many of the fundamentals of how a program operates can be managed, including local and global variables, function calls and returns, and so forth. A special note about recursive functions--that is, functions which call themselves, possibly over...
History.replaceState() - Web APIs
rnatively, you could pass a short title for the state. url Optional The URL of the history entry. The new URL must be of the same origin as the current URL; otherwise replaceState throws an exception. Examples Suppose https://www.mozilla.org/foo.html executes the following JavaScript: const stateObj = { foo: 'bar' }; history.pushState(stateObj, '', 'bar.html'); The explanation of these two lines above can be found in the Example of pushState() method section of the Working with the History API article. Then suppose https://www.mozilla.org/bar.html executes the following JavaScript: history.replaceState(stateObj, '', 'bar2.html'); This will cause the URL bar to display https://www.mozilla.org/bar2.html, but won't cause the browser to load bar2.html or even check that bar2.html exists. ...
History.state - Web APIs
Web › API › History › state
history stack. This is a way to look at the state without having to wait for a popstate event. Syntax const currentState = history.state Value The state at the top of the history stack. The value is null until the pushState() or replaceState() method is used. Examples The code below logs the value of history.state before using the pushState() method to push a value to the history. The next line logs the value to the console again, showing that history.state now has a value. // Should be null because we haven't modified the history stack yet console.log(`History.state before pushState: ${history.state}`); // Now push something on the stack history.pushState({name: 'Example'}, "pushState example", 'page3.html'); // Now state has a value. console.log(`History.state after pushState: ${hi...
Working with the History API - Web APIs
Gecko 6.0 (Firefox 6.0 / Thunderbird 6.0 / SeaMonkey 2.3), the object is serialized using the structured clone algorithm. This allows a wider variety of objects to be safely passed. Example of replaceState() method Suppose http://mozilla.org/foo.html executes the following JavaScript: let stateObj = { foo: "bar" } history.pushState(stateObj, "page 2", "bar.html") The explanation of these two lines above can be found at the above section Example of pushState() method section. Next, suppose http://mozilla.org/bar.html executes the following JavaScript: history.replaceState(stateObj, "page 3", "bar2.html") This will cause the URL bar to display http://mozilla.org/bar2.html, but won't cause the browser to load bar2.html or even check that bar2.html exists. Suppose now that the user navig...
IDBCursor.update() - Web APIs
Web › API › IDBCursor › update
ollowing types: Exception Description TransactionInactiveError This IDBCursor's transaction is inactive. ReadOnlyError The transaction mode is read only. InvalidStateError The cursor was created using IDBIndex.openKeyCursor, is currently being iterated, or has iterated past its end. DataError The underlying object store uses in-line keys and the property in the value at the object store's key path does not match the key in this cursor's position. DataCloneError The data being stored could not be cloned by the internal structured cloning algorithm. Example In this simple fragment we create a transaction, retrieve an object store, then use a cursor to iterate through all the records in the object store.
IDBCursorSync - Web APIs
gned short The direction of traversal of the cursor. See Constants for possible values. key readonly any The key for the record at the cursor's position. value any The value for the record at the cursor's position. Setting this attribute can raise an IDBDatabaseException with the following codes: DATA_ERR If the underlying object store uses in-line keys and the property at the key path does not match the key in this cursor's position. NOT_ALLOWED_ERR If the underlying index or object store does not support updating the record because it is open in the READ_ONLY or SNAPSHOT_READ mode, or if an index record cannot be changed because the underlying index is auto-populated. SERIAL_ERR If the data being stored could not be se...
IDBDatabase.createObjectStore() - Web APIs
to create an object store with an empty name. optionalParameters Optional An options object whose attributes are optional parameters to the method. It includes the following properties: Attribute Description keyPath The key path to be used by the new object store. If empty or not specified, the object store is created without a key path and uses out-of-line keys. You can also pass in an array as a keyPath. autoIncrement If true, the object store has a key generator. Defaults to false. Unknown parameters are ignored. Returns A new IDBObjectStore. Exceptions This method may raise a DOMException with a DOMError of one of the following types: Exception Description InvalidStateError Occurs if...
IDBDatabase.name - Web APIs
Web › API › IDBDatabase › name
t handlers act on the database being // opened successfully, or not DBOpenRequest.onerror = function(event) { note.innerHTML += '<li>Error loading database.</li>'; }; DBOpenRequest.onsuccess = function(event) { note.innerHTML += '<li>Database initialised.</li>'; // store the result of opening the database in the db variable. This is used a lot below db = DBOpenRequest.result; // This line will log the name of the database, which should be "toDoList" console.log(db.name); }; Specifications Specification Status Comment Indexed Database API 2.0The definition of 'name' in that specification. Recommendation Indexed Database API DraftThe definition of 'name' in that specification. Recommendation Browser compatibility The com...
IDBDatabase.objectStoreNames - Web APIs
vent handlers act on the database being opened successfully, or not DBOpenRequest.onerror = function(event) { note.innerHTML += '<li>Error loading database.</li>'; }; DBOpenRequest.onsuccess = function(event) { note.innerHTML += '<li>Database initialised.</li>'; // store the result of opening the database in the db variable. This is used a lot below db = DBOpenRequest.result; // This line will log the version of the connected database, which should be // an object that looks like { ['my-store-name'] } console.log(db.objectStoreNames); }; Specifications Specification Status Comment Indexed Database API 2.0The definition of 'objectStoreNames' in that specification. Recommendation Indexed Database API DraftThe definition of 'objectStoreN...
IDBDatabase.transaction() - Web APIs
ability" -- the durability constrints for the transction. Valid values are: "default", "strict", and "relaxed". storeNames The names of object stores that are in the scope of the new transaction, declared as an array of strings. Specify only the object stores that you need to access. If you need to access only one object store, you can specify its name as a string. Therefore the following lines are equivalent: var transaction = db.transaction(['my-store-name']); var transaction = db.transaction('my-store-name'); If you need to access all object stores in the database, you can use the property IDBDatabase.objectStoreNames: var transaction = db.transaction(db.objectStoreNames); Passing an empty array will throw an exception. mode Optional The types of access that can be perfo...
IDBDatabase.version - Web APIs
t handlers act on the database // being opened successfully, or not DBOpenRequest.onerror = function(event) { note.innerHTML += '<li>Error loading database.</li>'; }; DBOpenRequest.onsuccess = function(event) { note.innerHTML += '<li>Database initialised.</li>'; // store the result of opening the database in the db variable. This is used a lot below db = DBOpenRequest.result; // This line will log the version of the connected database, which should be "4" console.log(db.version); }; Specifications Specification Status Comment Indexed Database API 2.0The definition of 'version' in that specification. Recommendation Indexed Database API DraftThe definition of 'version' in that specification. Recommendation Browser compatibi...
IDBDatabaseException - Web APIs
More specific variants of this error includes: TRANSACTION_INACTIVE_ERR and READ_ONLY_ERR. NOT_FOUND_ERR 3 The operation failed because the requested database object could not be found; for example, an object store did not exist but was being opened. QUOTA_ERR 11 Either there's not enough remaining storage space or the storage quota was reached and the user declined to give more space to the database. READ_ONLY_ERR 9 A mutation operation was attempted in a READ_ONLY transaction. TIMEOUT_ERR 10 A lock for the transaction could not be obtained in a reasonable time. TRANSACTION_INACTIVE_ERR 7 A request was made against a transaction that is either not currently active or is already finished. UNKNOWN_ERR ...
IDBDatabaseSync - Web APIs
th the given name in the connected database. IDBObjectStoreSync createObjectStore( in DOMString name, in DOMString keypath, in optional boolean autoIncrement ) raises (IDBDatabaseException); Parameters name The name of a new object store. keypath The key path used by the new object store. If a null path is specified, then the object store does not have a key path, and uses out-of-line keys. autoIncrement If true, the object store uses a key generator; if false, it does not use one. Returns IDBObjectStoreSync An object to access the newly created object store. Exceptions This method can raise an IDBDatabaseException with the following code: CONSTRAINT_ERR If an object store with the same name (based on case-sensitive comparison) already exists in the connected da...
IDBFactory.open() - Web APIs
Web › API › IDBFactory › open
e Example of calling open with the current specification's version parameter: var request = window.indexedDB.open("toDoList", 4); In the following code snippet, we make a request to open a database, and include handlers for the success and error cases. For a full working example, see our To-do Notifications app (view example live.) var note = document.querySelector("ul"); // In the following line, you should include the prefixes // of implementations you want to test. window.indexedDB = window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB; // DON'T use "var indexedDB = ..." if you're not in a function. // Moreover, you may need references to some window.IDB* objects: window.IDBTransaction = window.IDBTransaction || window.webkitIDBTransaction || window.m...
IDBFactory - Web APIs
esult indicating which one is greater in value. IDBFactory.databases A method that returns a list of all available databases, including their names and versions. Example In the following code snippet, we make a request to open a database, and include handlers for the success and error cases. For a full working example, see our To-do Notifications app (view example live.) // In the following line, you should include the prefixes of implementations you want to test. window.indexedDB = window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB; // DON'T use "var indexedDB = ..." if you're not in a function. // Moreover, you may need references to some window.IDB* objects: window.IDBTransaction = window.IDBTransaction || window.webkitIDBTransaction || window.msID...
IDBObjectStore.add() - Web APIs
Exceptions This method may raise a DOMException of one of the following types: Exception Description ReadOnlyError The transaction associated with this operation is in read-only mode. TransactionInactiveError This IDBObjectStore's transaction is inactive. DataError Any of the following conditions apply: The object store uses in-line keys or has a key generator, and a key parameter was provided. The object store uses out-of-line keys and has no key generator, and no key parameter was provided. The object store uses in-line keys but no key generator, and the object store's key path does not yield a valid key. The key parameter was provided but does not contain a valid key. InvalidStateError ...
IDBObjectStore.deleteIndex() - Web APIs
db variable. ...
IDBObjectStore.put() - Web APIs
Exceptions This method may raise a DOMException of one of the following types: Exception Description ReadOnlyError The transaction associated with this operation is in read-only mode. TransactionInactiveError This IDBObjectStore's transaction is inactive. DataError Any of the following conditions apply: The object store uses in-line keys or has a key generator, and a key parameter was provided. The object store uses out-of-line keys and has no key generator, and no key parameter was provided. The object store uses in-line keys but no key generator, and the object store's key path does not yield a valid key. The key parameter was provided but does not contain a valid key. InvalidStateError ...
IDBObjectStore - Web APIs
; DBOpenRequest.onsuccess = function(event) { note.innerHTML += '<li>Database initialised.</li>'; // store the result of opening the database in db. ...
IDBOpenDBRequest.onblocked - Web APIs
/ This is used a lot below db = request.result; // Run the displayData() function to populate the task list with // all the to-do list data already in the IDB displayData(); }; // This event handles the event whereby a new version of the // database needs to be created. Either one has not been created // before, or a new version number has been submitted via the // window.indexedDB.open line above //it is only implemented in recent browsers request.onupgradeneeded = function(event) { var db = event.target.result; db.onerror = function(event) { note.innerHTML += '<li>Error loading database.</li>'; }; // Create an objectStore for this database var objectStore = db.createObjectStore("toDoList", { keyPath: "taskTitle" }); ... }; request.onblocked = function() { cons...
IDBOpenDBRequest.onupgradeneeded - Web APIs
aded. For a full working example, see our To-do Notifications app (view example live.) var db; // Request version 3 of the database. var request = window.indexedDB.open("library", 3); // This event handles the event whereby a new version of the // database needs to be created. Either one has not been created // before, or a new version number has been submitted via the // window.indexedDB.open line above. request.onupgradeneeded = function(event) { db = request.result; db.onerror = function(errorEvent) { note.innerHTML += '<li>Error loading database.</li>'; }; if (event.oldVersion < 1) { // Version 1 is the first version of the database. var store = db.createObjectStore("books", {keyPath: "isbn"}); var titleIndex = store.createIndex("by_title", "title", {unique: tr...
IDBRequest.error - Web APIs
Web › API › IDBRequest › error
If you abort the transaction, then all requests still in progress receive this error. ConstraintError If you insert data that doesn't conform to a constraint. It's an exception type for creating stores and indexes. You get this error, for example, if you try to add a new key that already exists in the record. QuotaExceededError If you run out of disk quota and the user declined to grant you more space. UnknownError If the operation failed for reasons unrelated to the database itself. A failure due to disk IO errors is such an example. NoError If the request succeeds. VersionError If you try to open a database with a version lower than the one it already has. In addition to the error codes sent to the IDBRequest object, asynchr...
IDBVersionChangeEvent.newVersion - Web APIs
ionChangeEvent.newVersion Value A 64-bit integer. Example In the following code snippet, we make a request to open a database, and include handlers for the success and error cases. These events are fired via the custom IDBVersionChangeEvent interface. For a full working example, see our To-do Notifications app (view example live.) var note = document.querySelector("ul"); // In the following line, you should include the prefixes of // implementations you want to test. window.indexedDB = window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB; // DON'T use "var indexedDB = ..." if you're not in a function. // Moreover, you may need references to some window.IDB* objects: window.IDBTransaction = window.IDBTransaction || window.webkitIDBTransaction || window.m...
IDBVersionChangeEvent - Web APIs
xample In the following code snippet, we make a request to open a database, and include handlers for the success and error cases. Upon a version change (after an upgradedneeded event), the success event will implement the IDBVersionChangeEvent interface. For a full working example, see our To-do Notifications app (view example live.) var note = document.querySelector("ul"); // In the following line, you should include the prefixes of implementations you want to test. window.indexedDB = window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB; // DON'T use "var indexedDB = ..." if you're not in a function. // Moreover, you may need references to some window.IDB* objects: window.IDBTransaction = window.IDBTransaction || window.webkitIDBTransaction || window.msID...
IndexedDB API - Web APIs
y; any objects supported by the structured clone algorithm can be stored. You need to specify the database schema, open a connection to your database, and then retrieve and update data within a series of transactions. Read more about the Concepts behind IndexedDB. Learn to use IndexedDB asynchronously from first principles with our Using IndexedDB guide. Combine IndexedDB for storing data offline with Service Workers for storing assets offline, as outlined in Making PWAs work offline with Service workers. Note: Like most web storage solutions, IndexedDB follows a same-origin policy. So while you can access stored data within a domain, you cannot access data across different domains. Synchronous and asynchronous Operations performed using IndexedDB are done asynchronously, so as not ...
InputEvent.inputType - Web APIs
tentBackward, insertFromPaste, and formatBold. For a complete list of the available input types, see the Attributes section of the Input Events Level 1 spec. Examples This example logs the inputType for input events on an editable <div>. HTML <p id="log">Input type: </p> <div contenteditable="true" style="margin: 20px;padding: 20px;border:2px dashed red;"> <p>Some sample text. ...
IntersectionObserver.root - Web APIs
ery element or other object which overlaps the target element, is considered to be the visible area of the target element. If root is null, then the owning document is used as the root, and the bounds its viewport (that is, the visible area of the document) are used as the root bounds. Example This example sets the border of the intersection observer's root element to be a 2-pixel medium green line. observer.root.style.border = "2px solid #44aa44"; Specifications Specification Status Comment Intersection ObserverThe definition of 'IntersectionObserver' in that specification. Working Draft Initial definition ...
Intersection Observer API - Web APIs
hether the entry represents a transition from the elements intersecting to no longer intersecting or a transition from not intersecting to intersecting. Note that it's possible to have a non-zero intersection rectangle, which can happen if the intersection is exactly along the boundary between the two or the area of boundingClientRect is zero. This state of the target and root sharing a boundary line is not considered enough to be considered transitioning into an intersecting state. To get a feeling for how thresholds work, try scrolling the box below around. Each colored box within it displays the percentage of itself that's visible in all four of its corners, so you can see these ratios change over time as you scroll the container. Each box has a different set of thresholds: The first b...
KeyboardEvent.initKeyboardEvent() - Web APIs
type of keyboard event; this will be one of keydown, keypress, or keyup. canBubbleArg Whether or not the event can bubble. cancelableArg Whether or not the event can be canceled. viewArg The WindowProxy it is associated to. charArg The value of the char attribute. keyArg The value of the key attribute. locationArg The value of the location attribute. modifiersListArg A whitespace-delineated list of modifier keys that should be considered to be active on the event's key. For example, specifying "Control Shift" indicates that the user was holding down the Control and Shift keys when pressing the key described by the event. repeatArg The value of the repeat attribute. ...
KeyboardEvent.key - Web APIs
Web › API › KeyboardEvent › key
Case 1 When the shift key is pressed, a keydown event is first fired, and the key property value is set to the string Shift. As we keep holding this key, the keydown event does not continue to fire repeatedly because it does not produce a character key. When key 2 is pressed, another keydown event is fired for this new key press, and the key property value for the event is...
KeyframeEffect.KeyframeEffect() - Web APIs
nd switches direction after each iteration (alternate-reverse). Defaults to "normal". duration Optional The number of milliseconds each iteration of the animation takes to complete. Defaults to 0. Although this is technically optional, keep in mind that your animation will not run if this value is 0. easing Optional The rate of the animation's change over time. Accepts the pre-defined values "linear", "ease", "ease-in", "ease-out", and "ease-in-out", or a custom "cubic-bezier" value like "cubic-bezier(0.42, 0, 0.58, 1)". Defaults to "linear". endDelay Optional The number of milliseconds to delay after the end of an animation. This is primarily of use when sequencing animations based on the end time of another animation. Defaults to 0. fill Optional Dictates whether the animation's eff...
KeyframeEffectOptions - Web APIs
nd switches direction after each iteration (alternate-reverse). Defaults to "normal". duration Optional The number of milliseconds each iteration of the animation takes to complete. Defaults to 0. Although this is technically optional, keep in mind that your animation will not run if this value is 0. easing Optional The rate of the animation's change over time. Accepts the pre-defined values "linear", "ease", "ease-in", "ease-out", and "ease-in-out", or a custom "cubic-bezier" value like "cubic-bezier(0.42, 0, 0.58, 1)". Defaults to "linear". endDelay Optional The number of milliseconds to delay after the end of an animation. This is primarily of use when sequencing animations based on the end time of another animation. Defaults to 0. fill Optional Dictates whether the animation's eff...
Locks.name - Web APIs
Web › API › Lock › name
LockManager.request selected when the lock was requested. The name of a lock is passed by script when the lock is requested. The name is selected by the developer to represent an abstract resource for which use is being coordinated across multiple tabs, workers, or other code within the origin. For example, if only one tab of a web application should be synchronizing network resources with an offline database, it could use a lock name such as "net_db_sync". Syntax var name = Lock.name Value A DOMString. Example The following examples show how the name property passed in the call to LockManager.request(). LockManager is the object returned by navigator.locks. navigator.locks.request("net_db_sync", show_lock_properties); function show_lock_properties(lock) { console.log(`The lock nam...
MediaDeviceInfo.label - Web APIs
Only available during active MediaStream use, or when persistent permissions have been granted. Syntax var label = MediaDeviceInfo.label; Value A DOMString which describes the media device. For security reasons, the label is always an empty string ("") if the user has not obtained permission to use at least one media device, either by starting a stream from the microphone or camera, or by persistent permissions being granted. Specifications Specification Status Comment Media Capture and StreamsThe definition of 'label' in that specification. ...
MediaDevices.getUserMedia() - Web APIs
() is one method which will require the use of Feature Policy, and your code needs to be prepared to deal with this. For example, you may need to use the allow attribute on any <iframe> that uses getUserMedia(), and pages that use getUserMedia() will eventually need to supply the Feature-Policy header. The two permissions that apply to getUserMedia() are camera and microphone. ...
MediaRecorder.mimeType - Web APIs
ints) .then(function(stream) { var options = { audioBitsPerSecond: 128000, videoBitsPerSecond: 2500000, mimeType: 'video/mp4' } var mediaRecorder = new MediaRecorder(stream,options); m = mediaRecorder; m.mimeType; // would return 'video/mp4' ... }) .catch(function(error) { console.log(error.message); }); Changing line 14 to the following causes MediaRecorder to try to use AVC Constrained Baseline Profile Level 4 for video and AAC-LC (Low Complexity) for audio, which is good for mobile and other possible resource-constrained situations. mimeType: 'video/mp4; codecs="avc1.424028, mp4a.40.2"' Assuming this configuration is acceptable to the user agent, the value returned later by m.mimeType would then be video/...
MediaRecorder - Web APIs
Specifications Specification Status Comment MediaStream Recording Working Draft Initial definition ...
MediaRecorderErrorEvent() - Web APIs
reated. It must contain the error property at a minimum. error A DOMException that describes the error that occurred. This object's name property should indicate the name of the error that occurred. The other fields may or may not be present. Some user agents add to the error object other properties that provide information such as stack dumps, the name of the JavaScript file and the line number where the error occurred, and other debugging aids, but you should not rely on this information in a production environment. Specifications Specification Status Comment MediaStream RecordingThe definition of 'MediaRecorderErrorEvent()' in that specification. Working Draft Initial definition. ...
MediaStreamTrack.applyConstraints() - Web APIs
The applyConstraints() method of the MediaStreamTrack interface applies a set of constraints to the track; these constraints let the Web site or app establish ideal values and acceptable ranges of values for the constrainable properties of the track, such as frame rate, dimensions, echo cancelation, and so forth. Constraints can be used to ensure that the media meets certain guidelines you prefer. For example, you may prefer high-density video but require that the frame rate be a little low to help keep the data rate low enough not overtax the network. Constraints can also specify ideal and/or acceptable sizes or ranges of sizes. See Applying constraints in Capabilities, constraints, and settings for more information on how to apply your preferred constraints. Syntax const appliedPromise =...
MediaStreamTrack.getConstraints() - Web APIs
ace returns a MediaTrackConstraints object containing the set of constraints most recently established for the track using a prior call to applyConstraints(). These constraints indicate values and ranges of values that the Web site or application has specified are required or acceptable for the included constrainable properties. Constraints can be used to ensure that the media meets certain guidelines you prefer. For example, you may prefer high definition video but require that the frame rate be a little low to help keep the data rate low enough not overtax the network. Constraints can also specify ideal and/or acceptable sizes or ranges of sizes. See Capabilities, constraints, and settings for details on how to work with constrainable properties. Syntax const constraints = track.getConstr...
Using the MediaStream Recording API - Web APIs
t 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), the adjacent <aside> element will have its horizontal translation value changed and transition smoothly into view: input[type=checkbox]:checked ~ aside { transform: translateX(0); } Basic app setup To grab the media stream we want to cap...
MediaTrackConstraints.facingMode - Web APIs
OMString specifying one or more acceptable, ideal, and/or exact (mandatory) facing modes are acceptable for a video track. An exact value in this case indicates that the specified facing mode is specifically required; for example: var constraints = { facingMode: { exact: "user" } }; This indicates that only a user-facing camera is acceptable; if there is no user-facing camera, or the user declines permission to use that camera, the media request will fail. The following strings are permitted values for the facing mode. These may represent separate cameras, or they may represent directions in which an adjustable camera can be pointed. "user" The video source is facing toward the user; this includes, for example, the front-facing camera on a smartphone. "environment" The video source...
MediaTrackControls.volume - Web APIs
straints.volume as returned by a call to MediaDevices.getSupportedConstraints(). However, typically this is unnecessary since browsers will simply ignore any constraints they're unfamiliar with. Syntax var constraintsObject = { volume: constraint }; constraintsObject.volume = constraint; Value A ConstrainDouble describing the acceptable or required value(s) for an audio track's volume, on a linear scale where 0.0 means silence and 1.0 is the highest supported volume. If this value is a number, the user agent will attempt to obtain media whose volume is as close as possible to this number given the capabilities of the hardware and the other constraints specified. Otherwise, the value of this ConstrainDouble will guide the user agent in its efforts to provide an exact match to the require...
MediaTrackSettings.sampleSize - Web APIs
This lets you determine what value was selected to comply with your specified constraints for this property's value as described in the MediaTrackConstraints.sampleSize property you provided when calling either getUserMedia() or MediaStreamTrack.applyConstraints(). If needed, you can determine whether or not this constraint is supported by checking the value of MediaTrackSupportedConstraints.sampleSize as returned by a call to MediaDevices.getSupportedConstraints(). ...
MediaTrackSettings - Web APIs
pression is enabled and is false otherwise. sampleRate A long integer value indicating the current value of the sampleRate property, specifying the sample rate in samples per second of the audio data. Standard CD-quality audio, for example, has a sample rate of 41,000 samples per second. sampleSize A long integer value indicating the current value of the sampleSize property, specifying the linear size, in bits, of each audio sample. CD-quality audio, for example, is 16-bit, so this value would be 16 in that case. volume A double-precision floating point value indicating the current value of the volume property, specifying the volume level of the track. This value will be between 0.0 (silent) to 1.0 (maximum supported volume). Properties of video tracks aspectRatio A double-preci...
Media Source API - Web APIs
sible API. Creating assets that work with MSE in modern browsers is a laborious process, taking significant time, computing power, and energy. The usage of external utilities to massage the content into a suitable format is required. While browser support for the various media containers with MSE is spotty, usage of the H.264 video codec, AAC audio codec, and MP4 container format is a common baseline. MSE also provides an API for runtime detection of container and codec support. If you do not require explicit control of video quality over time, the rate at which content is fetched, or the rate at which memory is evicted, then the <video> and <source> tags may well be a simple and adequate solution. DASH Dynamic Adaptive Streaming over HTTP (DASH) is a protocol for specifying how adaptive c...
Microdata DOM API - Web APIs
ies If the element has an itemscope attribute, returns an HTMLPropertiesCollection object with all the element's properties. Otherwise, an empty HTMLPropertiesCollection object. 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. This attribute returns an HTMLPropertiesCollection, which can be enumerated to go through each element that adds one or more properties to the item. It can also be indexed by name, which will return an object with a list of the elements that add properties with that name...
msSetMediaProtectionManager - Web APIs
Non-standard This feature is non-standard and is not on a standards track. Do not use it on production sites facing the Web: it will not work for every user. There may also be large incompatibilities between implementations and the behavior may change in the future. The msSetMediaProtectionManager method specifies the media protection manager for a given media pipeline. This proprietary method is specific to Internet Explorer and Microsoft Edge. Syntax HTMLMediaElement.msSetMediaProtectionManager(mediaProtectionManager); Parameters The Windows.Media.Protection namespace provides classes to manage Digital Rights Management (DRM) media contents. The MediaProtectionManager class can be passed as an input to a media playback API or the mediaProtectionManager property...
MutationObserver.takeRecords() - Web APIs
or("#someElement"); const observerOptions = { childList: true, attributes: true } const observer = new MutationObserver(callback); observer.observe(targetNode, observerOptions); /* ...later, when it's time to stop observing... */ /* handle any still-pending mutations */ let mutations = observer.takeRecords(); observer.disconnect(); if (mutations) { callback(mutations); } The code in lines 12-17 fetches any unprocessed mutation records, then invokes the callback with the records so that they can be processed. This is done immediately prior to calling disconnect() to stop observing the DOM. Specifications Specification Status Comment DOMThe definition of 'MutationObserver.takeRecords()' in that specification. Living Standard ...
MutationObserverInit.attributeFilter - Web APIs
s enabled regardless of whether or not the attributes property is true. Example In this example, a Mutation Observer is set up to watch for changes to the status and username attributes in any elements contained within a subtree that displays the names of users in a chat room. This lets the code, for example, reflect changes to users' nicknames, or to mark them as away from keyboard (AFK) or offline. function callback(mutationList) { mutationList.forEach(function(mutation) { switch(mutation.type) { case "attributes": switch(mutation.attributeName) { case "status": userStatusChanged(mutation.target.username, mutation.target.status); break; case "username": usernameChanged(mutation.oldValue, mutation.target.username);...
MutationObserverInit.attributeOldValue - Web APIs
g attributeOldValue, setting the attributes option to true is optional. Example In this example, a Mutation Observer is set up to watch for changes to the status and username attributes in any elements contained within a subtree that displays the names of users in a chat room. This lets the code, for example, reflect changes to users' nicknames, or to mark them as away from keyboard (AFK) or offline. function callback(mutationList) { mutationList.forEach(function(mutation) { switch(mutation.type) { case "attributes": notifyUser("Attribute name " + mutation.attributeName + " changed to " + mutation.target[mutation.attributeName] + " (was " + mutation.oldValue + ")"); break; } }); } var targetNode = document.querySelector("#target"); ...
MutationObserverInit.attributes - Web APIs
tically assumed to be true, even if you don't expressly set it as such. Example In this example, a Mutation Observer is set up to watch for changes to the status and username attributes in any elements contained within a subtree that displays the names of users in a chat room. This lets the code, for example, reflect changes to users' nicknames, or to mark them as away from keyboard (AFK) or offline. function callback(mutationList) { mutationList.forEach(function(mutation) { switch(mutation.type) { case "attributes": notifyUser("Attribute name " + mutation.attributeName + " changed to " + mutation.target[mutation.attributeName] + " (was " + mutation.oldValue + ")"); break; } }); } var targetNode = document.querySelector("#target"); ...
MutationObserverInit.subtree - Web APIs
or changes. Changing this value to true causes the entire subtree rooted at the specified target node to be monitored for the changes indicated by the other options. For example, to watch the target node only for attribute changes, the MutationObserverInit passed into MutationObserver() can be: var options = { attributes: true, subtree: false }; Since the default value of subtree is false, line 3 is optional. To monitor the entire subtree for attribute changes, simply set subtree to true: var options = { attributes: true, subtree: true }; Example Specifications Specification Status Comment DOMThe definition of 'MutationObserverInit.subtree' in that specification. Living Standard ...
Navigator.mozIsLocallyAvailable() - Web APIs
The Navigator.mozIsLocallyAvailable() method allows add-ons to determine whether or not a given resource is available. Note: Security exceptions can occur if the requested URI is not from the same origin. Syntax navigator.mozIsLocallyAvailable(uri, ifOffline); Parameters uri The URI of the resource whose availability is to be checked, as a string. ifOffline Allows you to specify whether or not the offline resources cache should be checked; specify true to consider the offline resources cache. Example var available = navigator.mozIsLocallyAvailable("my-image-file.png", true); if (available) { /* the offline resource is present */ } else { console.log("Certain needed resources are not available offline"); } Specifications Not part of any specifications. ...
NavigatorID.platform - Web APIs
Returns a string representing the platform of the browser. The specification allows browsers to always return the empty string, so don't rely on this property to get a reliable answer. Syntax platform = navigator.platform Value A DOMString identifying the platform on which the browser is running, or an empty string if the browser declines to (or is unable to) identify the platform. platform is a string that must be an empty string or a string representing the platform on which the browser is executing. For example: "MacIntel", "Win32", "FreeBSD i386", "WebTV OS" Example console.log(navigator.platform); Usage notes Most browsers, including Chrome, Edge, and Firefox 63 and later, return "Win32" even if running on a 64-bit version of Windows. Internet Explorer and versions of Firefox p...
Node.cloneNode() - Web APIs
Web › API › Node › cloneNode
nkey 2.25 / Firefox OS 1.3)), the console warned developers not to omit the argument. Starting with Gecko 29.0 (Firefox 29 / Thunderbird 29 / SeaMonkey 2.26)), a shallow clone is defaulted instead of a deep clone. Example let p = document.getElementById("para1") let p_prime = p.cloneNode(true) Notes Cloning a node copies all of its attributes and their values, including intrinsic (inline) listeners. It does not copy event listeners added using addEventListener() or those assigned to element properties (e.g., node.onclick = someFunction). Additionally, for a <canvas> element, the painted image is not copied. Warning: cloneNode() may lead to duplicate element IDs in a document! If the original node has an id attribute, and the clone will be placed in the same document, then you ...
Node.isConnected - Web APIs
Web › API › Node › isConnected
st.isConnected); // Returns true Shadow DOM A shadow DOM example: // Create a shadow root var shadow = this.attachShadow({mode: 'open'}); // Create some CSS to apply to the shadow dom var style = document.createElement('style'); console.log(style.isConnected); // returns false style.textContent = ` .wrapper { position: relative; } .info { font-size: 0.8rem; width: 200px; display: inline-block; border: 1px solid black; padding: 10px; background: white; border-radius: 10px; opacity: 0; transition: 0.6s all; positions: absolute; bottom: 20px; left: 10px; z-index: 3 } `; // Attach the created style element to the shadow dom shadow.appendChild(style); console.log(style.isConnected); // Returns true Polyfill Node.isConnected can be polyfilled with the following...
Node.rootNode - Web APIs
Web › API › Node › rootNode
.getRootNode() method. The Node.rootNode read-only property returns a Node object representing the topmost node in the tree, or the current node if it's the topmost node in the tree. This is found by walking backward along Node.parentNode until the top is reached. Syntax rootNode = node.rootNode; Value A Node object representing the topmost node in the tree. Example Running the following line in supporting browsers should return a reference to the HTML/document node: console.log(document.body.rootNode); Notes Gecko-based browsers insert text nodes into a document to represent whitespace in the source markup. Therefore a node obtained, for example, using Node.firstChild or Node.previousSibling may refer to a whitespace text node rather than the actual element the author intended to...
Notifications API - Web APIs
Notification.requestPermission(); // wait for permission }) This is not only best practice -- you should not be spamming users with notifications they didn't agree to -- but going forward browsers will explicitly disallow notifications not triggered in response to a user gesture. Firefox is already doing this from version 72, for example. This will spawn a request dialog, along the following lines: From here the user can choose to allow notifications from this origin, or block them. Once a choice has been made, the setting will generally persist for the current session. Note: As of Firefox 44, the permissions for Notifications and Push have been merged. If permission is granted for notifications, push will also be enabled. Next, a new notification is created using the Notification(...
PannerNode.distanceModel - Web APIs
The distanceModel property of the PannerNode interface is an enumerated value determining which algorithm to use to reduce the volume of the audio source as it moves away from the listener. The possible values are: linear: A linear distance model calculating the gain induced by the distance according to: 1 - rolloffFactor * (distance - refDistance) / (maxDistance - refDistance) inverse: An inverse distance model calculating the gain induced by the distance according to: refDistance / (refDistance + rolloffFactor * (Math.max(distance, refDistance) - refDistance)) exponential: An exponential distance model calculating the gain induced by the distance according to: pow((Math.max(distance, refDistance) / refDistance, -rolloffFactor). inverse is the default value of distanceModel. ...
PannerNode.maxDistance - Web APIs
The maxDistance property's default value is 10000. Syntax var audioCtx = new AudioContext(); var panner = audioCtx.createPanner(); panner.maxDistance = 10000; Value A double. The default is 10000, and non-positive values are not allowed. ...
PannerNode.refDistance - Web APIs
ong the Z (depth-wise) axis // at the given start time, resulting in a decrease in volume (decay) const scheduleTestTone = (refDistance, startTime) => { const osc = new OscillatorNode(context); const panner = new PannerNode(context); panner.refDistance = refDistance; // set the initial Z position, then schedule the ramp panner.positionZ.setValueAtTime(0, startTime); panner.positionZ.linearRampToValueAtTime(Z_DISTANCE, startTime + NOTE_LENGTH); osc.connect(panner) .connect(context.destination); osc.start(startTime); osc.stop(startTime + NOTE_LENGTH); }; // this tone should decay immediately and fairly quickly scheduleTestTone(1, context.currentTime); // this tone should decay slower and later than the previous one scheduleTestTone(4, context.currentTime + NOTE_LENGTH...
PannerNode - Web APIs
erGain attribute. PannerNode.coneOuterGain A double value describing the amount of volume reduction outside the cone defined by the coneOuterAngle attribute. Its default value is 0, meaning that no sound can be heard. PannerNode.distanceModel An enumerated value determining which algorithm to use to reduce the volume of the audio source as it moves away from the listener. Possible values are "linear", "inverse" and "exponential". The default value is "inverse". PannerNode.maxDistance A double value representing the maximum distance between the audio source and the listener, after which the volume is not reduced any further. PannerNode.orientationX Represents the horizontal position of the audio source's vector in a right-hand cartesian coordinate system. While this AudioParam cannot be...
ParentNode.prepend() - Web APIs
fied point in the hierarchy. Examples Prepending an element var parent = document.createElement("div"); var p = document.createElement("p"); var span = document.createElement("span"); parent.append(p); parent.prepend(span); console.log(parent.childNodes); // NodeList [ <span>, <p> ] Prepending text var parent = document.createElement("div"); parent.append("Some text"); parent.prepend("Headline: "); console.log(parent.textContent); // "Headline: Some text" Appending an element and text var parent = document.createElement("div"); var p = document.createElement("p"); parent.prepend("Some text", p); console.log(parent.childNodes); // NodeList [ #text "Some text", <p> ] ParentNode.prepend() is unscopable The prepend() method is not scoped into the with statement. See Symbol.unscopable...
ParentNode.replaceChildren() - Web APIs
n veggie pizza</option> </select> </div> <div class="buttons"> <button id="to-yes">Transfer to "Yes" --&gt;</button> <button id="to-no">&lt;-- Transfer to "No"</button> </div> <div> <label for="yes">Yes please!</label> <select id="yes" multiple size="10"> </select> </div> </main> It would make sense to use some simple CSS to lay out the two select lists in a line alongside one another, with the control buttons in between them: main { display: flex; } div { margin-right: 20px; } label, button { display: block; } .buttons { display: flex; flex-flow: column; justify-content: center; } select { width: 200px; } What we want to do is transfer any selected options in the "no" list over to the "yes" list when the "yes" button is pressed, and t...
PaymentAddress - Web APIs
The PaymentAddress interface of the Payment Request API is used to store shipping or payment address information. It may be useful to refer to the Universal Postal Union web site's Addressing S42 standard materials, which provide information about international standards for postal addresses. Properties PaymentAddress.addressLine Read only An array of DOMString objects providing each line of the address not included among the other properties. The exact size and content varies by country or location and can include, for example, a street name, house number, apartment number, rural delivery route, descriptive instructions, or post office box number. PaymentAddress.country Read only A DOMString specifying the country in which the address is located, using the ISO-3166-1 alp...
PaymentCurrencyAmount - Web APIs
Properties All properties are required. currency A string containing a valid 3-letter ISO 4217 currency identifier (ISO 4217) indicating the currency used for the payment value. ...
PaymentDetailsBase - Web APIs
The PaymentDetailsBase dictionary is a mixin used by the PaymentDetailsInit and PaymentDetailsUpdate dictionaries. It is never directly used by developers and is included here only to be used as the basis for those documents. Properties displayItemsOptional An array of PaymentItem objects, each describing one line item for the payment request. These represent the line items on a receipt or invoice. modifiersOptional An array of PaymentDetailsModifier objects, each describing a modifier for particular payment method identifiers. For example, you can use one to adjust the total payment amount based on the selected payment method ("5% cash discount!"). shippingOptionsOptional An array of PaymentShippingOption objects, each describing one available shipping option from which th...
PaymentDetailsUpdate - Web APIs
to provide a Promise that returns a PaymentDetailsUpdate that updates the payment information before the user interface is even enabled for the first time. Properties The PaymentDetailsUpdate dictionary is based on the PaymentDetailsBase dictionary, and inherits its properties, which are included in the list below. displayItems Optional An array of PaymentItem objects, each describing one line item for the payment request. These represent the line items on a receipt or invoice. error Optional A DOMString specifying an error message to present to the user. When calling updateWith(), including error in the updated data causes the user agent to display the text as a general error message. For address field specific errors, use shippingAddressErrors. modifiers Optional An array of Paym...
PaymentItem - Web APIs
This might be an item or service being purchased or a tax or other charge. Properties amount Secure context A PaymentCurrencyAmount object describing the monetary value of the item. label Secure context A string specifying a human-readable name or description of the item or service being charged for. This may be displayed to the user by the user agent, depending on the design of the interface. pending Secure context A Boolean value which is true if the specified amount has not yet been finalized. ...
PaymentRequest.canMakePayment() - Web APIs
The PaymentRequest method canMakePayment() determines whether or not the request is configured in a way that is compatible with at least one payment method supported by the user agent. 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. For instance, you might call canMakePayment() to determine if the browser will let the user pay using Payment Request API, and if it won't, you could fall back to another payment method, or offer a list of methods that aren't handled by Payment Request API (or even provide instructions for paying by mail or by phone). Syntax paymentRequest.canMakePayment() .then( canPay => { ... }) .catch( error => { ... }) canPay = await paymentRequest.canMak...
PaymentRequestUpdateEvent.updateWith() - Web APIs
The updateWith() method of the PaymentRequestUpdateEvent interface updates the details of an existing PaymentRequest. Syntax paymentRequestUpdateEvent.updateWith(details); Parameters details A PaymentDetailsUpdate object specifying the changes applied to the payment request: displayItems Optional An array of PaymentItem objects, each describing one line item for the payment request. These represent the line items on a receipt or invoice. error Optional A DOMString specifying an error message to present to the user. When calling updateWith(), including error in the updated data causes the user agent to display the text as a general error message. For address field specific errors, use shippingAddressErrors. modifiers Optional An array of PaymentDetailsModifier objects, each d...
Payment processing concepts - Web APIs
hant) The merchant--either a person or an organization--whose web site or app wishes to receive money through the Payment Request API. payer The person or organization making a purchase using a web site or app. The payer authenticates themselves, then authorizes payment, as required by the payment method. payment method The instrument by which payment is submitted, such as a credit card or online payment service. payment method provider An organization that provides the technology needed to submit payments using a given payment method. For example, when using a credit card to pay, the credit card processing service is the payment method provider. payment handler The implementation of the code needed to interface with a particular payment method provider in order to process payments. ...
Payment Request API - Web APIs
The Payment Request API provides a consistent user experience for both merchants and users. It is not a new way for paying for things; rather, it's a way for users to select their preferred way of paying for things, and make that information available to a merchant. Payment Request concepts and usage Many problems related to online shopping-cart abandonment can be traced to checkout forms, which can be difficult and time consuming to fill out and often require multiple steps to complete. The Payment Request API is meant to reduce the number of steps needed to complete a payment online, potentially doing away with checkout forms. It aims to make the checkout process easier, by remembering a user's details, which are then passed along to a merchant hopefully without requiring a HTML...
PerformanceEntry.toJSON() - Web APIs
Candidate Recommendation Initial definition of toJSON() method. ...
PerformanceObserver() - Web APIs
Candidate Recommendation Initial definition of PerformanceObserver() constructor. ...
PeformanceObserver.disconnect() - Web APIs
} }); observer.observe({entryTypes: ["mark", "frame"]}); function perf_observer(list, observer) { // Process the "measure" event // ... // Disable additional performance events observer.disconnect(); } var observer2 = new PerformanceObserver(perf_observer); observer2.observe({entryTypes: ["measure"]}); Specifications Specification Status Comment Performance Timeline Level 2The definition of 'disconnect()' in that specification. Candidate Recommendation Initial definition of disconnect() method. ...
PerformanceObserver.observe() - Web APIs
Candidate Recommendation Initial definition of observe() method. ...
PerformanceObserver.takeRecords() - Web APIs
Candidate Recommendation Initial definition of takeRecords() method. ...
PerformanceObserverEntryList.getEntries() - Web APIs
Candidate Recommendation Initial definition. ...
PerformanceObserverEntryList.getEntriesByName() - Web APIs
Candidate Recommendation Initial definition of getEntriesByName() method. ...
PerformanceObserverEntryList.getEntriesByType() - Web APIs
Candidate Recommendation Initial definition of getEntriesByType() method. ...
PerformanceObserverEntryList - Web APIs
Candidate Recommendation Initial definition. ...
Using the Permissions API - Web APIs
Some APIs have more complex PermissionDescriptors contai...
Pointer events - Web APIs
npointercancel = cancelHandler; } </script> <body onload="init();"> <div id="target"> Touch me ... </div> </body> </html> touch-action CSS property The touch-action CSS property is used to specify whether or not the browser should apply its default (native) touch behavior (such as zooming or panning) to a region. This property may be applied to all elements except: non-replaced inline elements, table rows, row groups, table columns, and column groups. A value of auto means the browser is free to apply its default touch behavior (to the specified region) and the value of none disables the browser's default touch behavior for the region. The values pan-x and pan-y, mean that touches that begin on the specified region are only for horizontal and vertical scrolling, respectively.
PromiseRejectionEvent.promise - Web APIs
object with a code field containing the text "Module not ready", it sets up an idle callback that will retry the task that failed to execute correctly. event.preventDefault() is called to indicate that the promise has now been handled. window.onunhandledrejection = function(event) { if (event.reason.code && event.reason.code == "Module not ready") { window.requestIdleCallback(function(deadline) { loadModule(event.reason.moduleName) .then(performStartup); }); event.preventDefault(); } } Specifications Specification Status Comment HTML Living StandardThe definition of 'PromiseRejectionEvent.promise' in that specification. Living Standard Initial definition. ...
PublicKeyCredentialRequestOptions.extensions - Web APIs
Description appid USVString FIDO appID. An appID which was used with legacy FIDO JS APIs to identify the current relying party. txAuthSimple USVString Simple transaction authorization. This text is displayed on a prompt of the authenticator before verifying the user or testing their presence. The client outputs a USVString which is the text as it was displayed (line breaks may have been added). txAuthGeneric An object with two properties: contentType (USVString) content (ArrayBuffer) Generic transaction authorization. This is used to display an image or some non-textual content on the authenticator before verifying the user or testing their presence. The contentType gives the MIME type of the resource to be displa...
RTCConfiguration.bundlePolicy - Web APIs
patible with the SDP BUNDLE standard. If the remote peer is bundle compatible, the policy is moot and all media tracks and the data channel are bundled onto a single RTCDtlsTransport at the completion of the negotiation process. Any other transports that were used during negotiation are then closed. In technical terms, an SDP BUNDLE lets all of the media tracks (identified in the SDP from the m= lines) stream between two peers across a single 5-tuple, that is, from a single IP and port on one peer to a single IP and port on another peer, all using the same RTCDtlsTransport. The goal of bundling is to optimize performance by reducing the overhead of having multiple transports in play. The fewer RTP transports or bundles of RTP streams you have, the better the network performance will be. Al...
RTCConfiguration.iceServers - Web APIs
providing one server's URL. If the array is empty, or if the iceServers option isn't specified, the ICE agent will negotiate without the use of any servers, which will limit the connection to local peers. Description How the list of servers you provide is used is up to the implementation of the user agent. While it can be useful to provide a second server as a fallback in case the first is offline, listing too many servers can delay the user's connection being established, depending on the network's performance and how many servers get used for negotiation before a connection is established. If the list of servers is changed while a connection is already active by calling the the RTCPeerConnection method setConfiguration(), no immediate effect occurs. However, the new list of servers is u...
RTCDataChannel: message event - Web APIs
ts up a handler for incoming messages and acts on them by adding the data contained within the message to the current document as a new <p> (paragraph) element. dc.addEventListener("message", ev => { let newParagraph = document.createElement("p"); let textNode = document.createTextNode(event.data); newParagraph.appendChild(textNode); document.body.appendChild(newParagraph); }, false); Lines 2-4 create the new paragraph element and add the message data to it as a new text node. Line 6 appends the new paragraph to the end of the document's body. You can also use an RTCDataChannel object's onmessage event handler property to set the event handler: dc.onmessage = ev => { let newParagraph = document.createElement("p"); let textNode = document.createTextNode(event.data); newParag...
RTCDataChannel.onerror - Web APIs
a UI library's alert box function to present an error message to the user. let pc = new RTCPeerConnection(); let dc = pc.createDataChannel("PlayerControl"); dc.onerror = function(event) { myUILibrary.doAlertBox({ 'Network Error', // Alert title 'The error "' + event.message + '" occurred while handling player control network messages.', event.filename, event.lineno, event.colno }); } /* ... */ Specifications Specification Status Comment WebRTC 1.0: Real-time Communication Between BrowsersThe definition of 'RTCDataChannel.onerror' in that specification. Candidate Recommendation Initial specification. ...
RTCDataChannelEvent.channel - Web APIs
The read-only property RTCDataChannelEvent.channel returns the RTCDataChannel associated with the event. Syntax var channel = RTCDataChannelEvent.channel; Value A RTCDataChannel object representing the data channel linking the receiving RTCPeerConnection to its remote peer. 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. pc.ondatachannel = function(event) { inboundDataChannel = event.channel; inboundDataChannel.onmessage = handleIncomingMessage; inboundDataChannel.onopen = handleChannelOpen; inboundDataChannel.onclose = handleChannelClose; } Specifications Specification Status Comment WebRTC 1.0: Real-time Communic...
RTCErrorEvent - Web APIs
Constructor RTCErrorEvent() Creates and returns a new RTCErrorEvent object. Properties In addition to the standard properties available on the Event interface, RTCErrorEvent also includes the following: error Read only An RTCError object specifying the error which occurred; this object includes the type of error that occurred, information about where the error occurred (such as which line number in the SDP or what SCTP cause code was at issue). Methods No additional methods are provided beyond any found on the parent interface, Event. Description There are other data types used for error events in WebRTC, as needed for errors with special information sharing requirements. The most common of these is probably RTCPeerConnectionIceErrorEvent, used by the icecandidateerror event,...
RTCIceCandidate.candidate - Web APIs
roperties of the candidate, taken directly from the SDP attribute "candidate". The candidate string specifies the network connectivity information for the candidate. If the candidate is an empty string (""), the end of the candidate list has been reached; this candidate is known as the "end-of-candidates" marker. The syntax of the candidate string is described in RFC 5245, section 15.1. For an a-line (attribute line) that looks like this: a=candidate:4234997325 1 udp 2043278322 192.168.0.56 44323 typ host the corresponding candidate string's value will be "candidate:4234997325 1 udp 2043278322 192.168.0.56 44323 typ host". The user agent always prefers candidates with the highest priority, all else being equal. In the example above, the priority is 2043278322. The attributes are all separa...
RTCIceCandidate.component - Web APIs
a string which indicates whether the candidate is an RTP or an RTCP candidate. If a candidate represents both RTP and RTCP multiplexed together, it is reported as an RTP candidate. Syntax var component = RTCIceCandidate.component; Value A DOMString which is "rtp" for RTP (or RTP and RTCP multiplexed together) candidates or "rtcp" for RTCP candidates. Usage notes Consider this SDP attribute line (a-line): a=candidate:4234997325 1 udp 2043278322 192.168.0.56 44323 typ host This is an ICE candidate a-line, whose foundation is 4234997325. The next field on the a-line, "1", is the component ID. A value of "1" indicates RTP, which is recorded in the component property as "rtp". If this value were instead "2", the a-line would be describing an RTCP candidate, and compoment would be "rtcp". ...
RTCIceCandidate.foundation - Web APIs
le RTCIceTransport objects Syntax var foundation = RTCIceCandidate.foundation; Value A DOMString which uniquely identifies the candidate across all RTCIceTransports on which it is available. Note: If port is null -- and port is supported by the user agent -- passing the candidate to addIceCandidate() will fail, throwing an OperationError exception. Usage notes Consider this SDP attribute line (a-line) which describes an ICE candidate: a=candidate:4234997325 1 udp 2043278322 192.168.0.56 44323 typ host The field "4234997325" is the foundation. Example This code snippet uses the foundation of two candidates to determine if they're actually the same candidate. if (candidate1.foundation == candidate2.foundation) { /* the two candidates are the same, even if they're on differe...
RTCIceCandidate.tcpType - Web APIs
The RTCIceCandidate interface's read-only tcpType property is included on TCP candidates to provide additional details about the candidate type. The tcpType field's value is set when the RTCIceCandidate() constructor is used. You can't directly set its value; instead, its value is automatically extracted from the candidate a-line, if it's formatted properly. Syntax var tcpType = RTCIceCandidate.tcpType; Value A DOMString whose value is one of those defined by the RTCIceTcpCandidateType enumerated type. "active" The transport will try to open an outbound connection but won't receive inoming connection requests. "passive" The transport will receive incoming connection requests but won't try to open an outbound connection. "so" The transport will try to open a connection simultaneou...
RTCIceCandidate.usernameFragment - Web APIs
ified when creating the RTCIceCandidate by setting the corresponding usernameFragment value in the RTCIceCandidateInit object when creating a new candidate with new RTCIceCandidate(). Note that 24 bits of the username fragment are required to be randomized by the browser. See Randomization below for details. If you instead call RTCIceCandidate() with a string parameter containing the candidate m-line text, the value of usernameFragment is extracted from the m-line. Syntax var ufrag = RTCIceCandidate.usernameFragment; Value A DOMString containing the username fragment (usually referred to in shorthand as "ufrag" or "ice-ufrag") that, along with the ICE password ("ice-pwd"), uniquely identifies a single ongoing ICE interaction, including for any communication with the STUN server. The strin...
RTCIceCandidateInit.candidate - Web APIs
roperties of the candidate, taken directly from the SDP attribute "candidate". The candidate string specifies the network connectivity information for the candidate. If the candidate is an empty string (""), the end of the candidate list has been reached; this candidate is known as the "end-of-candidates" marker. The syntax of the candidate string is described in RFC 5245, section 15.1. For an a-line (attribute line) that looks like this: a=candidate:4234997325 1 udp 2043278322 192.168.0.56 44323 typ host the corresponding candidate string's value will be "candidate:4234997325 1 udp 2043278322 192.168.0.56 44323 typ host". The user agent always prefers candidates with the highest priority, all else being equal. In the example above, the priority is 2043278322. The attributes are all separa...
RTCIceCandidateInit.sdpMid - Web APIs
erty sdpMid in the RTCIceCandidateInit dictionary specifies the value of the RTCIceCandidate object's sdpMid property. Value A DOMString which uniquely identifies the source media component from which the candidate draws data, or null if no such association exists for the candidate. Note: Attempting to add a candidate (using addIceCandidate()) that has a value of null for either sdpMid or sdpMLineIndex will throw a TypeError exception. Example ... Specifications Specification Status Comment WebRTC 1.0: Real-time Communication Between BrowsersThe definition of 'RTCIceCandidateInit.sdpMid' in that specification. Candidate Recommendation Initial specification. ...
RTCIceCandidateInit - Web APIs
ndidate Optional The ICE candidate-attribute. If the candidate is an indicator that there are no further candidates (rather than representing a new candidate), this is the empty string (""). The default is the empty string. sdpMid Optional The identification tag of the media stream with which the candidate is associated, or null if there is no associated media stream. The default is null. sdpMLineIndex Optional The zero-based index of the m-line within the SDP of the media description with which the candidate is associated, or null if no such associated exists. The default is null. usernameFragment Optional A DOMString containing a string which uniquely identifies the remote peer. This string is generated by WebRTC at the beginning of the session, and at least 24 bits worth of the strin...
RTCIceCandidatePair.local - Web APIs
ionary specifies the RTCIceCandidate which describes the configuration of the local end of a viable WebRTC connection. Syntax localCandidate = RTCIceCandidatePair.local; Value An RTCIceCandidate which describes the configuration of the local end of a viable pair of ICE candidates. The RTCIceCandidatePair is returned by the RTCIceTransport method getSelectedCandidatePair(). Example This one-line example simply obtains the current candidate pair and then from that gets the local candidate. var candidatePair = pc.getSenders()[0].transport.transport.getSelectedCandidatePair(); var localCandidate = candidatePair.local; The RTCIceTransport is found by getting the list of RTCRtpSender objects for the RTCPeerConnection pc. In the first RTCRtpSender, we get the RTCDtlsTransport over which the ...
RTCIceCandidatePair.remote - Web APIs
tionary specifies the RTCIceCandidate describing the configuration of the remote end of a viable WebRTC connection. Syntax remoteCandidate = RTCIceCandidatePair.remote; Value An RTCIceCandidate which describes the configuration of the remote end of a viable pair of ICE candidates. The RTCIceCandidatePair is returned by the RTCIceTransport method getSelectedCandidatePair(). Example This one-line example simply obtains the current candidate pair and then from that gets the remote candidate. var candidatePair = pc.getSenders()[0].transport.transport.getSelectedCandidatePair(); var remoteCandidate = candidatePair.remote; The RTCIceTransport is found by getting the list of RTCRtpSender objects for the RTCPeerConnection pc. In the first RTCRtpSender, we get the RTCDtlsTransport over which t...
RTCIceCandidateType - Web APIs
Values These candidate types are listed in order of priority; the higher in the list they are, the more efficient they are. host The candidate is a host candidate, whose IP address as specified in the RTCIceCandidate.ip property is in fact the true address of the remote peer. ...
RTCIceComponent - Web APIs
The WebRTC API's RTCIceComponent enumerated type contains DOMString values that each identify a specific ICE component; these are "rtp" and "rtcp". These strings are mapped to corresponding numeric values as they appear in the candidate a-line in SDP. Values "rtp" Identifies an ICE transport which is being used for the Real-time Transport Protocol (RTP), or for RTP multiplexed with the RTP Control Protocol (RTCP). RTP is defined in RFC 3550. An RTCIceComponent of this value corresponds to the component ID field in the candidate a-line with the value 1. "rtcp" Identifies an ICE transport being used for RTCP, which is defined in RFC 3550, section 6. This value of RTCIceComponent corresponds to the component ID 2. Usage notes The RTCIceComponent type is used by the component property o...
RTCIceProtocol - Web APIs
Values tcp The candidate, if selected, would use TCP as the transport protocol for its data. The tcpType property provides additional information about the kind of TCP candidate represented by the object. udp The candidate will use the UDP transport protocol for its data. ...
RTCIceTransport.component - Web APIs
omponent = RTCIceTransport.component; Value A DOMString whose value comes from the enumerated type RTCIceComponent: "rtp" Identifies an ICE transport which is being used for the Real-time Transport Protocol (RTP), or for RTP multiplexed with the RTP Control Protocol (RTCP). RTP is defined in RFC 3550. An RTCIceComponent of this value corresponds to the component ID field in the candidate a-line with the value 1. "rtcp" Identifies an ICE transport being used for RTCP, which is defined in RFC 3550, section 6. This value of RTCIceComponent corresponds to the component ID 2. Specifications Specification Status Comment WebRTC 1.0: Real-time Communication Between BrowsersThe definition of 'RTCIceTransport.component' in that specification. Candidate Recommendati...
RTCIceTransportState - Web APIs
ailable again. It is not a failure state. Instead, you can think of "disconnected" as being similar to "checking" but with the added information that the connection had been working but at the moment is not. Every user agent and platform may have its own scenarios that can trigger the "disconnected" state. Possible causes include: The network interface being used by the connection has gone offline. STUN requests being sent to the remote device have gone unanswered repeatedly. The "disconnected" state can also occur when the transport has finished checking all existing candidate pairs and has not found a pair that will work--or a valid pair was found but rejected due to consent to use the pair being denied. In this scenario, the transport is still continuing to gather candidates, and/or ...
RTCInboundRtpStreamStats.averageRtcpInterval - Web APIs
ng the average RTCP transmission interval, in seconds. The RTCP interval is the amount of time that should elapse between transmissions of RTCP packets. Syntax var averageRtcpInterval = rtcInboundRtpStreamStats.averageRtcpInterval; Value A floating-point value indicating the average interval, in seconds, between transmissions of RTCP packets. This interval is computed following the formula outlined in RFC 1889: A.7. Because the interval's value is determined in part by the number of active senders, it will be different for each user of a service. Since this value is also used to determine the number of seconds after a stream starts to flow before the first RTCP packet should be sent, the result is that if many users try to start using the service at the same time, the server won't be floo...
RTCOutboundRtpStreamStats.averageRtcpInterval - Web APIs
dRtpStreamStats dictionary is a floating-point value indicating the average time that should pass between transmissions of RTCP packets on this stream. Syntax var averageRtcpInterval = RTCOutboundRtpStreamStats.averageRtcpInterval; Value A floating-point value indicating the average interval, in seconds, between transmissions of RTCP packets. This interval is computed following the formula outlined in RFC 1889: A.7. Because the interval's value is determined in part by the number of active senders, it will be different for each user of a service. Since this value is also used to determine the number of seconds after a stream starts to flow before the first RTCP packet should be sent, the result is that if many users try to start using the service at the same time, the server won't be floo...
RTCPeerConnection.onsignalingstatechange - Web APIs
signalingstatechange event. This event object doesn't provide details about what changed, but you can examine the signalingState property to determine what the new state is. You may also, as always, set up a handler for the signalingstatechange event using addEventListener(): myRTCPeerConnection.addEventListener("signalingstatechange", mySignalingStateChangeHandler); Or, using an anonymous (inline) handler: myRTCPeerConnection.addEventListener("signalingstatechange", event => { /* handle the event here */ }); Example This snippet shows a handler for signalingstatechange that looks for the "have-local-pranswer" signaling state--indicating that a remote offer has been received and a local description of type "pranswer" has been applied in response. pc.onsignalingstatechange = function(...
RTCPeerConnection.ontrack - Web APIs
eams the track is part of.. Example This example, taken from the code for the article Signaling and video calling, connects the incoming track to the <video> element which will be used to display the incoming video. pc.ontrack = function(event) { document.getElementById("received_video").srcObject = event.streams[0]; document.getElementById("hangup-button").disabled = false; }; The first line of our ontrack event handler takes the first stream in the incoming track and sets the srcobject attribute to that. This connects that stream of video to the element so that it begins to be presented to the user. The second line of code simply enables a "hang up" button, which the user can use to disconnect from the call. Specifications Specification Status Comment W...
RTCPeerConnection.setRemoteDescription() - Web APIs
onnection that's either fully established or is in the final stage of becoming connected. OperationError Any errors that occur which don't match the others specifeid here are reported as OperationError. This includes identity validation errors. RTCError An RTCError with the errorDetail set to sdp-syntax-error is reported if the SDP specified by RTCSessionDescription.sdp. The error object's sdpLineNumber property indicates the line number within the SDP on which the syntax error was detected. TypeError The specified RTCSessionDescriptionInit or RTCSessionDescription object is missing the type property, or no description parameter was provided at all. Usage notes When you call setRemoteDescription(), the ICE agent checks to make sure the RTCPeerConnection is in either the stable or have...
RTCRtpCapabilities - Web APIs
rsions of the standard available, but it will always end with fec. One possible value is video/ulpfec (a generic error connection model). There may also be multiple FEC entries if more than one form is supported. RTX (Retransmission) This component is responsible for retransmission of data; it's media type should be video/rtx. There will only be one entry for RTX, and it will not have an sdpFmtpLine property. 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. Specifications Specification Status Comment WebRTC 1.0: Real-time Communication Between BrowsersThe definition of 'RTCRtpCapabilities' in that specification. Candidate Recommendation ...
RTCRtpCodecCapability - Web APIs
ve a value of 1; stereo codecs would have a 2, etc. clockRate An unsigned long integer specifying the codec's clock rate in Hertz (Hz). The IANA maintains a list of codecs and their parameters, including their clock rates. mimeType A DOMString indicating the codec's MIME media type and subtype. See Codecs used by WebRTC for details about potential codecs that might be referenced here. sdpFmtpLine Optional A DOMString giving the format specific parameters field from the a=fmtp line in the SDP which corresponds to the codec, if such a line exists. If there is no parameters field, this property is left out. Description RTCRtpCodecCapabilities describes the basic parameters for a single codec supported by the user's device. An array of objects of this type is returned in the codecs proper...
RTCRtpCodecParameters - Web APIs
k rate is the rate at which the codec's RTP timestamp advances. Most codecs have specific values or ranges of values they permit; see the IANA payload format media type registry for details. channels Optional An unsigned short integer indicating the number of channels the codec should support. For example, for audio codecs, a value of 1 specifies monaural sound while 2 indicates stereo. sdpFmtpLine Optional A DOMString containing the format-specific parameters field from the "a=fmtp" line in the codec's SDP, if one is present; see section 5.8 of the IETF specification for JSEP. Note: On an RTCRtpReceiver, the format-specific parameters come from the SDP sent by the remote peer, while for RTCRtpSender, they're provided by the local description. ...
RTCRtpContributingSource.audioLevel - Web APIs
e defined in [RFC6465] if the RFC 6465 header extension is present, and otherwise null. Syntax var audioLevel = RTCRtpContributingSource.audioLevel Value A double-precision floating-point number which indicates the volume level of the audio in the most recently received RTP packet from the source described by the RTCRtpContributingSource. This value, which is in the range 0.0 to 1.0, is on a linear scale and its value is defined in dBov, or decibels (overload). This is the amplitude relative to the point at which clipping of the audio begins to occur. A value of 1.0 represents 0 dBov (maximum volume), a value of 0.0 represents silence, and a value of 0.5 represents approximately 6 dB SPL (decibels of sound pressure level) change in the sound pressure level from 0 dBov. For both RTCRtpCon...
RTCRtpTransceiver.direction - Web APIs
he new value of direction is in fact different from the existing value, renegotiation of the connection is required, so a negotiationneeded event is sent to the RTCPeerConnection. Effect on offers and answers The value of direction is used by RTCPeerConnection.createOffer() or RTCPeerConnection.createAnswer() in order to generate the SDP generated by each of those methods. The SDP contains an a-line which specifies the directionality. For example, if the direction is specified as "sendrecv", the corresponding SDP a-line is: a=sendrecv Specifications Specification Status Comment WebRTC 1.0: Real-time Communication Between BrowsersThe definition of 'RTCRtpTransceiver.direction' in that specification. Candidate Recommendation ...
RTCRtpTransceiver.mid - Web APIs
ansceiver interface's mid property specifies the negotiated media ID (mid) which the local and remote peers have agreed upon to uniquely identify the stream's pairing of sender and receiver. Syntax var mediaID = RTCRtpTransceiver.mid; Value A DOMString which uniquely identifies the pairing of source and destination of the transceiver's stream. Its value is taken from the media ID of the SDP m-line. This value is null if negotiation has not completed. Specifications Specification Status Comment WebRTC 1.0: Real-time Communication Between BrowsersThe definition of 'RTCRtpTransceiver.mid' in that specification. Candidate Recommendation ...
Range.surroundContents() - Web APIs
, however, if the Range splits a non-Text node with only one of its boundary points. That is, unlike the alternative above, if there are partially selected nodes, they will not be cloned and instead the operation will fail. Syntax range.surroundContents(newParent); Parameters newParent A Node with which to surround the contents. Example HTML <span class="header-text">Put this in a headline</span> JavaScript const range = document.createRange(); const newParent = document.createElement('h1'); range.selectNode(document.querySelector('.header-text')); range.surroundContents(newParent); Result Specifications Specification Status Comment DOMThe definition of 'Range.surroundContents()' in that specification. Living Standard No change. Docume...
ResizeObserver - Web APIs
input[type="range"]'); const checkbox = document.querySelector('input[type="checkbox"]'); divElem.style.width = '600px'; slider.addEventListener('input', () => { divElem.style.width = slider.value + 'px'; }) const resizeObserver = new ResizeObserver(entries => { for (const entry of entries) { if (entry.contentBoxSize) { h1Elem.style.fontSize = Math.max(1.5, entry.contentBoxSize.inlineSize / 200) + 'rem'; pElem.style.fontSize = Math.max(1, entry.contentBoxSize.inlineSize / 600) + 'rem'; } else { h1Elem.style.fontSize = Math.max(1.5, entry.contentRect.width / 200) + 'rem'; pElem.style.fontSize = Math.max(1, entry.contentRect.width / 600) + 'rem'; } } }); resizeObserver.observe(divElem); checkbox.addEventListener('change', () => { if (checkbox.chec...
ResizeObserverEntry.target - Web APIs
he box size. To grab a reference to the observed element so we can update its border-radius value after each change, we make use of the target property of each entry -- entry.target.style.borderRadius. ...
Resize Observer API - Web APIs
at 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
The Resource Timing API provides a way to retrieve and analyze detailed network timing data regarding the loading of an application's resource(s). An application can use the timing metrics to determine, for example, the length of time it takes to fetch a specific resource such as an XMLHttpRequest, <SVG>, image, script, etc.). The interface's properties create a resource loading timeline with high-resolution timestamps for network events such as redirect start and end times, fetch start, DNS lookup start and end times, response start and end times, etc. The interface also includes other properties that provide data about the size of the fetched resource as well as the type of resource that initiated the fetch. This document shows the use of Resource Timing interfaces. For more details about...
Resource Timing API - Web APIs
The Resource Timing interfaces enable retrieving and analyzing detailed network timing data regarding the loading of an application's resource(s). An application can use the timing metrics to determine, for example, the length of time it takes to load a specific resource, such as an XMLHttpRequest, <SVG>, image, or script. The interface's properties create a resource loading timeline with high-resolution timestamps for network events such as redirect start and end times, DNS lookup start and end times, request start, response start and end times, etc. The interface also includes other properties that provide data about the size of the fetched resource as well as the type of resource that initiated the fetch. This document provides an overview of the Resource Timing interfaces. For more deta...
SVGAnimationElement: beginEvent event - Web APIs
The beginEvent event of the SVGAnimationElement interface is fired when the element local timeline begins to play. It will be raised each time the element begins the active duration (i.e., when it restarts, but not when it repeats). It may be raised both in the course of normal (i.e. scheduled or interactive) timeline play, as well as in the case that the element was begun with a DOM method. Bubbles No Cancelable No Interface TimeEvent Event handler property onbegin Examples Animated circle <svg xmlns="http://www.w3.org/2000/svg" width="300px" height="100px"> <title>SVG SMIL Animate with Path</title> <circle cx="0" cy="50" r="50" fill="blue" stroke="black" stroke-width="1"> <animateMotion path="M 0 0 H 300 Z" dur...
SVGAnimationElement: endEvent event - Web APIs
The endEvent event of the SVGAnimationElement interface is fired when at the active end of the animation is reached. Note: This event is not raised at the simple end of each animation repeat. This event may be raised both in the course of normal (i.e. scheduled or interactive) timeline play, as well as in the case that the element was ended with a DOM method. Bubbles No Cancelable No Interface TimeEvent Event handler property onend Examples Animated circle <svg xmlns="http://www.w3.org/2000/svg" width="300px" height="100px"> <title>SVG SMIL Animate with Path</title> <circle cx="0" cy="50" r="50" fill="blue" stroke="black" stroke-width="1"> <animateMotion path="M 0 0 H 300 Z" dur="5s" repeatCount="indefinite" />...
SVGAnimationElement: repeatEvent event - Web APIs
It will be fired each time the element repeats, after the first iteration. Note: Associated with the repeatEvent event is an integer that indicates which repeat iteration is beginning; this can be found in the detail property of the event object. The value is a 0-based integer, but the repeat event is not raised for the first iteration and so the observed values will be >= 1. This is supported in Firefox, but not in Chrome. ...
SVGDocument - Web APIs
SVG document interface When an "svg" element is embedded inline as a component of a document from another namespace, such as when an "svg" element is embedded inline within an XHTML document, then an SVGDocument object will not exist; instead, the root object in the document object hierarchy will be a Document object of a different type, such as an HTMLDocument object. Interface overview Also implement None Methods None Properties DOMString domain DOMString referrer SVGSVGElement rootElement DOMString title DOMString URL ...
SecurityPolicyViolationEvent.SecurityPolicyViolationEvent() - Web APIs
included, the default value is "". columnNumber: The columnNumber of the SecurityPolicyViolationEvent. If not included, the default value is 0. disposition: The disposition of the SecurityPolicyViolationEvent (required). documentURI: The documentURI of the SecurityPolicyViolationEvent (required). effectiveDirective: The effectiveDirective of the SecurityPolicyViolationEvent (required). lineNumber: The lineNumber of the SecurityPolicyViolationEvent. If not included, the default value is 0. originalPolicy: The originalPolicy of the SecurityPolicyViolationEvent (required). referrer: The referrer of the SecurityPolicyViolationEvent. If not included, the default value is "". sample: The sample of the SecurityPolicyViolationEvent. If not included, the default value is "". sourceFi...
SecurityPolicyViolationEvent.sample - Web APIs
The sample read-only property of the SecurityPolicyViolationEvent interface is a DOMString representing a sample of the resource that caused the violation. Syntax let sample = violationEventInstance.sample; Value A DOMString containing a sample of the resource that caused the violation, usually the first 40 characters. This will only be populated if the resource is an inline script, event handler, or style -- external resources causing a violation will not generate a sample. Example document.addEventListener("securitypolicyviolation", (e) => { console.log(e.sample); }); Specifications Specification Status Comment Content Security Policy Level 3The definition of 'sample' in that specification. Working Draft Initial definition ...
Sensor - Web APIs
Web › API › Sensor
aces that inherit from it. If a feature policy blocks use of a feature it is because your code is inconsistent with the policies set on your server. This is not something that would ever be shown to a user. See Feature-Policy for implementation instructions. Interfaces based on Sensor Below is a list of interfaces based on the Sensor interface. Accelerometer AmbientLightSensor Gyroscope LinearAccelerationSensor Magnetometer OrientationSensor Properties Sensor.activated Read only Returns a Boolean indicating whether the sensor is active. Sensor.hasReading Read only Returns a Boolean indicating whether the sensor has a reading. Sensor.timestamp Read only Returns the time stamp of the latest sensor reading. Event handlers Sensor.onerror Called when an error occurs ...
ServiceWorkerGlobalScope: install event - Web APIs
a new ServiceWorkerRegistration.installing worker. ...
ServiceWorkerGlobalScope.oninstall - Web APIs
Scope interface is an event handler fired whenever an install event occurs (when the service worker installs). This happens before activation. Syntax ServiceWorkerGlobalScope.oninstall = function(event) { ... ...
ServiceWorkerGlobalScope: pushsubscriptionchange event - Web APIs
Consider using another method to synchronize subscription information between your service worker and the app server, or make sure your code using fetch() is robust enough to handle cases where attempts to exchange data fail. Note: In earlier drafts of the specification, this event was defined to be sent when a PushSubscription has expired. Examples This example, run in the co...
ServiceWorkerRegistration.index - Web APIs
Syntax var A ContentIndex object = ServiceWorkerRegistration.index; Value A ContentIndex Object Examples You can access the property from either your main script or the registered service worker. ...
ServiceWorkerRegistration.showNotification() - Web APIs
cation that allows you to find, replace, or remove the notification using a script if necessary. timestamp: A DOMTimeStamp representing the time when the notification was created. It can be used to indicate the time at which a notification is actual. For example, this could be in the past when a notification is used for a message that couldn't immediately be delivered because the device was offline, or in the future for a meeting that is about to start. vibrate: A vibration pattern to run with the display of the notification. A vibration pattern can be an array with as few as one member. The values are times in milliseconds where the even indices (0, 2, 4, etc.) indicate how long to vibrate and the odd indices indicate how long to pause. For example, [300, 100, 400] would vibrate 300ms, p...
ServiceWorkerRegistration - Web APIs
aging push subscriptions including subscribing, getting an active subscription, and accessing push permission status. ServiceWorkerRegistration.sync Read only Returns a reference to the SyncManager interface, which manages background synchronization processes. ServiceWorkerRegistration.index Read only Returns a reference to the ContentIndex interface, for managing indexed content for offline viewing. Unimplemented properties serviceWorkerRegistration.periodicSync Read only Returns a reference to the PeriodicSyncManager interface, which manages periodic background synchronization processes. This was mentioned as an idea in the SW explainer at some point, but as yet has not been implemented anywhere. Event handlers ServiceWorkerRegistration.onupdatefound Read only An Ev...
SharedWorkerGlobalScope.applicationCache - Web APIs
The applicationCache read-only property of the SharedWorkerGlobalScope interface returns the ApplicationCache object for the worker (see Using the application cache). Syntax var nameObj = self.applicationCache; Value An ApplicationCache. ...
SpeechGrammar.SpeechGrammar() - Web APIs
echGrammar interface creates a new SpeechGrammar object instance. Syntax var mySpeechGrammar = new SpeechGrammar(); Parameters None. ...
SpeechGrammarList.SpeechGrammarList() - Web APIs
ring method, and set it to be the grammar that will be recognised by the SpeechRecognition instance using the SpeechRecognition.grammars property. ...
SpeechGrammarList.addFromString() - Web APIs
will be recognised by the speech recognition service. The value can be between 0.0 and 1.0; If not specified, the default used is 1.0. ...
SpeechGrammarList.addFromURI() - Web APIs
will be recognised by the speech recognition service. The value can be between 0.0 and 1.0; If not specified, the default used is 1.0. ...
SpeechGrammarList.length - Web APIs
= speechGrammarListInstance.length; Value A number indicating the number of SpeechGrammar objects contained in the SpeechGrammarList. ...
SpeechGrammarList - Web APIs
ring method, and set it to be the grammar that will be recognised by the SpeechRecognition instance using the SpeechRecognition.grammars property. ...
SpeechRecognition() - Web APIs
Syntax var myRecognition = new SpeechRecognition(); Parameters None. Examples This code is excerpted from our Speech color changer example. ...
SpeechRecognition.abort() - Web APIs
audio, and doesn't attempt to return a SpeechRecognitionResult. Syntax mySpeechRecognition.abort(); Returns Void. Parameters None. ...
SpeechRecognition.continuous - Web APIs
ans continuous, and false means not continuous (single result each time.) Examples This code is excerpted from our Speech color changer example. ...
SpeechRecognition.grammars - Web APIs
ining the SpeechGrammar objects that represent your grammar for your app. Examples This code is excerpted from our Speech color changer example. ...
SpeechRecognition.interimResults - Web APIs
ts. true means interim results are returned, and false means they aren't. Examples This code is excerpted from our Speech color changer example. ...
SpeechRecognition.lang - Web APIs
g representing the BCP 47 language tag for the current SpeechRecognition. Examples This code is excerpted from our Speech color changer example. ...
SpeechRecognition.maxAlternatives - Web APIs
A number representing the maximum returned alternatives for each result. Examples This code is excerpted from our Speech color changer example. ...
SpeechRecognition.start() - Web APIs
ze grammars associated with the current SpeechRecognition. Syntax mySpeechRecognition.start(); Parameters None. Return value Void. ...
SpeechRecognition.stop() - Web APIs
eturn a SpeechRecognitionResult using the audio captured so far. Syntax mySpeechRecognition.stop(); Returns Void. Parameters None. ...
StylePropertyMapReadOnly - Web APIs
e have to have an element to observe: <p> This is a paragraph with some text. We can add some CSS, or not. The style map will include all the default and inherted CSS property values. </p> <dl id="output"></dl> We add a touch of CSS with a custom property to better demonstrate the output: p { --someVariable: 1.6em; --someOtherVariable: translateX(33vw); --anotherVariable: 42; line-height: var(--someVariable); } We add JavaScript to grab our paragraph and return back a definition list of all the default CSS property values using computedStyleMap(). // get the element const myElement = document.querySelector('p'); // get the <dl> we'll be populating const stylesList = document.querySelector('#output'); // Retrieve all computed styles with computedStyleMap() const stylePr...
StyleSheet.disabled - Web APIs
the document. A style sheet may be disabled by manually setting this property to true or if it's an inactive alternative style sheet. Note that disabled == false does not guarantee the style sheet is applied (it could be removed from the document, for instance). Syntax bool = stylesheet.disabled Example // If the stylesheet is disabled... if (stylesheet.disabled) { // ... apply styles in-line. } Specification Specification Status Comment CSS Object Model (CSSOM)The definition of 'StyleSheet.disabled' in that specification. Working Draft No change from Document Object Model (DOM) Level 2 Style Specification. Document Object Model (DOM) Level 2 Style SpecificationThe definition of 'StyleSheet.disabled' in that specification. Obsolete Initi...
Stylesheet.href - Web APIs
Web › API › StyleSheet › href
This property is read-only in Firefox, Opera, Google Chrome, and Safari, and it is read/write in Internet Explorer. Specifications Specification Status Comment CSS Object Model (CSSOM)The definition of 'StyleSheet: href' in that specification. Working Draft ...
SubtleCrypto.importKey() - Web APIs
rn buf; } const pemEncodedKey = `-----BEGIN PUBLIC KEY----- MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAy3Xo3U13dc+xojwQYWoJLCbOQ5fOVY8LlnqcJm1W1BFtxIhOAJWohiHuIRMctv7dzx47TLlmARSKvTRjd0dF92jx/xY20Lz+DXp8YL5yUWAFgA3XkO3LSJgEOex10NB8jfkmgSb7QIudTVvbbUDfd5fwIBmCtaCwWx7NyeWWDb7A9cFxj7EjRdrDaK3ux/ToMLHFXVLqSL341TkCf4ZQoz96RFPUGPPLOfvN0x66CM1PQCkdhzjE6U5XGE964ZkkYUPPsy6Dcie4obhW4vDjgUmLzv0z7UD010RLIneUgDE2FqBfY/C+uWigNPBPkkQ+Bv/UigS6dHqTCVeD5wgyBQIDAQAB -----END PUBLIC KEY-----`; function importRsaKey(pem) { // fetch the part of the PEM string between header and footer const pemHeader = "-----BEGIN PUBLIC KEY-----"; const pemFooter = "-----END PUBLIC KEY-----"; const pemContents = pem.substring(pemHeader.length, pem.length - pemFooter.length); // base64 decode the string...
TextMetrics.actualBoundingBoxAscent - Web APIs
The read-only actualBoundingBoxAscent property of the TextMetrics interface is a double giving the distance from the horizontal line indicated by the CanvasRenderingContext2D.textBaseline attribute to the top of the bounding rectangle used to render the text, in CSS pixels. Examples const canvas = document.createElement('canvas'); const ctx = canvas.getContext('2d'); const text = ctx.measureText('foo'); // returns TextMetrics object text.actualBoundingBoxAscent; // 8; Specifications Specification HTML Living StandardThe definition of 'TextMetrics.actualBoundingBoxAscent' in that specification. ...
TextMetrics.actualBoundingBoxDescent - Web APIs
The read-only actualBoundingBoxDescent property of the TextMetrics interface is a double giving the distance from the horizontal line indicated by the CanvasRenderingContext2D.textBaseline attribute to the bottom of the bounding rectangle used to render the text, in CSS pixels. Examples const canvas = document.createElement('canvas'); const ctx = canvas.getContext('2d'); const text = ctx.measureText('foo'); // returns TextMetrics object text.actualBoundingBoxDescent; // 0; Specifications Specification HTML Living StandardThe definition of 'TextMetrics.actualBoundingBoxDescent' in that specification. ...
TextMetrics.actualBoundingBoxLeft - Web APIs
The read-only actualBoundingBoxLeft property of the TextMetrics interface is a double giving the distance parallel to the baseline from the alignment point given by the CanvasRenderingContext2D.textAlign property to the left side of the bounding rectangle of the given text, in CSS pixels. Examples const canvas = document.createElement('canvas'); const ctx = canvas.getContext('2d'); const text = ctx.measureText('foo'); // returns TextMetrics object text.actualBoundingBoxLeft; // 0; Specifications Specification HTML Living StandardThe definition of 'TextMetrics.actualBoundingBoxLeft' in that specification. ...
TextMetrics.actualBoundingBoxRight - Web APIs
The read-only actualBoundingBoxRight property of the TextMetrics interface is a double giving the distance parallel to the baseline from the alignment point given by the CanvasRenderingContext2D.textAlign property to the right side of the bounding rectangle of the given text, in CSS pixels. Examples const canvas = document.createElement('canvas'); const ctx = canvas.getContext('2d'); const text = ctx.measureText('foo'); // returns TextMetrics object text.actualBoundingBoxRight; // 15.633333333333333; Specifications Specification HTML Living StandardThe definition of 'TextMetrics.actualBoundingBoxRight' in that specification. ...
TextMetrics.emHeightAscent - Web APIs
The read-only emHeightAscent property of the TextMetrics interface is a double giving the distance from the horizontal line indicated by the CanvasRenderingContext2D.textBaseline property to the top of the em square in the line box, in CSS pixels. Examples const canvas = document.createElement('canvas'); const ctx = canvas.getContext('2d'); const text = ctx.measureText('foo'); // returns TextMetrics object text.emHeightAscent; // 7.59765625; Specifications Specification HTML Living StandardThe definition of 'TextMetrics.emHeightAscent' in that specification. ...
TextMetrics.emHeightDescent - Web APIs
The read-only emHeightDescent property of the TextMetrics interface is a double giving the distance from the horizontal line indicated by the CanvasRenderingContext2D.textBaseline property to the bottom of the em square in the line box, in CSS pixels. Examples const canvas = document.createElement('canvas'); const ctx = canvas.getContext('2d'); const text = ctx.measureText('foo'); // returns TextMetrics object text.emHeightDescent; // -2.40234375; Specifications Specification HTML Living StandardThe definition of 'TextMetrics.emHeightDescent' in that specification. ...
TextMetrics.fontBoundingBoxAscent - Web APIs
The read-only fontBoundingBoxAscent property of the TextMetrics interface is a double giving the distance from the horizontal line indicated by the CanvasRenderingContext2D.textBaseline attribute to the top of the highest bounding rectangle of all the fonts used to render the text, in CSS pixels. Examples const canvas = document.createElement('canvas'); const ctx = canvas.getContext('2d'); const text = ctx.measureText('foo'); // returns TextMetrics object text.fontBoundingBoxAscent; // 10; Specifications Specification HTML Living StandardThe definition of 'TextMetrics.fontBoundingBoxAscent' in that specification. ...
TextMetrics.fontBoundingBoxDescent - Web APIs
The read-only fontBoundingBoxDescent property of the TextMetrics interface is a double giving the distance from the horizontal line indicated by the CanvasRenderingContext2D.textBaseline attribute to the bottom of the bounding rectangle of all the fonts used to render the text, in CSS pixels. Examples const canvas = document.createElement('canvas'); const ctx = canvas.getContext('2d'); const text = ctx.measureText('foo'); // returns TextMetrics object text.fontBoundingBoxDescent; // 3; Specifications Specification HTML Living StandardThe definition of 'TextMetrics.fontBoundingBoxDescent' in that specification. ...
TextMetrics.width - Web APIs
Web › API › TextMetrics › width
Examples Given this <canvas> element: <canvas id="canvas"></canvas> ... ...
URLSearchParams - Web APIs
Constructor URLSearchParams() Returns a URLSearchParams object instance. Methods URLSearchParams.append() Appends a specified key/value pair as a new search parameter. ...
USBEndpoint - Web APIs
ted by other data traffic. "interrupt" - Provides reliable data transfer for small payloads. Data sent through an interrupt endpoint is guaranteed to be delivered or generate an error and is also given dedicated bus time for transmission. "isochronous" - Provides unreliable data transfer for payloads that must be delivered periodically. They are given dedicated bus time but if a deadline is missed the data is dropped. USBEndpoint.packetSize Returns the size of the packets that data sent through this endpoint will be divided into. Examples While sometimes the developer knows ahead of time the exact layout of a device's endpoints there are cases where this must be discovered at runtime. For example, a USB serial device must provide bulk input and output endpoints but th...
Videotrack.language - Web APIs
Syntax var videoTrackLanguage = VideoTrack.language; Value A DOMString specifying the BCP 47 (RFC 5646) format language tag of the primary language used in the video track, or an empty string ("") if the language is not specified or known, or if the track doesn't contain speech. ...
WEBGL_compressed_texture_s3tc_srgb - Web APIs
PRESSED_SRGB_ALPHA_S3TC_DXT5_EXT A DXT5-compressed image in an sRGBA image format. Examples var ext = gl.getExtension('WEBGL_compressed_texture_s3tc_srgb'); var texture = gl.createTexture(); gl.bindTexture(gl.TEXTURE_2D, texture); gl.compressedTexImage2D(gl.TEXTURE_2D, 0, ext.COMPRESSED_SRGB_S3TC_DXT1_EXT, 512, 512, 0, textureData); gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR); gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR); Specifications Specification Status Comment WEBGL_compressed_texture_s3tc_srgbThe definition of 'WEBGL_compressed_texture_s3tc_srgb' in that specification. Recommendation Initial definition. ...
WaveShaperNode.WaveShaperNode() - Web APIs
Syntax var waveShaperNode = new WaveShaperNode(context, options) Parameters Inherits parameters from the AudioNodeOptions dictionary. context A reference to an AudioContext. options Optional Options are as follows: curve: The shaping curve used for the waveshaping effect. The input signal is nominally within the range [-1;1]. oversample: Specifies what type of oversampling (if any) should be used when applying the shaping curve. Valid values are 'none', '2x', or '4x'. The default is 'none'. ...
WaveShaperNode.curve - Web APIs
The curve property of the WaveShaperNode interface is a Float32Array of numbers describing the distortion to apply. The mid-element of the array is applied to any signal value of 0, the first one to signal values of -1, and the last to signal values of 1; values lower than -1 or greater than 1 are treated like -1 or 1 respectively. If necessary, intermediate values of the distortion curve are linearly interpolated. Note: The array can be a null value: in that case, no distortion is applied to the input signal. Syntax var audioCtx = new AudioContext(); var distortion = audioCtx.createWaveShaper(); distortion.curve = myCurveDataArray; // myCurveDataArray is a Float32Array Value A Float32Array. Example The following example shows basic usage of an AudioContext to create a wave shaper...
WaveShaperNode - Web APIs
It is an AudioNode that uses a curve to apply a wave shaping distortion to the signal. Beside obvious distortion effects, it is often used to add a warm feeling to the signal. A WaveShaperNode always has exactly one input and one output. Number of inputs 1 Number of outputs 1 Channel count mode "max" Channel count 2 (not used in the default count mode) Channel interpretation "speakers" Constructor WaveShaperNode() Creates a new instance of an WaveShaperNode object. Properties Inherits properties from its parent, AudioNode. ...
WebGL2RenderingContext.beginTransformFeedback() - Web APIs
The WebGL2RenderingContext.beginTransformFeedback() method of the WebGL 2 API starts a transform feedback operation. Syntax void gl.beginTransformFeedback(primitiveMode); Parameters primitiveMode A GLenum specifying the output type of the primitives that will be recorded into the buffer objects that are bound for transform feedback. Possible values: gl.POINTS gl.LINES gl.TRIANGLES Return value None. Examples var transformFeedback = gl.createTransformFeedback(); gl.bindTransformFeedback(gl.TRANSFORM_FEEDBACK, transformFeedback); gl.beginTransformFeedback(gl.TRIANGLES); gl.drawArrays(gl.TRIANGLES, 0, 3); Specifications Specification Status Comment WebGL 2.0The definition of 'beginTransformFeedback' in that specification. Editor's ...
WebGL2RenderingContext.blitFramebuffer() - Web APIs
e. dstX0, dstY0, dstX1, dstY1 A GLint specifying the bounds of the destination rectangle. mask A GLbitfield specifying a bitwise OR mask indicating which buffers are to be copied. Possible values: gl.COLOR_BUFFER_BIT gl.DEPTH_BUFFER_BIT gl.STENCIL_BUFFER_BIT filter A GLenum specifying the interpolation to be applied if the image is stretched. Possible values: gl.NEAREST gl.LINEAR Return value None. Examples gl.blitFramebuffer(0, 0, canvas.width, canvas.height, 0, 0, canvas.width, canvas.height, gl.COLOR_BUFFER_BIT, gl.NEAREST); Specifications Specification Status Comment WebGL 2.0The definition of 'blitFramebuffer' in that specification. Editor's Draft Initial definition for WebGL. ...
WebGL2RenderingContext.drawArraysInstanced() - Web APIs
e gl.drawArrays() method. In addition, it can execute multiple instances of the range of elements. Note: When using WebGL 1, the ANGLE_instanced_arrays extension can provide this method, too. Syntax void gl.drawArraysInstanced(mode, first, count, instanceCount); Parameters mode A GLenum specifying the type primitive to render. Possible values are: gl.POINTS: Draws a single dot. gl.LINE_STRIP: Draws a straight line to the next vertex. gl.LINE_LOOP: Draws a straight line to the next vertex, and connects the last vertex back to the first. gl.LINES: Draws a line between a pair of vertices. gl.TRIANGLE_STRIP gl.TRIANGLE_FAN gl.TRIANGLES: Draws a triangle for a group of three vertices. first A GLint specifying the starting index in the array of vector points. count ...
WebGL2RenderingContext.drawElementsInstanced() - Web APIs
wElements() method. In addition, it can execute multiple instances of a set of elements. Note: When using WebGL 1, the ANGLE_instanced_arrays extension can provide this method, too. Syntax void gl.drawElementsInstanced(mode, count, type, offset, instanceCount); Parameters mode A GLenum specifying the type primitive to render. Possible values are: gl.POINTS: Draws a single dot. gl.LINE_STRIP: Draws a straight line to the next vertex. gl.LINE_LOOP: Draws a straight line to the next vertex, and connects the last vertex back to the first. gl.LINES: Draws a line between a pair of vertices. gl.TRIANGLE_STRIP gl.TRIANGLE_FAN gl.TRIANGLES: Draws a triangle for a group of three vertices. count A GLsizei specifying the number of elements to be rendered. type A GLenum s...
WebGL2RenderingContext.drawRangeElements() - Web APIs
The WebGL2RenderingContext.drawRangeElements() method of the WebGL API renders primitives from array data in a given range. Syntax void gl.drawRangeElements(mode, start, end, count, type, offset); Parameters mode A GLenum specifying the type primitive to render. Possible values are: gl.POINTS: Draws a single dot. gl.LINE_STRIP: Draws a straight line to the next vertex. gl.LINE_LOOP: Draws a straight line to the next vertex, and connects the last vertex back to the first. gl.LINES: Draws a line between a pair of vertices. gl.TRIANGLE_STRIP gl.TRIANGLE_FAN gl.TRIANGLES: Draws a triangle for a group of three vertices. start A GLuint specifying the minimum array index contained in offset. end A GLuint specifying the maximum array index contained in offset...
WebGL2RenderingContext.vertexAttribIPointer() - Web APIs
Return value None. Description Very similar to WebGLRenderingContext.vertexAttribPointer(). The main difference is that while values specified by vertexAttribPointer are always interpreted as floating-point values in the shader (even if they were originally specified as integers in the buffer), this method allows specifying values which are interpreted as integers in the shader. Examples Linear Blend Skinning //Describe the layout of the buffer: //1. position gl.vertexAttribPointer(0, 3, gl.FLOAT, false, 20, 0); gl.enableVertexAttribArray(0); //2. bone weights, normalized to [0, 1] gl.vertexAttribPointer(1, 4, gl.UNSIGNED_BYTE, true, 20, 12); gl.enableVertexAttribArray(1); //3. bone indices, interpreted as integer gl.vertexAttribIPointer(2, 4, gl.UNSIGNED_BYTE, 20, 16); gl.enableVert...
WebGLRenderingContext.drawArrays() - Web APIs
The WebGLRenderingContext.drawArrays() method of the WebGL API renders primitives from array data. Syntax void gl.drawArrays(mode, first, count); Parameters mode A GLenum specifying the type primitive to render. Possible values are: gl.POINTS: Draws a single dot. gl.LINE_STRIP: Draws a straight line to the next vertex. gl.LINE_LOOP: Draws a straight line to the next vertex, and connects the last vertex back to the first. gl.LINES: Draws a line between a pair of vertices. gl.TRIANGLE_STRIP gl.TRIANGLE_FAN gl.TRIANGLES: Draws a triangle for a group of three vertices. first A GLint specifying the starting index in the array of vector points. count A GLsizei specifying the number of indices to be rendered. Return value None. Exceptions If mode is not one of ...
WebGLRenderingContext.drawElements() - Web APIs
The WebGLRenderingContext.drawElements() method of the WebGL API renders primitives from array data. Syntax void gl.drawElements(mode, count, type, offset); Parameters mode A GLenum specifying the type primitive to render. Possible values are: gl.POINTS: Draws a single dot. gl.LINE_STRIP: Draws a straight line to the next vertex. gl.LINE_LOOP: Draws a straight line to the next vertex, and connects the last vertex back to the first. gl.LINES: Draws a line between a pair of vertices. gl.TRIANGLE_STRIP gl.TRIANGLE_FAN gl.TRIANGLES: Draws a triangle for a group of three vertices. count A GLsizei specifying the number of elements to be rendered. type A GLenum specifying the type of the values in the element array buffer. Possible values are: gl.UNSIGNED_BYTE g...
WebGLRenderingContext.drawingBufferHeight - Web APIs
sents the actual height of the current drawing buffer. It should match the height attribute of the <canvas> element associated with this context, but might differ if the implementation is not able to provide the requested height. Syntax gl.drawingBufferHeight; Examples Given this <canvas> element: <canvas id="canvas"></canvas> You can get the height of the drawing buffer with the following lines: var canvas = document.getElementById('canvas'); var gl = canvas.getContext('webgl'); gl.drawingBufferHeight; // 150 Specifications Specification Status Comment WebGL 1.0The definition of 'WebGLRenderingContext.drawingBufferHeight' in that specification. Recommendation Initial definition. ...
WebGLRenderingContext.drawingBufferWidth - Web APIs
represents the actual width of the current drawing buffer. It should match the width attribute of the <canvas> element associated with this context, but might differ if the implementation is not able to provide the requested width. Syntax gl.drawingBufferWidth; Examples Given this <canvas> element: <canvas id="canvas"></canvas> You can get the width of the drawing buffer with the following lines: var canvas = document.getElementById('canvas'); var gl = canvas.getContext('webgl'); gl.drawingBufferWidth; // 300 Specifications Specification Status Comment WebGL 1.0The definition of 'WebGLRenderingContext.drawingBufferWidth' in that specification. Recommendation Initial definition. ...
WebGLRenderingContext.getExtension() - Web APIs
s EXT_blend_minmax EXT_color_buffer_float EXT_color_buffer_half_float EXT_disjoint_timer_query EXT_float_blend EXT_frag_depth EXT_sRGB EXT_shader_texture_lod EXT_texture_compression_bptc EXT_texture_compression_rgtc EXT_texture_filter_anisotropic KHR_parallel_shader_compile OES_element_index_uint OES_fbo_render_mipmap OES_standard_derivatives OES_texture_float OES_texture_float_linear OES_texture_half_float OES_texture_half_float_linear OES_vertex_array_object OVR_multiview2 WEBGL_color_buffer_float WEBGL_compressed_texture_astc WEBGL_compressed_texture_atc WEBGL_compressed_texture_etc WEBGL_compressed_texture_etc1 WEBGL_compressed_texture_pvrtc WEBGL_compressed_texture_s3tc WEBGL_compressed_texture_s3tc_srgb WEBGL_debug_renderer_info WEBGL_debug_shaders WEBGL...
WebGLRenderingContext.getSupportedExtensions() - Web APIs
s EXT_blend_minmax EXT_color_buffer_float EXT_color_buffer_half_float EXT_disjoint_timer_query EXT_float_blend EXT_frag_depth EXT_sRGB EXT_shader_texture_lod EXT_texture_compression_bptc EXT_texture_compression_rgtc EXT_texture_filter_anisotropic KHR_parallel_shader_compile OES_element_index_uint OES_fbo_render_mipmap OES_standard_derivatives OES_texture_float OES_texture_float_linear OES_texture_half_float OES_texture_half_float_linear OES_vertex_array_object OVR_multiview2 WEBGL_color_buffer_float WEBGL_compressed_texture_astc WEBGL_compressed_texture_atc WEBGL_compressed_texture_etc WEBGL_compressed_texture_etc1 WEBGL_compressed_texture_pvrtc WEBGL_compressed_texture_s3tc WEBGL_compressed_texture_s3tc_srgb WEBGL_debug_renderer_info WEBGL_debug_shaders WEBGL...
WebGLRenderingContext.getTexParameter() - Web APIs
gl.TEXTURE_3D: A three-dimensional texture. gl.TEXTURE_2D_ARRAY: A two-dimensional array texture. pname A Glenum specifying the information to query. Possible values: pname Return type Description Possible return values Available in a WebGL 1 context gl.TEXTURE_MAG_FILTER GLenum Texture magnification filter gl.LINEAR (default value), gl.NEAREST. gl.TEXTURE_MIN_FILTER GLenum Texture minification filter gl.LINEAR, gl.NEAREST, gl.NEAREST_MIPMAP_NEAREST, gl.LINEAR_MIPMAP_NEAREST, gl.NEAREST_MIPMAP_LINEAR (default value), gl.LINEAR_MIPMAP_LINEAR. gl.TEXTURE_WRAP_S GLenum Wrapping function for texture coordinate s gl.REPEAT (default value), gl.CLAMP_TO_EDGE, gl.MIRR...
Canvas size and WebGL - Web APIs
y specifying its position and size in pixels. In the first canvas, we get the desired result. In the second, the square has the wrong shape, size, and position. ...
Clearing by clicking - Web APIs
The event handler removes // itself, because it only needs to run once. window.removeEventListener(evt.type, setupWebGL, false); // Adding the same click event handler to both canvas and // button. var canvas = ...
Raining rectangles - Web APIs
iented approach for the displayed rectangles, which helps to keep the state of the rectangle (its position, color, and so on) organized in one place, and the overall code more compact and reusable. This example combines clearing the drawing buffer with solid colors and scissoring operations. It is a preview of a full graphical application that manipulates various phases of the WebGL graphics pipeline and state machine. In addition, the example demonstrates how to integrate the WebGL function calls within a game loop. The game loop is responsible for drawing the animation frames, and keeping the animation responsive to user input. Here, the game loop is implemented using timeouts. <p>You caught <strong>0</strong>. You missed <strong>0</strong>.</p> <canvas>Your browser does not seem t...
Simple color animation - Web APIs
var timer; // Click event handlers. var button = document.querySelector("#animation-onoff"); var verb = document.query...
Animating textures in WebGL - Web APIs
width, height, border, srcFormat, srcType, pixel); // Turn off mips and set wrapping to clamp to edge so it // will work regardless of the dimensions of the video. ...
Using WebGL extensions - Web APIs
s EXT_blend_minmax EXT_color_buffer_float EXT_color_buffer_half_float EXT_disjoint_timer_query EXT_float_blend EXT_frag_depth EXT_sRGB EXT_shader_texture_lod EXT_texture_compression_bptc EXT_texture_compression_rgtc EXT_texture_filter_anisotropic KHR_parallel_shader_compile OES_element_index_uint OES_fbo_render_mipmap OES_standard_derivatives OES_texture_float OES_texture_float_linear OES_texture_half_float OES_texture_half_float_linear OES_vertex_array_object OVR_multiview2 WEBGL_color_buffer_float WEBGL_compressed_texture_astc WEBGL_compressed_texture_atc WEBGL_compressed_texture_etc WEBGL_compressed_texture_etc1 WEBGL_compressed_texture_pvrtc WEBGL_compressed_texture_s3tc WEBGL_compressed_texture_s3tc_srgb WEBGL_debug_renderer_info WEBGL_debug_shaders WEBGL...
WebRTC connectivity - Web APIs
ds. ICE candidates As well as exchanging information about the media (discussed above in Offer/Answer and SDP), peers must exchange information about the network connection. This is known as an ICE candidate and details the available methods the peer is able to communicate (directly or through a TURN server). Typically, each peer will propose its best candidates first, making their way down the line toward their worse candidates. Ideally, candidates are UDP (since it's faster, and media streams are able to recover from interruptions relatively easily), but the ICE standard does allow TCP candidates as well. Generally, ICE candidates using TCP are only going to be used when UDP is not available or is restricted in ways that make it not suitable for media streaming. Not all browsers support ...
Signaling and video calling - Web APIs
cate one another. This process is called signaling and involves both devices connecting to a third, mutually agreed-upon server. Through this third server, the two devices can locate one another, and exchange negotiation messages. In this article, we will further enhance the WebSocket chat first created as part of our WebSocket documentation (this article link is forthcoming; it isn't actually online yet) to support opening a two-way video call between users. You can try out this example on Glitch, and you can remix the example to experiment with it as well. You can also look at the full project on GitHub. Note: If you try out the example on Glitch, please note that any changes made to the code will immediately reset any connections. In addition, there is a short timeout period; the Glitch ...
Taking still photos with WebRTC - Web APIs
tener('click', function(ev){ takepicture(); ev.preventDefault(); }, false); This method is simple enough: it just calls our takepicture() function, defined below in the section Capturing a frame from the stream, then calls Event.preventDefault() on the received event to prevent the click from being handled more than once. Wrapping up the startup() method There are only two more lines of code in the startup() method: clearphoto(); } This is where we call the clearphoto() method we'll describe below in the section Clearing the photo box. Clearing the photo box Clearing the photo box involves creating an image, then converting it into a format usable by the <img> element that displays the most recently captured frame. That code looks like this: function clearphoto(...
Using DTMF with WebRTC - Web APIs
button. When the button is clicked, a DTMF string is sent over the connection using RTCDTMFSender.insertDTMF(). Once the tones finish transmitting, the connection is closed. Note: This example is obviously somewhat contrived, since normally the two RTCPeerConnection objects would exist on different devices, and signaling would be done over the network instead of it all being simply linked up inline as it is here. HTML The HTML for this example is very basic; there are only three elements of importance: An <audio> element to play the audio received by the RTCPeerConnection being "called." A <button> element to trigger creating and connecting the two RTCPeerConnection objects, then sending the DTMF tones. A <div> to receive and display log text to show status information. <p>This ...
Writing WebSocket client applications - Web APIs
// Construct a msg object containing the data the server needs to process the message from the chat client. var msg = { type: "message", text: document.getElementById("text").value, id: clientID, date: Date.now() }; // Send the msg object as a JSON-formatted string. exampleSocket.send(JSON.stringify(msg)); // Blank the text input element, ready to receive the next line of text from the user. document.getElementById("text").value = ""; } Receiving messages from the server WebSockets is an event-driven API; when messages are received, a message event is sent to the WebSocket object. To handle it, add an event listener for the message event, or use the onmessage event handler. To begin listening for incoming data, you can do something like this: exampleSocke...
Writing WebSocket servers - Web APIs
used only before the handshake. After the handshake succeeds, you have to use a different set of codes (defined in section 7.4 of the spec). Server handshake response When the server receives the handshake request, it should send back a special response that indicates that the protocol will be changing from HTTP to WebSocket. That header looks something like the following (remember each header line ends with \r\n and put an extra \r\n after the last one to indicate the end of the header): HTTP/1.1 101 Switching Protocols Upgrade: websocket Connection: Upgrade Sec-WebSocket-Accept: s3pPLMBiTxaQ9kYGzzhZRbK+xOo= Additionally, the server can decide on extension/subprotocol requests here; see Miscellaneous for details. The Sec-WebSocket-Accept header is important in that the server must deri...
Using bounded reference spaces - Web APIs
ce to move back toward the origin point, or at least to stay inside the safe zone. XR hardware that does not have an inherent boundary defined may or may not support the bounded reference space. If it does, it likely has a system in place to allow the user to specify or select the boundaries to apply if a bounded space is to be used. However, it's entirely possible that the device will simply decline to support bounded spaces at all, so you should be prepared to fall back to some other type of reference space. Understanding boundaries As mentioned previously, the boundary is defined as an array of points located at floor level, each defining a corner of the boundary area, going around the origin in a clockwise manner. This is demonstrated in the diagram below. This diagram defines the bo...
Inputs and input sources - Web APIs
ts initial position, as it was recorded by pickUpObject() in the squeezestart event handler. Here, the returnObject() function is assumed to be one which knows how to return the object held in the specified hand to its initial position, as it was recorded by pickUpObject() in the squeezestart event handler. Transient actions If an XR device uses the mouse to simulate a controller when in the inline mode, the approximate sequence of things takes place: The user presses the mouse button while inside the <canvas> presenting the WebXR scene. The mouse event is captured by the XR device's driver. The device creates a new XRInputSource to represent the simulated XR input source. The targetRayMode is set to screen, and the other information is filled out as appropriate. This new input source ...
WebXR performance guide - Web APIs
mine a variety of suggestions and recommendations that will help you make your WebXR app as performant as possible. Rendering tips ... Talk about general stuff like limiting how many different loops there are during rendering, avoiding unnecessary drawing, etc. Can probably also include stuff from https://github.com/immersive-web/webxr/blob/master/explainer.md#changing-the-field-of-view-for-inline-sessions Managing rendering quality ... This section will come in part from https://github.com/immersive-web/webxr/blob/master/explainer.md#controlling-rendering-quality Managing frame rate ... Managing use of depth ... This section will combine information from https://github.com/immersive-web/webxr/blob/master/explainer.md#controlling-depth-precision and https://github.com/immersive-web...
Controlling multiple parameters with ConstantSourceNode - Web APIs
Setting up Let's start by looking at the global variable initialization. let context = null; let playButton = null; let volumeControl = null; let oscN...
Background audio processing using AudioWorklet - Web APIs
ll the audio worklet processor module. As needed, create audio processing nodes by passing the processor's name (which is defined by the module) to the AudioWorkletNode() constructor. Set up any audio parameters the AudioWorkletNode needs, or that you wish to configure. These are defined in the audio worklet processor module. Connect the created AudioWorkletNodes into your audio processing pipeline as you would any other node, then use your audio pipeline as usual. Throughout the remainder of this article, we'll look at these steps in more detail, with examples (including working examples you can try out on your own). The example code found on this page is derived from this working example which is available on Glitch. The example creates an oscillator node and adds white noise to it usi...
Using the Web Audio API - Web APIs
with the Web Audio API, we need to create an instance of the audio context. This then gives us access to all the features and functionality of the API. // for legacy browsers const AudioContext = window.AudioContext || window.webkitAudioContext; const audioContext = new AudioContext(); So what's going on when we do this? A BaseAudioContext is created for us automatically and extended to an online audio context. We'll want this because we're looking to play live sound. Note: If you just want to process audio data, for instance, buffer and stream it but not play it, you might want to look into creating an OfflineAudioContext. Loading sound Now, the audio context we've created needs some sound to play through it. There are a few ways to do this with the API. Let's begin with a simple me...
Web audio spatialization basics - Web APIs
r cone is where gain (volume) is always emulated at a maximum and the outer cone is where the gain starts to drop away. The gain is reduced by the value of the coneOuterGain value. Let's create constants that store the values we'll use for these parameters later on: const innerCone = 60; const outerCone = 90; const outerGain = 0.3; The next parameter is distanceModel -- this can only be set to linear, inverse, or exponential. These are different algorithms, which are used to reduce the volume of the audio source as it moves away from the listener. We'll use linear, as it is simple: const distanceModel = 'linear'; We can set a maximum distance (maxDistance) between the source and the listener -- the volume will not be reduced anymore if the source moves further away from this point. This ...
Web Locks API - Web APIs
lock is granted. The lock is automatically released when the callback returns, so usually the callback is an async function, which causes the lock to be released only when the async function has completely finished. The request() method itself returns a promise which resolves once the lock has been released; within an async function, a script can await the call to make the asynchronous code flow linear. For example: await do_something_without_lock(); // Request the lock. await navigator.locks.request('my_resource', async lock => { // The lock has been acquired. await do_something_with_lock(); await do_something_else_with_lock(); // Now the lock will be released. }); // The lock has been released. await do_something_else_without_lock(); Options Several options can be passed when ...
Functions and classes available to Web Workers - Web APIs
ope of workers. This objects defines worker-specific functions. (Yes) 10.0 (Yes) (Yes) WorkerLocation The subset of the Location interface available to workers. 3.6 (1.9.2) 10.0 (Yes) (Yes) WorkerNavigator The subset of the Navigator interface available to workers. Basic implementation (Yes) appCodeName, product, taintEnabled(): 28 (28) onLine: 29 (29) NavigatorLanguage: (Yes) appName, appVersion, onLine, platform, userAgent: 10.0 Other: No support (Yes) (Yes) XMLHttpRequest Creates and returns a new XMLHttpRequest object; this mimics the behavior of the standard XMLHttpRequest() constructor. Note that the responseXML and channel attributes on XMLHttpRequest always return null. Basic: 3.5 (1.9.1) ...
Web Workers API - Web APIs
as long as they are in the same domain as the worker. They are a little more complex than dedicated workers -- scripts must communicate via an active port. See SharedWorker for more details. ServiceWorkers essentially act as proxy servers that sit between web applications, the browser, and the network (when available). They are intended, among other things, to enable the creation of effective offline experiences, intercept network requests and take appropriate action based on whether the network is available, and update assets residing on the server. They will also allow access to push notifications and background sync APIs. Chrome Workers are a Firefox-only type of worker that you can use if you are developing add-ons and want to use workers in extensions and have access to js-ctypes in you...
WheelEvent() - Web APIs
double representing the scroll amount for the z-axis in the deltaMode unit. "deltaMode", optional and defaulting to 0, is a unsigned long representing the unit of the delta values scroll amount. Permitted values are: Constant Value Description DOM_DELTA_PIXEL 0x00 The delta values are specified in pixels. DOM_DELTA_LINE 0x01 The delta values are specified in lines. DOM_DELTA_PAGE 0x02 The delta values are specified in pages. The WheelEventInit dictionary also accepts fields from the MouseEventInit, UIEventInit and EventInit dictionaries. Specifications Specification Status Comment Document Object Model (DOM) Level 3 ...
Window.applicationCache - Web APIs
Important: Application Cache is deprecated as of Firefox 44, and is no longer available in insecure contexts from Firefox 60 onwards (bug 1354175, currently Nightly/Beta only). Don't use it to offline websites -- consider using service workers instead. Returns a reference to the application cache object for the window. Syntax cache = window.applicationCache Parameters cache is an object reference to an OfflineResourceList. Specification HTML 5WD ...
Window.devicePixelRatio - Web APIs
ar scale = window.devicePixelRatio; // Change to 1 on retina screens to see blurry canvas. canvas.width = Math.floor(size * scale); canvas.height = Math.floor(size * scale); // Normalize coordinate system to use css pixels. ctx.scale(scale, scale); ctx.fillStyle = "#bada55"; ctx.fillRect(10, 10, 300, 300); ctx.fillStyle = "#ffffff"; ctx.font = '18px Arial'; ctx.textAlign = 'center'; ctx.textBaseline = 'middle'; var x = size / 2; var y = size / 2; var textString = "I love MDN"; ctx.fillText(textString, x, y); Monitoring screen resolution or zoom level changes In this example, we'll set up a media query and watch it to see when the device resolution changes, so that we can check the value of devicePixelRatio to handle any updates we need to. JavaScript The JavaScript code creates the m...
window.dump() - Web APIs
Web › API › Window › dump
browser.dom.window.dump.enabled to true. You can set the preference in about:config or in a user.js file. Note: this preference is not listed in about:config by default, you may need to create it (right-click the content area -> New -> Boolean). On Windows, you will need a console to actually see anything. If you don't have one already, closing the application and re-opening it with the command line parameter -console should create the console or use -attach-console to use the existing console. On other operating systems, it's enough to launch the application from a terminal. To redirect the console output to a file, run firefox without the -console option and use the syntax to redirect stderr and stdout to a file, i.e.: firefox > console.txt 2>&1 If you would like the console messages ...
Window.isSecureContext - Web APIs
t require secure contexts. Syntax var isSecure = window.isSecureContext Examples Feature detection You can use feature detection to check whether they are in a secure context or not by using the isSecureContext boolean which is exposed on the global scope. if (window.isSecureContext) { // Page is a secure context so service workers are now available navigator.serviceWorker.register("/offline-worker.js").then(function () { ... }); } Specifications Specification Status Comment Secure Contexts Candidate Recommendation Initial definition. ...
window.location - Web APIs
Web › API › Window › location
Nullam ultrices dolor ac dolor imperdiet ullamcorper. Suspendisse quam libero, luctus auctor mollis sed, malesuada condimentum magna. Quisque in ante tellus, in placerat est. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Donec a mi magna, quis mattis dolor. Etiam...
Window.open() - Web APIs
Web › API › Window › open
nd involves considerably a lot of coding in the source code (security management, memory management, various code branchings sometimes quite complex, window frame/chrome/toolbars building, window positioning and sizing, etc.). Opening new tabs is less demanding on the user's system resources (and faster to achieve) than opening new windows. Offer to open a link in a new window, using these guidelines If you want to offer to open a link in a new window, then follow tested and recommendable usability and accessibility guidelines: Never use this form of code for links: <a href="javascript:window.open(...)" ...> "javascript:" links break accessibility and usability of webpages in every browser. "javascript:" pseudo-links become dysfunctional when javascript support is disabled or inexisten...
Window.performance - Web APIs
The Window interface's performance property returns a Performance object, which can be used to gather performance information about the current document. It serves as the point of exposure for the Performance Timeline API, the High Resolution Time API, the Navigation Timing API, the User Timing API, and the Resource Timing API. Syntax performanceData = window.performance; Value A Performance object offering access to the performance and timing-related information offered by the APIs it exposes. Specifications Specification Status Comment High Resolution TimeThe definition of 'window.performance' in that specification. Recommendation Defines now() method. ...
Window.prompt() - Web APIs
Web › API › Window › prompt
n the window with Text "Are you feeling lucky" and default value "sure" When the user clicks the OK button, text entered in the input field is returned. If the user clicks OK without entering any text, an empty string is returned. If the user clicks the Cancel button, this function returns null. The above prompt appears as follows (in Chrome on OS X): Notes A prompt dialog contains a single-line textbox, a Cancel button, and an OK button, and returns the (possibly empty) text the user entered into that textbox. The following text is shared between this article, DOM:window.confirm and DOM:window.alert Dialog boxes are modal windows; they prevent the user from accessing the rest of the program's interface until the dialog box is closed. For this reason, you should not overuse any function...
window.requestIdleCallback() - Web APIs
s will elapse before the callback is fired. Syntax var handle = window.requestIdleCallback(callback[, options]) Return value An ID which can be used to cancel the callback by passing it into the window.cancelIdleCallback() method. Parameters callback A reference to a function that should be called in the near future, when the event loop is idle. The callback function is passed an IdleDeadline object describing the amount of time available and whether or not the callback has been run because the timeout period expired. options Optional Contains optional configuration parameters. Currently only one property is defined: timeout: If timeout is specified and has a positive value, and the callback has not already been called by the time timeout milliseconds have passed, the callback w...
Window.scroll() - Web APIs
Web › API › Window › scroll
ons is a ScrollToOptions dictionary. Examples <!-- put the 100th vertical pixel at the top of the window --> <button onclick="scroll(0, 100);">click to scroll down 100 pixels</button> Using options: window.scroll({ top: 100, left: 100, behavior: 'smooth' }); Notes Window.scrollTo() is effectively the same as this method. For relative scrolling, see Window.scrollBy(), Window.scrollByLines(), and Window.scrollByPages(). For scrolling elements, see Element.scrollTop and Element.scrollLeft. Specification Specification Status Comment CSS Object Model (CSSOM) View ModuleThe definition of 'window.scroll()' in that specification. Working Draft Initial definition. Browser Compatibility The compatibility table in this page is generated from str...
Window.scrollBy() - Web APIs
Web › API › Window › scrollBy
llToOptions dictionary. Examples To scroll down one page: window.scrollBy(0, window.innerHeight); To scroll up: window.scrollBy(0, -window.innerHeight); Using options: window.scrollBy({ top: 100, left: 100, behavior: 'smooth' }); Notes window.scrollBy() scrolls by a particular amount, whereas window.scroll() scrolls to an absolute position in the document. See also window.scrollByLines() and window.scrollByPages(). Specification Specification Status Comment CSS Object Model (CSSOM) View ModuleThe definition of 'window.scrollBy()' in that specification. Working Draft Initial definition. Browser Compatibility The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check ou...
Window.scrollTo() - Web APIs
Web › API › Window › scrollTo
is the pixel along the vertical axis of the document that you want displayed in the upper left. - or - options is a ScrollToOptions dictionary. Examples window.scrollTo(0, 1000); Using options: window.scrollTo({ top: 100, left: 100, behavior: 'smooth' }); Notes Window.scroll() is effectively the same as this method. For relative scrolling, see Window.scrollBy(), Window.scrollByLines(), and Window.scrollByPages(). For scrolling elements, see Element.scrollTop and Element.scrollLeft. Specifications Specification Status Comment CSS Object Model (CSSOM) View ModuleThe definition of 'window.scroll()' in that specification. Working Draft Initial definition. ...
Window.scrollY - Web APIs
Web › API › Window › scrollY
nt viewport. If there is no viewport, the returned value is 0. Example // make sure and go down to the second page if (window.scrollY) { window.scroll(0, 0); // reset the scroll position to the top left of the document. } window.scrollByPages(1); Notes Use this property to check that the document hasn't already been scrolled when using relative scroll functions such as scrollBy(), scrollByLines(), or scrollByPages(). The pageYOffset property is an alias for the scrollY property: window.pageYOffset === window.scrollY; // always true For cross-browser compatibility, use window.pageYOffset instead of window.scrollY. Additionally, older versions of Internet Explorer (< 9) do not support either property and must be worked around by checking other non-standard properties. A fully compatib...
WindowEventHandlers - Web APIs
Handlers.onlanguagechange Is an EventHandler representing the code to be called when the languagechange event is raised. WindowEventHandlers.onmessage Is an EventHandler representing the code to be called when the message event is raised. WindowEventHandlers.onmessageerror Is an EventHandler representing the code to be called when the MessageError event is raised. WindowEventHandlers.onoffline Is an EventHandler representing the code to be called when the offline event is raised. WindowEventHandlers.ononline Is an EventHandler representing the code to be called when the online event is raised. WindowEventHandlers.onpagehide Is an EventHandler representing the code to be called when the pagehide event is raised. WindowEventHandlers.onpageshow Is an EventHandler representing the c...
WindowOrWorkerGlobalScope.caches - Web APIs
The caches read-only property of the WindowOrWorkerGlobalScope interface returns the CacheStorage object associated with the current context. This object enables functionality such as storing assets for offline use, and generating custom responses to requests. Syntax var myCacheStorage = self.caches; // or just caches Value A CacheStorage object. Example The following example shows how you'd use a cache in a service worker context to store assets offline. this.addEventListener('install', function(event) { event.waitUntil( caches.open('v1').then(function(cache) { return cache.addAll([ '/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', ...
WindowOrWorkerGlobalScope - Web APIs
an interface; you can't actually create an object of type WindowOrWorkerGlobalScope. Properties These properties are defined on the WindowOrWorkerGlobalScope mixin, and implemented by Window and WorkerGlobalScope. WindowOrWorkerGlobalScope.caches Read only Returns the CacheStorage object associated with the current context. This object enables functionality such as storing assets for offline use, and generating custom responses to requests. WindowOrWorkerGlobalScope.crossOriginIsolated Read only Returns a boolean value that indicates whether a SharedArrayBuffer can be sent via a Window.postMessage() call. WindowOrWorkerGlobalScope.indexedDB Read only Provides a mechanism for applications to asynchronously access capabilities of indexed databases; returns an IDBFactory object. ...
Worker.prototype.postMessage() - Web APIs
ng message to ChromeWorker'; } } myWorker.addEventListener('message', handleMessageFromWorker); // Ok lets create the buffer and send it var arrBuf = new ArrayBuffer(8); console.info('arrBuf.byteLength pre transfer:', arrBuf.byteLength); myWorker.postMessage( { aTopic: 'do_sendWorkerArrBuff', aBuf: arrBuf // The array buffer that we passed to the transferrable section 3 lines below }, [ arrBuf // The array buffer we created 9 lines above ] ); console.info('arrBuf.byteLength post transfer:', arrBuf.byteLength); Worker code self.onmessage = function (msg) { switch (msg.data.aTopic) { case 'do_sendWorkerArrBuff': sendWorkerArrBuff(msg.data.aBuf) break; default: throw 'no aTopic on incomi...
WorkerGlobalScope.importScripts() - Web APIs
representing the scripts to be imported. These paths are relative to html document base URL. Return value None. Exceptions NetworkError Imported scripts were not served with a valid JavaScript MIME type (i.e. text/javascript). Example If you had some functionality written in a separate script called foo.js that you wanted to use inside worker.js, you could import it using the following line: importScripts('foo.js'); importScripts() and self.importScripts() are effectively equivalent -- both represent importScripts() being called from inside the worker's inner scope. Specifications Specification Status Comment HTML Living StandardThe definition of 'importScripts()' in that specification. Living Standard ...
Worklet - Web APIs
Web › API › Worklet
With Worklets, you can run JavaScript and WebAssembly code to do graphics rendering or audio processing where high performance is required. Worklet types Worklets are restricted to specific use cases; they cannot be used for arbitrary computations like Web Workers. The Worklet interface abstracts properties and methods common to all kind of worklets, and cannot be created directly. ...
XRInputSource.profiles - Web APIs
The read-only XRInputSource property profiles returns an array of strings, each describing a configuration profile for the input source. The profile stings are listed in order of specificity, with the most specific profile listed first. Note: The profiles list is always empty when the WebXR session is in inline mode. Syntax let profileList = xrInputSource.profiles; Value An array of DOMString objects, each describing one configuration profile for the input device represented by the XRInputSource object. Each input profile specifies the preferred visual representation and behavior of the input source. Usage notes Input profile names An input profile name is a string describing a visual representation and behavior the input source may be configured to use. Each string: Has no spa...
XRPermissionDescriptor.optionalFeatures - Web APIs
ng is optimized for stability around the user's current position, so the native origin may drift as needed to accommodate that need. XRReferenceSpace viewer A tracking space whose native origin tracks the viewer's position and orientation. This is used for environments in which the user can physically move around, and is supported by all instances of XRSession, both immersive and inline, though it's most useful for inline sessions. It's particularly useful when determining the distance between the viewer and an input, or when working with offset spaces. Otherwise, typically, one of the other reference space types will be used more often. XRReferenceSpace Usage notes Examples let xrPermissionDesc = { name: "xr", mode: "immersive-vr", optionalFeatures: [ "bounde...
XRPermissionDescriptor.requiredFeatures - Web APIs
ng is optimized for stability around the user's current position, so the native origin may drift as needed to accommodate that need. XRReferenceSpace viewer A tracking space whose native origin tracks the viewer's position and orientation. This is used for environments in which the user can physically move around, and is supported by all instances of XRSession, both immersive and inline, though it's most useful for inline sessions. It's particularly useful when determining the distance between the viewer and an input, or when working with offset spaces. Otherwise, typically, one of the other reference space types will be used more often. XRReferenceSpace Usage notes Examples In this example, permissions are checked to ensure that the user has granted permission for ...
XRPermissionDescriptor - Web APIs
ike ot use if permision is granted. The XRPermissionDescriptor's name must be set to xr in order to direct the Permissions API to correctly handle the request as applying to WebXR. Properties In addition to inheriting the properties of the parent interface, PermissionDescriptor, XRPermissionDescriptor provides the following properties. mode An XRSessionMode value indicating the XR mode (inline, immersive-vr, or immersive-ar) for which the permissions are requested. optionalFeatures An array of strings, each specifying the name of a WebXR feature which is requested but not required for the app to function. The available features are the same as those used by XRSessionInit; see Default features in XRSessionInit for further information. requiredFeatures An array of strings giving the ...
XRPermissionStatus.granted - Web APIs
ng is optimized for stability around the user's current position, so the native origin may drift as needed to accommodate that need. XRReferenceSpace viewer A tracking space whose native origin tracks the viewer's position and orientation. This is used for environments in which the user can physically move around, and is supported by all instances of XRSession, both immersive and inline, though it's most useful for inline sessions. It's particularly useful when determining the distance between the viewer and an input, or when working with offset spaces. Otherwise, typically, one of the other reference space types will be used more often. XRReferenceSpace Usage notes Examples Specifications Specification Status Comment WebXR Device APIThe...
XRReferenceSpace - Web APIs
ng is optimized for stability around the user's current position, so the native origin may drift as needed to accommodate that need. XRReferenceSpace viewer A tracking space whose native origin tracks the viewer's position and orientation. This is used for environments in which the user can physically move around, and is supported by all instances of XRSession, both immersive and inline, though it's most useful for inline sessions. It's particularly useful when determining the distance between the viewer and an input, or when working with offset spaces. Otherwise, typically, one of the other reference space types will be used more often. XRReferenceSpace Usage notes Creating an XRReferenceSpace There are two situations in which you need to obtain an XRReferenceSpace...
XRReferenceSpaceType - Web APIs
ng is optimized for stability around the user's current position, so the native origin may drift as needed to accommodate that need. XRReferenceSpace viewer A tracking space whose native origin tracks the viewer's position and orientation. This is used for environments in which the user can physically move around, and is supported by all instances of XRSession, both immersive and inline, though it's most useful for inline sessions. It's particularly useful when determining the distance between the viewer and an input, or when working with offset spaces. Otherwise, typically, one of the other reference space types will be used more often. XRReferenceSpace Specifications Specification Status Comment WebXR Device APIThe definition of 'XRRefer...
XRRenderState.baseLayer - Web APIs
That context is passed into new XRWebGLLayer() to create an XRWebGLLayer which uses the contents of the WebGL context gl as the source of the world's image during presentation. Specifications Specification Status Comment WebXR Device APIThe definition of 'XRRenderState.baseLayer' in that specification. Working Draft ...
XRRenderStateInit - Web APIs
place between the distances specified by depthNear and depthFar. This is 1000 meters (1 kilometer) by default. depthNear Optional A floating-point value indicating the distance in meters from the viewer to a plane parallel to the display surface to be the near clip plane. No part of the scene on the viewer's side of this plane will be rendered. This is 0.1 meters (10 centimeters) by default. inlineVerticalFieldOfView Optional A floating-point value indicating the default field of view, in radians, to be used when computing the projection matrix for an inline XRSession. The projection matrix calculation also takes into account the output canvas's aspect ratio. This property must not be specified for immersive sessions, so the value is null by default for immersive sessions. The default valu...
XRRigidTransform.inverse - Web APIs
ix = mat4.create(); for (let view of pose.view) { let viewport = glLayer.getViewport(view); gl.viewport(viewport.x, viewport.y, viewport.width, viewport.height); /* ... */ mat4.multiply(modelViewMatrix, view.transform.inverse.matrix, objectMatrix); gl.uniformMatrix4fv(programInfo.uniformLocations.modelViewMatrix, false, modelViewMatrix); /* ... */ } 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. The inverse's matrix is multiplied by the object's matrix to get the model view matrix, which is then passed into the shader program by setting a uniform to contain that information. Spec...
XRRigidTransform.position - Web APIs
rence space. if that fails (probably because bounded-floor isn't supported), we try requesting a local-floor reference space. If we're not in an immersive session, we instead request a viewer reference space. In all cases, once the space has been obtained, it gets passed into the refSpaceCreated() function. For immersive spaces, the specified space is simply saved for future use. However, for inline sesions, we know we're in a space not automatically adjusted for floor level, so we request an offset reference space to shift the viewer's height to 1.5 meters above the presumed floor level of 0 meters. That new reference space is used instead of the one initially received. Finally, an animation frame request is submitted. Specifications Specification Status Comment ...
XRSession.renderState - Web APIs
The read-only renderState property of an XRSession object indicates the returns a XRRenderState object describing how the user's environment which should be rendered. The information provided covers the minimum and maximum distance at which to render objects, the vertical field of view to use when rendering the in the inline session mode, and the XRWebGLLayer to render into for inline composition. While this property is read only, you can call the XRSession method updateRenderState() to make changes. Syntax var xrRenderState = XRSession.renderState; Value An XRRenderState object describing how to render the scene. Specifications Specification Status Comment WebXR Device APIThe definition of 'XRSession.renderState' in that specification. Working ...
XRSession.requestReferenceSpace() - Web APIs
ng is optimized for stability around the user's current position, so the native origin may drift as needed to accommodate that need. XRReferenceSpace viewer A tracking space whose native origin tracks the viewer's position and orientation. This is used for environments in which the user can physically move around, and is supported by all instances of XRSession, both immersive and inline, though it's most useful for inline sessions. It's particularly useful when determining the distance between the viewer and an input, or when working with offset spaces. Otherwise, typically, one of the other reference space types will be used more often. XRReferenceSpace Return value A Promise that resolves with an XRReferenceSpace object. Exceptions Rather than throwing true excep...
XRSession: visibilitychange event - Web APIs
Cancelable No Interface XRSessionEvent Event handler property onvisibilitychange When the XRSession receives this event, the visibility state has already been changed. ...
XRSystem: isSessionSupported() - Web APIs
e, the promise resolves with false. If the no devices are available or the browser doesn't have permission to use the XR device, the promise is rejected with an appropriate DOMException. Syntax var isSupportedPromise = xr.isSessionSupported(xrSessionMode) Parameters xrSessionMode A DOMString specifying the WebXR session mode for which support is to be checked. This string must be one of inline (to present the WebXR content inline within the context of an HTML document) or immersive-vr for a fully-immersive virtual experience. Return value A Promise that resolves to true if the specified session mode is supported; otherwise the promise resolves to false. Exceptions Rather than throwing true exceptions, isSessionSupported() rejects the returned promise, passing to the rejection hand...
XRTargetRayMode - Web APIs
g system along the target ray in the direction in which the user is looking or pointing. The style of the ray is generally up to you, as is the method for indicating the endpoint of the ray. The targeted point or object might be indicated by drawing a shape or highlighting the targeted surface or object. A target ray emitted by a hand controller. 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. Values gaze The user is using a gaze-tracking system (or gaze input) which detects the direction in which the user is looking. The target ray will be drawn originating at the viewer's eyes and will follow the direction in which they're looking. screen The directio...
XRView.transform - Web APIs
Web › API › XRView › transform
the XRView. Examples For each view making up the presented scene, the view's transform represents the position and orientation of the viewer or camera relative to the reference space's origin. You can then use the inverse of this matrix to transform the objects in your scene to adjust their placement and orientation to simulate the viewer's movement through space. In this example, we see an outline of a code fragment used while rendering an XRFrame, which makes use of the view transform to place objects in the world during rendering. const modelViewMatrix = mat4.create(); const normalMatrix = mat4.create(); for (let view of pose.views) { let viewport = glLayer.getViewport(view); gl.viewport(viewport.x, viewport.y, viewport.width, viewport.height); for (let obj of world.objects) { ...
XRView - Web APIs
Web › API › XRView
o the user. It's possible to have XRView objects which represent overlapping regions as well as entirely disparate regions; in a game, you might have views that can be presented to observe a remote site using a security camera or other device, for example. In other words, don't assume there are exactly two views on a given viewer; there can be as few as one (such as when rendering the scene in inline mode, and potentially many (especially if the field of view is very large). There might also be views representing observers watching the action, or other viewspoints not direclty associated with a player's eye. In addition, the number of views can change at any time, depending on the needs of the time. So you should process the view list every time without making assumptions based on previous f...
XRWebGLLayer - Web APIs
In particular, it provides access to the WebGL framebuffer and viewport to ease access to the context. Although XRWebGLLayer is currently the only type of framebuffer layer supported by WebGL, it's entirely possible that future updates to the WebXR specification may allow for other layer types and corresponding image sources. ...
msWriteProfilerMark - Web APIs
with TraceEvent; for systems after Windows XP, this method writes an event with EventWrite. The event includes a pointer to a window object, current markup, and the event name passed as bstrProfilerMarkName. The bstrProfilerMarkName property has a 32-character limit when called from script. This method is useful to profile real website performance by using the operating system metrics as a baseline. Example if (msWriteProfilerMark) { msWriteProfilerMark("Mark1"); } See also Microsoft API extensions ...
ARIA guides - Accessibility
Error Handling in Forms Labeling widgets Labeling Composite Widgets and Regions Managing Focus in Composite Widgets (aria-activedescendant vs roving tabindex) Using Landmark Roles Handling Dynamic Updates & Live Regions Virtual vs. ...
Using the aria-labelledby attribute - Accessibility
_label"> <li role="radio">Item #1</li> <li role="radio">Item #2</li> <li role="radio">Item #3</li> </ul> Example 4: Dialog Label In the example below, the header element that labels the dialog is referred to by the aria-labelledby attribute: <div role="dialog" aria-labelledby="dialogheader"> <h2 id="dialogheader">Choose a File</h2> ... ...
Using ARIA: Roles, states, and properties - Accessibility
complementary contentinfo form main navigation region search Live Region Roles alert log marquee status timer Window Roles alertdialog dialog States and properties Widget attributes aria-autocomplete aria-checked aria-current aria-disabled aria-errormessage aria-expanded aria-haspopup aria-hidden aria-invalid aria-label aria-level aria-modal aria-multiline aria-multiselectable aria-orientation aria-placeholder aria-pressed aria-readonly aria-required aria-selected aria-sort aria-valuemax aria-valuemin aria-valuenow aria-valuetext Live region attributes aria-live aria-relevant aria-atomic aria-busy Drag & drop attributes aria-dropeffect aria-dragged Relationship attributes aria-activedescendant aria-colcount ar...
ARIA: application role - Accessibility
, especially on Windows, screen readers and some other assistive technologies (AT) have traditionally grabbed the whole web content from the browser at once after it had finished loading. The ATs build their own representation of it that makes the most sense for a blind user to consume the content. This is often referred to as virtual document, browse mode, or similar terms. The document is streamlined to a single-column view. A keyboard interaction model is generated that is very similar to a word processor where users can read line by line, sentence by sentence, or paragraph by paragraph. The AT will read any semantics like links, headings, form controls, tables, lists, or images. In addition, a set of so-called quick navigation keys has been established over the years that allows blind use...
ARIA: Suggestion role - Accessibility
<span role="suggestion" aria-details="comment-source"> <span role="deletion">black Cat called Luna</span> <span role="insertion">purple Tyrannosaurus Rex called Tiny</span> </span>. </p> <div id="comment-source">Suggested by Chris, <time datetime="2019-03-30T19:29">March 30 2019, 19:29</time></div> Browsers tend to provide a default black strikethrough for deletions, and a black underline for insertions, but you'll probably want to use Accessibility concerns Landmark roles are intended to be used sparingly, to identify larger overall sections of the document. Using too many landmark roles can create "noise" in screen readers, making it difficult to understand the overall layout of the page. Best practices Prefer HTML Using the <ins> and <del> element will automatically commun...
ARIA: tab role - Accessibility
To accomplish the first, we listen for the keydown event on the tablist. If the event's keyCode is 39 for right arrow or 37 for the left arrow, we react to the...
Accessibility: What users can do to browse more safely - Accessibility
none", all animated images will be blocked. To reverse it, you will have to change the value back to "normal" Use browser extensions Gif Blocker For Chrome, GIF Blocker is an extension available at the web store. Gif Scrubber Gif Scrubber is a chrome extension that allows you to control gifs like a video player. There is a Github repository for it at https://github.com/0ui/gif-scrubber Beeline Reader Beeline Reader has a browser extension that allows you to set up for grayscale and Dyslexi font, among other things Take advantage Operating System accessibility features Most operating systems such as Windows 10, have accessibility options that are surprisingly powerful. Usually they are quite easy to find by simply typing ( or saying) in the word, "Accessibility" in the search find...
Accessibility FAQ - Accessibility
I'm interested in helping promote the fine accessibility features that Firefox provides, what can I do? Join the Firefox Accessibility Advocates ...
HTML To MSAA - Accessibility
te. ...
Color contrast - Accessibility
The color contrast between background and foreground content (that is, usually text) should be great enough to ensure legibility. When designing readable interfaces for different vision capabilities, the WCAG guidelines recommend the following contrast ratios: Type of content Minimum ratio (AA rating) Enhanced ratio (AAA rating) Body text 4.5 : 1 7 : 1 Large-scale text (120-150% larger than body text) 3 : 1 4.5 : 1 Active user interface components and graphical objects such as icons and graphs 3 : 1 Not defined These ratios do not apply to "incidental" text, such as inactive controls, logotypes, or purely decorative text. See the Solution section below for further information. Having good color contrast on your ...
-webkit-text-stroke-width - CSS: Cascading Style Sheets
Formal definition Initial value0Applies toall elementsInheritedyesComputed valueabsolute <length>Animation typediscrete Formal syntax <length> Examples Varying stroke widths CSS p { margin: 0; font-size: 4em; -webkit-text-stroke-color: red; } #thin { -webkit-text-stroke-width: thin; } #medium { -webkit-text-stroke-width: 3px; } #thick { -we...
:-moz-focusring - CSS: Cascading Style Sheets
...
:-moz-window-inactive - CSS: Cascading Style Sheets
ving different styles to background windows was achieved by setting an attribute (active="true") on the top-level XUL chrome window. This attribute is no longer used. Syntax :-moz-window-inactive Examples This example alters the appearance of a box's background depending on whether its window is active or not. 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. You can view this as a separate page as well. Specifications Not part of any standard. ...
::-moz-focus-inner - CSS: Cascading Style Sheets
n't match anything and has no effect. Syntax Syntax not found in DB! Examples HTML <input type="submit" value="Input"/> <button type="submit">Button</button> CSS button::-moz-focus-inner, input[type="color"]::-moz-focus-inner, input[type="reset"]::-moz-focus-inner, input[type="button"]::-moz-focus-inner, input[type="submit"]::-moz-focus-inner { padding-block-start: 0px; padding-inline-end: 2px; padding-block-end: 0px; padding-inline-start: 2px; border: 1px dotted red; } Result Specifications Not part of any standard. ...
::-webkit-meter-even-less-good-value - CSS: Cascading Style Sheets
the optimum attributes fall outside the low-high range, but in opposite zones. ...
::-webkit-meter-suboptimum-value - CSS: Cascading Style Sheets
...
::cue-region - CSS: Cascading Style Sheets
ion | ::cue-region( <selector> ) Permitted properties Rules whose selectors include this element may only use the following CSS properties: background background-attachment background-clip background-color background-image background-origin background-position background-repeat background-size color font font-family font-size font-stretch font-style font-variant font-weight line-height opacity outline outline-color outline-style outline-width ruby-position text-combine-upright text-decoration text-decoration-color text-decoration-line text-decoration-style text-decoration-thickness text-shadow visibility white-space Specifications Specification Status Comment WebVTT: The Web Video Text Tracks FormatThe definition of 'the ::cue-r...
::cue - CSS: Cascading Style Sheets
Web › CSS › ::cue
tax ::cue | ::cue( <selector> ) Permitted properties Rules whose selectors include this element may only use the following CSS properties: background background-attachment background-clip background-color background-image background-origin background-position background-repeat background-size color font font-family font-size font-stretch font-style font-variant font-weight line-height opacity outline outline-color outline-style outline-width ruby-position text-combine-upright text-decoration text-decoration-color text-decoration-line text-decoration-style text-decoration-thickness text-shadow visibility white-space Examples Styling WebVTT cues as white-on-black The following CSS sets the cue style so that the text is white and the background is a tra...
::spelling-error - CSS: Cascading Style Sheets
The ::spelling-error CSS pseudo-element represents a text segment which the user agent has flagged as incorrectly spelled. Allowable properties Only a small subset of CSS properties 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. HTML <p contenteditable spellcheck="true">My friends are coegdfgfddffbgning to the party tonight.</p> CSS ::spelling-error { text-decoration: wavy red; } Result Specifications Specification ...
:checked - CSS: Cascading Style Sheets
Web › CSS › :checked
ss="expandable"><td>[more text]</td><td>[more text]</td><td>[more text]</td></tr> </tbody> </table> <label for="expand-toggle" 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 ...
:empty - CSS: Cascading Style Sheets
Web › CSS › :empty
t provides the interactive control's accessible name can be hidden using a combination of properties that remove it visually from the screen but keep it parseable by assistive technology. This is commonly used for buttons that rely solely on an icon to convey purpose. What is an accessible name? | The Paciello Group Hidden content for better a11y | Go Make Things MDN Understanding WCAG, Guideline 2.4 explanations Understanding Success Criterion 2.4.4 | W3C Understanding WCAG 2.0 Specifications Specification Status Comment Selectors Level 4The definition of 'the :empty pseudo-class' in that specification. Working Draft Changed to act like :-moz-only-whitespace. Selectors Level 3The definition of 'the :empty pseudo-class' in that specification.
:focus - CSS: Cascading Style Sheets
Web › CSS › :focus
e sure the visual focus indicator can be seen by people with low vision. This will also benefit anyone use a screen in a brightly lit space (like outside in the sun). WCAG 2.1 SC 1.4.11 Non-Text Contrast requires that the visual focus indicator be at least 3 to 1. Accessible Visual Focus Indicators: Give Your Site Some Focus! Tips for Designing Useful and Usable Focus Indicators :focus { outline: none; } Never just remove the focus outline (visible focus indicator) without replacing it with a focus outline that will pass WCAG 2.1 SC 1.4.11 Non-Text Contrast. Quick Tip: Never remove CSS outlines Specifications Specification Status Comment HTML Living StandardThe definition of ':focus' in that specification. Living Standard Defines HTML-specific sem...
:host() - CSS: Cascading Style Sheets
Web › CSS › :host()
ill the span with the content of the custom element, and fill the style element with some CSS rules: let style = document.createElement('style'); let span = document.createElement('span'); span.textContent = this.textContent; const shadowRoot = this.attachShadow({mode: 'open'}); shadowRoot.appendChild(style); shadowRoot.appendChild(span); style.textContent = 'span:hover { text-decoration: underline; }' + ':host-context(h1) { font-style: italic; }' + ':host-context(h1):after { content: " - no links in headers!" }' + ':host-context(article, aside) { color: gray; }' + ':host(.footer) { color : red; }' + ':host { background: rgba(0,0,0,0.1); padding: 2px 5px; }'; The :host(.footer) { color : red...
:host-context() - CSS: Cascading Style Sheets
ill the span with the content of the custom element, and fill the style element with some CSS rules: let style = document.createElement('style'); let span = document.createElement('span'); span.textContent = this.textContent; const shadowRoot = this.attachShadow({mode: 'open'}); shadowRoot.appendChild(style); shadowRoot.appendChild(span); style.textContent = 'span:hover { text-decoration: underline; }' + ':host-context(h1) { font-style: italic; }' + ':host-context(h1):after { content: " - no links in headers!" }' + ':host-context(article, aside) { color: gray; }' + ':host(.footer) { color : red; }' + ':host { background: rgba(0,0,0,0.1); padding: 2px 5px; }'; The :host-context(h1) { font-sty...
:host - CSS: Cascading Style Sheets
Web › CSS › :host
ill the span with the content of the custom element, and fill the style element with some CSS rules: let style = document.createElement('style'); let span = document.createElement('span'); span.textContent = this.textContent; const shadowRoot = this.attachShadow({mode: 'open'}); shadowRoot.appendChild(style); shadowRoot.appendChild(span); style.textContent = 'span:hover { text-decoration: underline; }' + ':host-context(h1) { font-style: italic; }' + ':host-context(h1):after { content: " - no links in headers!" }' + ':host-context(article, aside) { color: gray; }' + ':host(.footer) { color : red; }' + ':host { background: rgba(0,0,0,0.1); padding: 2px 5px; }'; The :host { background: rgba(0,0...
:invalid - CSS: Cascading Style Sheets
Web › CSS › :invalid
border-color: #c00000; } Result Accessibility concerns The color red is commonly used to indicate invalid input. People who have certain types of color blindness will be unable to determine the input's state unless it is accompanied by an additional indicator that does not rely on color to convey meaning. Typically, descriptive text and/or an icon are used. MDN Understanding WCAG, Guideline 1.4 explanations Understanding Success Criterion 1.4.1 | W3C Understanding WCAG 2.0 Notes Radio buttons If any one of the radio buttons in a group is required, the :invalid pseudo-class is applied to all of them if none of the buttons in the group is selected. (Grouped radio buttons share the same value for their name attribute.) Gecko defaults By default, Gecko does not apply a style to t...
:not() - CSS: Cascading Style Sheets
Web › CSS › :not
, since <tr> will match with the :not() part of the selector. Examples HTML <p>I am a paragraph.</p> <p class="fancy">I am so very fancy!</p> <div>I am NOT a paragraph.</div> CSS .fancy { text-shadow: 2px 2px 3px gold; } /* <p> elements that are not in the class `.fancy` */ p:not(.fancy) { color: green; } /* Elements that are not <p> elements */ body :not(p) { text-decoration: underline; } /* Elements that are not <div> and not <span> elements */ body :not(div):not(span) { font-weight: bold; } /* Elements that are not `.crazy` or `.fancy` */ /* Note that this syntax is not well supported yet. */ body :not(.crazy, .fancy) { font-family: sans-serif; } Result Specifications Specification Status Comment Selectors Level 4The definition of ':not(...
:nth-child() - CSS: Cascading Style Sheets
that type. The <code>&lt;em&gt;</code> is completely skipped over and ignored.</p> <div class="third"> <span>Span!</span> <span>Span</span> <em>This is an `em`.</em> <span>Span!</span> <span>Span</span> <span>Span!</span> <span>Span</span> <span>Span!</span> </div> CSS html { font-family: sans-serif; } span, div em { padding: 5px; border: 1px solid green; display: inline-block; margin-bottom: 3px; } .first span:nth-child(2n+1), .second span:nth-child(2n+1), .third span:nth-of-type(2n+1) { background-color: lime; } Result Specifications Specification Status Comment Selectors Level 4The definition of ':nth-child' in that specification. Working Draft Adds of <selector> syntax and specifies that matching elements are not re...
:nth-of-type() - CSS: Cascading Style Sheets
Working Draft Matching elements are not required to have a parent. Selectors Level 3The definition of ':nth-of-type' in that specification. Recommendation Initial definition. ...
:optional - CSS: Cascading Style Sheets
Web › CSS › :optional
ensure that people navigating with the aid of assistive technology such as a screen reader will be able to understand which inputs need valid content to ensure a successful form submission. Required inputs should also be indicated visually, using a treatment that does not rely solely on color to convey meaning. Typically, descriptive text and/or an icon are used. MDN Understanding WCAG, Guideline 3.3 explanations Understanding Success Criterion 3.3.2 | W3C Understanding WCAG 2.0 Specifications Specification Status Comment HTML Living StandardThe definition of ':optional' in that specification. Living Standard No change. HTML5The definition of ':optional' in that specification. Recommendation Defines the semantics of HTML and constraint ...
:required - CSS: Cascading Style Sheets
Web › CSS › :required
ith the aid of assistive technology such as a screen reader will be able to understand which inputs need valid content to ensure a successful submission. If the form also contains optional inputs, required inputs should be indicated visually using a treatment that does not rely solely on color to convey meaning. Typically, descriptive text and/or an icon are used. MDN Understanding WCAG, Guideline 3.3 explanations Understanding Success Criterion 3.3.2 | W3C Understanding WCAG 2.0 Specifications Specification Status Comment HTML Living StandardThe definition of ':required' in that specification. Living Standard No change. HTML5The definition of ':required' in that specification. Recommendation Defines the semantics of HTML and constraint...
:valid - CSS: Cascading Style Sheets
Web › CSS › :valid
g that is not a proper email address. Accessibility concerns The color green is commonly used to indicate valid input. People who have certain types of color blindness will be unable to determine the input's state unless it is accompanied by an additional indicator that does not rely on color to convey meaning. Typically, descriptive text and/or an icon are used. MDN Understanding WCAG, Guideline 1.4 explanations Understanding Success Criterion 1.4.1 | W3C Understanding WCAG 2.0 Specifications Specification Status Comment HTML Living StandardThe definition of ':valid' in that specification. Living Standard No change. HTML5The definition of ':valid' in that specification. Recommendation Defines the semantics of HTML and constraint valida...
:visited - CSS: Cascading Style Sheets
Web › CSS › :visited
ctive rules, as defined by the LVHA-order: :link -- :visited -- :hover -- :active. Styling restrictions For privacy reasons, browsers strictly limit which styles you can apply using this pseudo-class, and how they can be used: Allowable CSS properties are color, background-color, border-color, border-bottom-color, border-left-color, border-right-color, border-top-color, column-rule-color, outline-color, text-decoration-color, and text-emphasis-color. Allowable SVG attributes are fill and stroke. The alpha component of the allowed styles will be ignored. The alpha component of the element's non-:visited state will be used instead, except when that component is 0, in which case the style set in :visited will be ignored entirely. Although these styles can be change the appearance of color...
font-display - CSS: Cascading Style Sheets
defined by the user agent. block Gives the font face a short block period and an infinite swap period. swap Gives the font face an extremely small block period and an infinite swap period. fallback Gives the font face an extremely small block period and a short swap period. optional Gives the font face an extremely small block period and no swap period. Description The font display timeline The font display timeline is based on a timer that begins the moment the user agent attempts to use a given downloaded font face. The timeline is divided into the three periods below which dictate the rendering behavior of any elements using the font face. Font block period If the font face is not loaded, any element attempting to use it must render an invisible fallback font face. If the fo...
font-stretch - CSS: Cascading Style Sheets
control over the chosen weight. For this, percentage ranges are useful. For TrueType or OpenType variable fonts, the "wdth" variation is used to implement varying glyph widths. Accessibility concerns People with dyslexia and other cognitive conditions may have difficulty reading fonts that are too condensed, especially if the font has a low contrast color ratio. ...
forced-colors - CSS: Cascading Style Sheets
olor-scheme so that authors can adapt the page. Usage notes Properties affected by forced-color mode In forced colors mode, the values of the following properties are treated as if they have no author-level values specified. That is, user-specified values (if any) or browser-specified values are used instead. color fill stroke text-decoration-color text-emphasis-color border-color outline-color column-rule-color scrollbar-color -webkit-tap-highlight-color box-shadow text-shadow You can use system color keywords with any property other than those listed above, to ensure that the rest of the page integrates with the restricted color palette available in forced colors mode. User preferences Currently no user agent implements this feature, although various operating systems d...
prefers-color-scheme - CSS: Cascading Style Sheets
Editor's Draft Initial definition. ...
prefers-contrast - CSS: Cascading Style Sheets
that they prefer an interface that has a lower level of contrast. User preferences Various operating systems do support such preferences and user agents are likely to rely on the settings provided by the operating system. Examples This example has an annoying low contrast by default. HTML <div class="contrast">low contrast box</div> CSS .contrast { width: 100px; height: 100px; outline: 2px dashed black; } @media (prefers-contrast: high) { .contrast { outline: 2px solid black; } } Result Specifications Specification Status Comment Media Queries Level 5The definition of 'prefers-contrast' in that specification. Editor's Draft Initial definition. ...
prefers-reduced-motion - CSS: Cascading Style Sheets
ui.prefersReducedMotion and set its value to 1. Changes to this preference take effect immediately. Examples This example has a scaling animation by default. If Reduce Motion is enabled in your accessibility preferences, the animation is toned down to a simple dissolve without vestibular motion triggers. HTML <div class="animation">animated box</div> CSS .animation { animation: pulse 1s linear infinite both; } /* Tone down the animation to avoid vestibular motion triggers like scaling or panning large objects. */ @media (prefers-reduced-motion) { .animation { animation-name: dissolve; } } .animation { background-color: #306; color: #fff; font: 1.2em sans-serif; width: 10em; padding: 1em; border-radius: 1em; text-align: center; } @keyframes pulse { 0% { tr...
resolution - CSS: Cascading Style Sheets
Web › CSS › @media › resolution
nge feature, meaning that you can also use the prefixed min-resolution and max-resolution variants to query minimum and maximum values, respectively. Examples HTML <p>This is a test of your device's pixel density.</p> CSS /* Exact resolution */ @media (resolution: 150dpi) { p { color: red; } } /* Minimum resolution */ @media (min-resolution: 72dpi) { p { text-decoration: underline; } } /* Maximum resolution */ @media (max-resolution: 300dpi) { p { background: yellow; } } Result Specifications Specification Status Comment Media QueriesThe definition of 'resolution' in that specification. Recommendation Initial definition. ...
scan - CSS: Cascading Style Sheets
Web › CSS › @media › scan
ing process (if any) utilized by the output device. The word scanning used in this context does not refer to an image scanner, such as one used to digitize a photograph. Rather, it means the process by which an image is painted onto a television screen (or other device). Syntax The scan feature is specified as a single keyword value chosen from the list below. interlace The device draws odd lines and even lines alternately. Some televisions use interlaced scanning. progressive The device draws all lines in sequence. All computer screens use progressive scanning. Examples HTML <p>If your screen uses interlaced rendering, this text should be in a sans-serif font. If your screen uses progressive scanning, you should see a serif font.</p> CSS p { font-family: cursive; } @me...
update - CSS: Cascading Style Sheets
vice is not unusually constrained in speed, so regularly-updating things like CSS Animations can be used. Example: computer screens. Examples HTML <p>If this text animates for you, you are using a fast-updating device.</p> CSS @keyframes jiggle { from { transform: translateY(0); } to { transform: translateY(25px); } } @media (update: fast) { p { animation: 1s jiggle linear alternate infinite; } } Result Specifications Specification Status Comment Media Queries Level 4The definition of 'update' in that specification. Candidate Recommendation Initial definition. ...
@namespace - CSS: Cascading Style Sheets
mespace-URL"; /* Prefixed namespace */ @namespace prefix url(XML-namespace-URL); @namespace prefix "XML-namespace-URL"; Description The defined namespaces can be used to restrict the universal, type, and attribute selectors to only select elements within that namespace. The @namespace rule is generally only useful when dealing with documents containing multiple namespaces--such as HTML5 with inline SVG or MathML, or XML that mixes multiple vocabularies. Any @namespace rules must follow all @charset and @import rules, and precede all other at-rules and style declarations in a style sheet. @namespace can be used to define the default namespace for the style sheet. When a default namespace is defined, all universal and type selectors (but not attribute selectors, see note below) apply only t...
@supports - CSS: Cascading Style Sheets
Web › CSS › @supports
one. The following example returns true if the browser's transform-origin property doesn't consider 10em 10em 10em valid: @supports not (transform-origin: 10em 10em 10em) {} As with any operator, the not operator can be applied to a declaration of any complexity. The following examples are both valid: @supports not (not (transform-origin: 2px)) {} @supports (display: grid) and (not (display: inline-grid)) {} Note: There is no need to enclose the not operator between two parentheses at the top level. To combine it with other operators, like and and or, the parentheses are required. The and operator The and operator creates a new expression from the conjunction of two shorter expressions. It returns true only if both of the shorter expressions are also true. The following example returns...
user-zoom - CSS: Cascading Style Sheets
ge the zoom factor of a document defined by @viewport. /* Keyword values */ user-zoom: zoom; user-zoom: fixed; Syntax Values zoom The user can zoom in or out. fixed The user cannot zoom in or out. Accessibility concerns Disabling zooming capabilities prevents people experiencing low vision conditions from being able to read and understand page content. ...
CSS Backgrounds and Borders - CSS: Cascading Style Sheets
Styles in the CSS Backgrounds and Borders module allow filling backgrounds with color or an image (clipped or resized), or modifying them in other ways. These styles can also decorate borders with lines or images, and make them square or rounded. (Additionally, element boxes can be decorated with a shadow.) Reference CSS Properties background background-attachment background-clip background-color background-image background-origin background-position background-position-x background-position-y background-repeat background-size border border-bottom border-bottom-color border-bottom-left-radius border-bottom-right-radius border-bottom-style border-bottom-width border-collapse border-color border-image border-image-outset border-image-repeat border-image-slice borde...
CSS Basic User Interface - CSS: Cascading Style Sheets
CSS Basic User Interface is a CSS module that lets you define the rendering and functionality of features related to the user interface. Reference Properties appearance box-sizing cursor ime-mode nav-down nav-left nav-right nav-up outline outline-width outline-style outline-color outline-offset resize text-overflow user-select Guides Using URL values for the cursor property Explains how a URL can be used with the cursor property to produce custom cursors. Specifications Specification Status Comment CSS Basic User Interface Module Level 4 Working Draft CSS Basic User Interface Module Level 3 Recommendation CSS Level 2 (Revision 1) Recommendation Initial definition. ...
Box alignment for block, absolutely positioned and table layout - CSS: Cascading Style Sheets
property applies to the block axis in order to align the contents of the box within its container. If a content distribution method such as space-between, space-around or space-evenly is requested then the fallback alignment will be used, as the content is treated as a single alignment subject. justify-self The justify-self property is used to align an item inside its containing block on the inline axis. This property does not apply to floated elements or table cells. Absolutely positioned elements The alignment container is the positioned block, accounting for the offset values of top, left, bottom, and right. The normal keyword resolves to stretch, unless the positioned item is a replaced element, in which case it resolves to start. align-self The align-self property does not apply t...
Box alignment in Multi-column Layout - CSS: Cascading Style Sheets
r. The alignment subject is the column box. The properties which apply to multi-column layouts are detailed below. Note: Multi-column Layout predates the Box Alignment specification. and the properties listed here, while specified for Multicol, may not be supported in browsers. align-content and justify-content The align-content property applies to the block axis and justify-content to the inline axis. Any spacing added to the columns due to use of space distribution will be added to the gap between the columns, therefore making the gap larger than might be specified by the column-gap property. Using a value of justify-content other than normal or stretch will cause column boxes to display at the column-width specified on the multicol container, and the remaining space distributed accord...
Introduction to the CSS basic box model - CSS: Cascading Style Sheets
ed to separate the element from its neighbors. Its dimensions are the margin-box width and the margin-box height. The size of the margin area is determined by the margin-top, margin-right, margin-bottom, margin-left, and shorthand margin properties. When margin collapsing occurs, the margin area is not clearly defined since margins are shared between boxes. Finally, note that for non-replaced inline elements, the amount of space taken up (the contribution to the height of the line) is determined by the line-height property, even though the borders and padding are still displayed around the content. ...
Basic Concepts of Multicol - CSS: Cascading Style Sheets
mber of columns. In the below example we use the column-count property to create three columns on the .container element. The content, including the children of .container is then split between the three columns. In the above example the content is wrapped in paragraph p tags with default styling. Therefore, there is a margin above each paragraph. You can see how this margin causes the first line of text to be pushed down. This is because a multicol container creates a new Block Formatting Context (BFC) which means margins on child elements do not collapse with any margin on the container. The column-width property The column-width property is used to set the optimal width for every column box. If you declare a column-width, the browser will work out how many columns of that width will ...
Handling Overflow in Multicol - CSS: Cascading Style Sheets
r you. More columns than will fit How overflowing columns are handled depends on whether you are in a fragmented media context, such as print, or a continuous media context, such as a web page. In fragmented media, once a fragment (for example a page) is filled with columns, the columns will move to a new page and fill that up with columns. In continuous media, columns will overflow in the inline direction. On the web this means that you will get a horizontal scrollbar. The example below shows this overflow behaviour. My multicol container has a height and there is more text than space to create columns, therefore we get columns created outside of the container. In a future version of the specification it would be useful to be able to have overflow columns in continuous media display ...
Styling Columns - CSS: Cascading Style Sheets
ge the gap and style rules between columns. Can I Style the Column Boxes? Sadly, not at present. The anonymous boxes that make up your columns can't be targeted in any way, meaning it isn't possible to change a box's background color or have one column larger than the others. Perhaps in future versions of the specification it might be. For now, however, we are able to change the spacing and add lines between columns. The column-gap property The gap between our columns is controlled by the column-gap property. This property was originally defined in the Multi-column Layout specification. However, it is now defined in Box Alignment in order to unify gaps between boxes in other specifications such as CSS Grid Layout. The initial value of column-gap in multicol is 1em. This means your columns...
CSS Multi-column Layout - CSS: Cascading Style Sheets
Basic example In the following example the column-count property has been applied to the element with a class of container. As the value of column-count is 3, the content is arranged into 3 columns of equal size. ...
CSS Containment - CSS: Cascading Style Sheets
he page from the rest of the page. If the browser knows that a part of the page is independent, rendering can be optimized and performance improved. The specification defines a single CSS property contain. This document describes the basic aims of the specification. Basic example Many webpages contain a number of sections which are independent of each other. For example a listing of article headlines and content, as in the mark-up below. <h1>My blog</h1> <article> <h2>Heading of a nice article</h2> <p>Content here.</p> </article> <article> <h2>Another heading of another article</h2> <p>More content here.</p> </article> Each article has the contain property with a value of content applied in the CSS. article { contain: content; } Each article is independent of the other articles...
CSS Flexible Box Layout - CSS: Cascading Style Sheets
iner How the Box Alignment properties work with Flexbox. Ordering flex items Explaining the different ways to change the order and direction of items, and covering the potential issues in doing so. Controlling Ratios of flex items along the main axis Explaining the flex-grow, flex-shrink and flex-basis properties. Mastering wrapping of flex items How to create flex containers with multiple lines and control the display of the items in those lines. Typical use cases of Flexbox Common design patterns that are typical Flexbox use cases. Backwards compatibility of Flexbox Browser status of Flexbox, interoperability issues and supporting older browsers and versions of the spec Specifications Specification Status Comment CSS Flexible Box Layout Module Can...
Variable fonts guide - CSS: Cascading Style Sheets
very small (such as an equivalent to 10 or 12px), the characters would have an overall thicker stroke, and perhaps other small modifications to ensure that it would reproduce and be readable at a physically smaller size. 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. While this was originally done to compensate for the ink and paper printing process (very thin lines at small sizes often didn't print, giving the letterforms a broken appearance), it translates well to digital displays when compensating for screen quality and physical size rendering. Optical size values are generally intended to be automatically applied corresponding ...
Implementing image sprites in CSS - CSS: Cascading Style Sheets
em as a single image; using background position as a way to distinguish between individual images in the same image file, so the number of HTTP requests is reduced. Note: When using HTTP/2, it may in fact be more bandwidth-friendly to use multiple small requests. Implementation Suppose an image is given to every item with class toolbtn: .toolbtn { background: url(myfile.png); display: inline-block; height: 20px; width: 20px; } A background position can be added either as two x, y values after the url()() in the background, or as background-position. For example: #btn1 { background-position: -20px 0px; } #btn2 { background-position: -40px 0px; } This would move the element with the ID 'btn1' 20 pixels to the left and the element with the ID 'btn2' 40 pixels to the left (as...
CSS Images - CSS: Cascading Style Sheets
CSS Images is a module of CSS that defines what types of images can be used (the <image> type, containing URLs, gradients and other types of images), how to resize them and how they, and other replaced content, interact with the different layout models. Reference Properties image-orientation image-rendering image-resolution object-fit object-position Functions linear-gradient() radial-gradient() repeating-linear-gradient() repeating-radial-gradient() conic-gradient() repeating-conic-gradient() url() element() image() cross-fade() Data types <gradient> <image> Guides Using CSS gradients Presents a specific type of CSS images, gradients, and how to create and use these. Implementing image sprites in CSS Describes the common technique grouping several i...
Consistent list indentation - CSS: Cascading Style Sheets
appendages to the list items, hanging outside the content-area of the <li> but still attached to the <li>. This is why, in every browser except Internet Explorer for Windows, markers are placed outside any border set for an <li> element, assuming the value of list-style-position is outside. If it's changed to inside, then the markers are brought inside the <li>'s content, as though they're an inline box placed at the very beginning of the <li>. Indenting It Twice So how will all this appear in a document? At the moment, we have a situation analogous to these styles: ul, li {margin-left: 0; padding-left: 0;} If we dropped this list into a document as-is, there would be no apparent indentation and the markers would be in danger of falling off the left edge of the browser window. In order ...
Using CSS counters - CSS: Cascading Style Sheets
Using the counters() function, separating text can be inserted between different levels of nested counters. Example of a nested counter CSS ol { counter-reset: section; /* Creates a new instance of the section counter with each ol ...
Stacking with floated blocks - CSS: Cascading Style Sheets
order of the non-positioned block (DIV #4) is completely unaffected by floating blocks, but the content is affected. This happens according to standard float behaviour. 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: the background and border of that block pops up above the floating blocks and the positioned blocks. This is due to a peculiar part of the specification: applying a opacity value creates a new stacking context ...
CSS Properties Reference - CSS: Cascading Style Sheets
ip clip color color cursor cursor display display filter filter float cssFloat font font font-family fontFamily font-size fontSize font-variant fontVariant font-weight fontWeight height height left left letter-spacing letterSpacing line-height lineHeight list-style listStyle list-style-image listStyleImage list-style-position listStylePosition list-style-type listStyleType margin margin margin-bottom marginBottom margin-left marginLeft margin-right marginRight margin-top marginTop overflow overflow ...
CSS Ruby Layout - CSS: Cascading Style Sheets
Web › CSS › CSS Ruby
They are typically used in East Asian documents to indicate pronunciation or to provide a short annotation. ...
Basic concepts of CSS Scroll Snap - CSS: Cascading Style Sheets
s in order to set the position that scrolling will snap to. The below example demonstrates scroll snapping along the y axis, with scroll-snap-align used on the section element to dictate the point the scrolling should stop. Using scroll-snap-type The scroll-snap-type property needs to know the direction in which scroll snapping happens. This could be x or y, or the logical mappings block or inline. You can also use the keyword both to have scroll snapping work along both axes. You can also pass in the keywords mandatory, or proximity. The mandatory keyword tells the browser whether the content has to snap to a certain point, no matter where the scroll is. The proximity keyword means that it may snap to the point, but does not have to. Using mandatory gives a very consistent experience -...
Browser compatibility and Scroll Snap - CSS: Cascading Style Sheets
In this initial example we have used the old specification alongside the current specification in order to make scroll snapping work in all browsers which support some form of scroll snapping. The example adds the scroll-snap-points-y and scroll-snap-destination properties, which are deprecated, to make scroll snapping work in Firefox. We also added the scroll-snap-type p...
CSS Scrollbars - CSS: Cascading Style Sheets
i. </div> Result Reference CSS Properties scrollbar-width scrollbar-color Specifications Specification Status Comment CSS Scrollbars Level 1 Working Draft Initial definition. Accessibility concerns When you customize scrollbars, consider they have enough contrast and that their hit area is large enough for people who use touch input. Baseline Rules for Scrollbar Usability | Adrian Roselli Browser compatibility The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request. scrollbar-width DesktopMobileChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for Andro...
CSS selectors - CSS: Cascading Style Sheets
td will match all <td> elements that belong to the scope of the <col>. Pseudo Pseudo classes The : pseudo allow the selection of elements based on state information that is not contained in the document tree. Example: a:visited will match all <a> elements that have been visited by the user. Pseudo elements The :: pseudo represent entities that are not included in HTML. Example: p::first-line will match the first line of all <p> elements. Specifications Specification Status Comment Selectors Level 4 Working Draft Added the || column combinator, grid structural selectors, logical combinators, location, time-demensional, resource state, linguistic and UI pseudo-classes, modifier for ASCII case-sensitive and case-insensitive attribute value selection.
Shapes from box values - CSS: Cascading Style Sheets
he border-box value is the shape defined by the outside border edge. This shape follows all of the normal border radius shaping rules for the outside of the border. You still have a border, even if you have not used the CSS border property. In this case it will be the same as padding-box, the shape defined by the outside padding edge. In the example below you can see how the text now follows the line created by the border. Change the border size and the content follows it. padding-box The padding-box value defines the shape enclosed by the outside padding edge. This shape follows all of the normal border radius shaping rules for the inside of the border. If you have no padding then padding-box is the same as content-box. content-box The content-box value defines the shape enclosed by ...
Shapes From Images - CSS: Cascading Style Sheets
using a larger star image to shape my content without displaying any image on the page. Creating shapes using a gradient As a CSS gradient is treated as an image, you can use a gradient to generate your shape, by having transparent or semi-transparent areas as part of the gradient. In this next example I have used generated content and floated this content, giving it a background image of a linear gradient. I am using that same value as the value of shape-outside. The linear gradient goes from purple to transparent, so by changing the value of shape-image-threshold I can decide how transparent the pixels need to be that create my shape. You can play with that value in the example below to see how the diagonal line will move across the shape depending on that value. You could also try re...
CSS Shapes - CSS: Cascading Style Sheets
CSS Shapes describe geometric shapes for use in CSS. For the Level 1 specification, CSS Shapes can be applied to floating elements. The specification defines a number of different ways to define a shape on a floated element, causing wrapping lines to wrap round the shape rather than following the rectangle of the element's box. 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%). This creates a circle shape, and the content wrapping the float now wraps around that shape. This changes the length of the wrapping text's line boxes. Reference Properties shape-image-threshold shape-margin shape-outside Data types <basic-shape> Guides Overview of CSS Shapes Shapes from Box Values Bas...
CSS Text - CSS: Cascading Style Sheets
Web › CSS › CSS Text
CSS Text is a module of CSS that defines how to perform text manipulation, like line breaking, justification and alignment, white space handling, and text transformation. Reference Properties hanging-punctuation hyphens letter-spacing line-break overflow-wrap tab-size text-align text-align-last text-indent text-justify text-size-adjust text-transform white-space word-break word-spacing Specifications Specification Status Comment CSS Logical Properties and Values Level 1 Editor's Draft Updates some properties to be independent of the directionality of the text. CSS Text Module Level 3 Working Draft CSS Level 2 (Revision 1) Recommendation CSS Level 1 Recommendation Initial definition ...
Introducing the CSS Cascade - CSS: Cascading Style Sheets
Web › CSS › Cascade
lues from only one single @keyframes, and never mixes multiple ones together. When several keyframes are appropriate, it chooses the latest defined in the most important document, but never combined all together. ...
Comments - CSS: Cascading Style Sheets
Web › CSS › Comments
A CSS comment is used to add explanatory notes to the code or to prevent the browser from interpreting specific parts of the style sheet. By design, comments have no effect on the layout of a document. Syntax Comments can be placed wherever white space is allowed within a style sheet. They can be used on a single line, or traverse multiple lines. /* Comment */ Examples /* A one-line comment */ /* A comment which stretches over several lines */ /* The comment below is used to disable specific styling */ /* span { color: blue; font-size: 1.5em; } */ Notes The /* */ comment syntax is used for both single and multiline comments. There is no other way to specify comments in external style sheets. However, when using the <style> element, you may use <!-- --> to hide CSS from older ...
Descendant combinator - CSS: Cascading Style Sheets
ent, etc) element matching the first selector. Selectors that utilize a descendant combinator are called descendant selectors. /* List items that are descendants of the "my-things" list */ ul.my-things li { margin: 2em; } The descendant combinator is technically one or more CSS white space characters -- the space character and/or one of four control characters: carriage return, form feed, new line, and tab characters -- between two selectors in the absence of another combinator. Additionally, the white space characters of which the combinator is comprised may contain any number of CSS comments. Syntax selector1 selector2 { /* property declarations */ } Examples CSS li { list-style-type: disc; } li li { list-style-type: circle; } HTML <ul> <li> <div>Item 1</div> <ul...
Breadcrumb Navigation - CSS: Cascading Style Sheets
Breadcrumb navigation helps the user to understand their location in the website by providing a breadcrumb trail back to the start page. Requirements The items typically display inline with a separator to indicate a hierarchy between individual pages. Recipe Download this example Note: The example above uses two selectors to insert content before every li except the first one. This could also be achieved using one selector only: .breadcrumb li:not(:first-child)::before { content: "->"; } This solution uses a more complex selector, but requires less rules. Feel free to choose the solution that you prefer. Choices made This pattern is laid out using a simple flex layout demonstrating how a line of CSS can give us our navigation. The separators are added using CSS Generated C...
Card - CSS: Cascading Style Sheets
This pattern is a list of "card" components with optional footers. Requirements The card component can contain a variety of content, including a heading, image, content and a footer. Each card should be the same height, and footers should stick to the bottom of the card. When added to a collection of cards, the cards should line up in two dimensions. Recipe Download this example Choices made The card is laid out using CSS Grid Layout despite being a single dimensional layout, as it enables the use of content sizing for the grid tracks. When setting up the single column grid I use the following: .card { display: grid; grid-template-rows: max-content 200px 1fr; } The heading track is set to max-content, which prevents it from stretching. I have decided that I want my image t...
Center an element - CSS: Cascading Style Sheets
lignment properties it is now straightforward. Requirements To place an item into the center of another box horizontally and vertically. Recipe Download this example Choices made To center one box inside another we make the containing box a flex container. Then set align-items to center to perform centering on the block axis, and justify-content to center to perform centering on the inline axis. In the future we may be able to center elements without needing to turn the parent into a flex container, as the Box Alignment properties used here are specified to apply to block layout too. However, support is currently limited for box alignment properties on block layout, so currently centering using Flexbox is the most robust way to achieve this. ...
List group with badges - CSS: Cascading Style Sheets
In this recipe we will create a list group pattern with badges that indicate a count. Requirements Our list items should be displayed with the badges lined up on the right, no matter how much content the item has. The badge should always be centered vertically whether there is a single line of content, or more than one. Recipe Download this example Choices made Flexbox makes this particular pattern straightforward and also makes it easy to make changes to the layout. To ensure the text and badge line up correctly I use the justify-content property with a value of space-between. This places any extra space between the items. In the live example, if you remove this property and you will see the badge move to the end of the text on items with text shorter than the one line. To alig...
CSS Layout cookbook - CSS: Cascading Style Sheets
...
Layout mode - CSS: Cascading Style Sheets
SS layout mode, sometimes simply called layout, is an algorithm that determines the position and size of boxes based on the way they interact with their sibling and ancestor boxes. There are several of them: Normal flow -- all elements are part of normal flow until you do something to take them out of it. Normal flow includes block layout, designed for laying out boxes such as paragraphs and inline layout, which lays out inline items such as text. Table layout, designed for laying out tables. Float layout, designed to cause an item to position itself left or right with the rest of the content in normal flow wrapping around it. Positioned layout, designed for positioning elements without much interaction with other elements. Multi-column layout, designed for laying content out in columns...
Using Media Queries for Accessibility - CSS: Cascading Style Sheets
ser has notified the system that they prefer an interface that minimizes the amount of movement or animation, preferably to the point where all non-essential movement is removed. Example This example has an annoying animation unless you turn on Reduce Motion in your accessibility preferences. HTML <div class="animation">animated box</div> CSS .animation { -webkit-animation: vibrate 0.3s linear infinite both; animation: vibrate 0.3s linear infinite both; } @media (prefers-reduced-motion: reduce) { .animation { animation: none; } } High Contrast Mode The -ms-high-contrast CSS media feature is a Microsoft extension that describes whether the application is being displayed in high contrast mode, and with what color variation. This will help not only users with low visio...
Using media queries - CSS: Cascading Style Sheets
nment Added in Media Queries Level 5. monochrome Bits per pixel in the output device's monochrome frame buffer, or zero if the device isn't monochrome orientation Orientation of the viewport overflow-block How does the output device handle content that overflows the viewport along the block axis? Added in Media Queries Level 4. overflow-inline Can content that overflows the viewport along the inline axis be scrolled? Added in Media Queries Level 4. pointer Is the primary input mechanism a pointing device, and if so, how accurate is it? Added in Media Queries Level 4. prefers-color-scheme Detect if the user prefers a light or dark color scheme Added in Media Queries Level 5. prefers-contrast ...
Microsoft CSS extensions - CSS: Cascading Style Sheets
re not on a standards track. ...
Replaced elements - CSS: Cascading Style Sheets
erm "Widgets"). Objects inserted using the CSS content property are anonymous replaced elements. They are "anonymous" because they don't exist in the HTML markup. Using CSS with replaced elements CSS handles replaced elements specifically in some cases, like when calculating margins and some auto values. Note that some replaced elements, but not all, have intrinsic dimensions or a defined baseline, which is used by some CSS properties, such as vertical-align. Only replaced elements can ever have intrinsic dimensions. Controlling object position within the content box Certain CSS properties can be used to specify how the object contained within the replaced element should be positioned within the element's box area. These are defined by the CSS Images Module Level 3 and CSS Images Module ...
Selector list - CSS: Cascading Style Sheets
The CSS selector list (,) selects all the matching nodes. /* Selects all matching elements */ span, div { border: red 2px solid; } To reduce the size of style sheets, one can group selectors in comma-separated lists. Syntax element, element, element { style properties } Examples Single Line Grouping Grouping selectors in a single line using a comma-separated lists. h1, h2, h3, h4, h5, h6 { font-family: helvetica; } Multi Line Grouping Grouping selectors in a multiple lines using a comma-separated lists. #main, .content, article { font-size: 1.1em; } Selector list invalidation A downside to using selector lists is that the following aren't equivalent: h1 { font-family: sans-serif } h2:maybe-unsupported { font-family: sans-serif } h3 { font-family: sans-serif } h1, h2:maybe...
Tools - CSS: Cascading Style Sheets
Web › CSS › Tools
tures that can be tricky to use, or have a number of parameters, so that it's helpful to be able to visualize them while you work on them. This page offers links to a number of useful tools that will help you build the CSS to style your content using these features. Cubic Bezier GeneratorThis is a sample tool; it lets you edit Bezier curves. This is not really yet a useful tool, but will be!Linear-gradient GeneratorThis tool can be used to create custom CSS3 linear-gradient() backgrounds. Other tools CSS animation - Stylie To check the device display information (helpful in responsive web design) - mydevice.io CSS Menus - cssmenumaker.com A mighty, modern CSS linter that helps you enforce consistent conventions and avoid errors in your stylesheets - stylelint ...
aspect-ratio - CSS: Cascading Style Sheets
e box has no preferred aspect ratio. Size calculations involving intrinsic aspect ratio always work with the content box dimensions. <ratio> The box's preferred aspect ratio is the specified ratio of width / height. Size calculations involving preferred aspect ratio work with the dimensions of the box specified by box-sizing. Formal definition Initial valueautoApplies toall elements except inline boxes and internal ruby or table boxesInheritednoComputed valueas specifiedAnimation typediscrete Formal syntax auto | <ratio> Examples Mapping width and height to aspect-ratio Firefox has added an internal aspect-ratio property (in version 69 onwards) that applies to replaced elements and other related elements that accept width and height attributes. This appears in the browser's internal ...
backface-visibility - CSS: Cascading Style Sheets
lity: 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%; transform-style: preserve-3d; } .face { display: block; position: absolute; width: 100px; height: 100px; border: none; line-height: 100px; font-family: sans-serif; font-size: 60px; color: white; text-align: center; } /* Define each face based on direction */ .front { background: rgba(0, 0, 0, 0.3); transform: translateZ(50px); } .back { background: rgba(0, 255, 0, 1); color: black; transform: rotateY(180deg) translateZ(50px); } .right { background: rgba(196, 0, 0, 0.7); transform: rotateY(90de...
background-attachment - CSS: Cascading Style Sheets
ting area and background positioning area are relative to the scrollable area of the element rather than to the border framing them. scroll The background is fixed relative to the element itself and does not scroll with its contents. (It is effectively attached to the element's border.) Formal definition Initial valuescrollApplies toall elements. ...
background-blend-mode - CSS: Cascading Style Sheets
-blend-mode: initial; background-blend-mode: inherit; background-blend-mode: unset; Values <blend-mode> The blending mode to be applied. There can be several values, separated by commas. Formal definition Initial valuenormalApplies toAll elements. In SVG, it applies to container elements, graphics elements, and graphics referencing elements.. ...
background-origin - CSS: Cascading Style Sheets
erty is specified as one of the keyword values listed below. Values border-box The background is positioned relative to the border box. padding-box The background is positioned relative to the padding box. content-box The background is positioned relative to the content box. Formal definition Initial valuepadding-boxApplies toall elements. ...
background-position-x - CSS: Cascading Style Sheets
No support NoSamsung Internet Android No support NoLegend Full support Full support No support No support See also background-position background-position-y background-position-inline background-position-block Using multiple backgrounds ...
background-position-y - CSS: Cascading Style Sheets
No support NoSamsung Internet Android No support NoLegend Full support Full support No support No support See also background-position background-position-x background-position-inline background-position-block Using multiple backgrounds ...
<basic-shape> - CSS: Cascading Style Sheets
h data command as real numbers. In all other cases no interpolation occurs. Examples Animated polygon In this example, we use the @keyframes at-rule to animate a clip path between two polygons. Note that both polygons have the same number of vertices, which is necessary for this type of animation to work. ...
block-size - CSS: Cascading Style Sheets
ck-size: 75%; /* Keyword values */ block-size: max-content; block-size: min-content; block-size: fit-content(20em); block-size: auto; /* Global values */ block-size: inherit; block-size: initial; block-size: unset; If the writing mode is vertically oriented, the value of block-size relates to the width of the element; otherwise, it relates to the height of the element. A related property is inline-size, which defines the other dimension of the element. Initial valueautoApplies tosame as width and heightInheritednoPercentagesblock-size of containing blockComputed valuesame as width and heightAnimation typea length, percentage or calc(); Syntax Values The block-size property takes the same values as the width and height properties. Formal definition Initial valueautoApplies tosame as w...
border-block-color - CSS: Cascading Style Sheets
nding on the element's writing mode, directionality, and text orientation. It corresponds to the border-top-color and border-bottom-color, or border-right-color and border-left-color property depending on the values defined for writing-mode, direction, and text-orientation. border-block-color: yellow; border-block-color: #F5F6F7; The border color in the other dimension can be set with border-inline-color which sets border-inline-start-color, and border-inline-end-color. Syntax Values <'color'> The color of the border. See color. Formal definition Initial valuecurrentcolorApplies toall elementsInheritednoComputed valuecomputed colorAnimation typediscrete Formal syntax <'border-top-color'>{1,2} Examples Border with vertical text HTML <div> <p class="exampleText">Example text<...
border-block-end-color - CSS: Cascading Style Sheets
mode, direction, and text-orientation. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Syntax border-block-end-color: yellow; border-block-end-color: #F5F6F7; Related properties are border-block-start-color, border-inline-start-color, and border-inline-end-color, which define the other border colors of the element. Values <'color'> The color of the border. See color. Formal definition Initial valuecurrentcolorApplies toall elementsInheritednoComputed valuecomputed colorAnimation typea color Formal syntax <'border-top-color'> Examples Border color with vertical text HTML <div> <p class="exampleText"...
border-block-end-style - CSS: Cascading Style Sheets
interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Syntax /* <'border-style'> values */ border-block-end-style: dashed; border-block-end-style: dotted; border-block-end-style: groove; Related properties are border-block-start-style, border-inline-start-style, and border-inline-end-style, which define the other border styles of the element. Values <'border-style'> The line style of the border. See border-style. Formal definition Initial valuenoneApplies toall elementsInheritednoComputed valueas specifiedAnimation typediscrete Formal syntax <'border-top-style'> Examples Dashed border with vertical text HTML <div> <p class="e...
border-block-end-width - CSS: Cascading Style Sheets
-orientation. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Syntax /* <'border-width'> values */ border-block-end-width: 5px; border-block-end-width: thick; Related properties are border-block-start-width, border-inline-start-width, and border-inline-end-width, which define the other border widths of the element. Values <'border-width'> The width of the border. See border-width. Formal definition Initial valuemediumApplies toall elementsInheritednoPercentageslogical-width of containing blockComputed valueabsolute length; 0 if the border style is none or hiddenAnimation typea length Formal syntax <'bord...
border-block-end - CSS: Cascading Style Sheets
end-width, border-block-end-style, and border-block-end-color. The physical border to which it maps depends on the element's writing mode, directionality, and text orientation. It corresponds to the border-top, border-right, border-bottom, or border-left property depending on the values defined for writing-mode, direction, and text-orientation. Related properties are border-block-start, border-inline-start, and border-inline-end, which define the other borders of the element. Values The border-block-end is specified with one or more of the following, in any order: <'border-width'> The width of the border. See border-width. <'border-style'> The line style of the border. See border-style. <'color'> The color of the border. See color. Formal definition Initial valueas each of the pr...
border-block-start-color - CSS: Cascading Style Sheets
mode, direction, and text-orientation. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Syntax border-block-start-color: blue; border-block-start-color: #4c5d21; Related properties are border-block-end-color, border-inline-start-color, and border-inline-end-color, which define the other border colors of the element. Values <'color'> See border-color Formal definition Initial valuecurrentcolorApplies toall elementsInheritednoComputed valuecomputed colorAnimation typea color Formal syntax <'border-top-color'> Examples Border color with vertical text HTML <div> <p class="exampleText">Example text</p> <...
border-block-start-style - CSS: Cascading Style Sheets
eractive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Syntax /* <'border-style'> values */ border-block-start-style: dashed; border-block-start-style: dotted; border-block-start-style: groove; Related properties are border-block-end-style, border-inline-start-style, and border-inline-end-style, which define the other border styles of the element. Values <'border-style'> The line style of the border. See border-style. Formal definition Initial valuenoneApplies toall elementsInheritednoComputed valueas specifiedAnimation typediscrete Formal syntax <'border-top-style'> Examples Dashed border wtih vertical text HTML <div> <p class="e...
border-block-start-width - CSS: Cascading Style Sheets
rientation. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Syntax /* <'border-width'> values */ border-block-start-width: 5px; border-block-start-width: thick; Related properties are border-block-end-width, border-inline-start-width, and border-inline-end-width, which define the other border widths of the element. Initial valuemediumApplies toall elementsInheritednoPercentageslogical-width of containing blockComputed valueabsolute length; 0 if the border style is none or hiddenAnimation typea length Values <'border-width'> The width of the border. See border-width. Formal definition Initial valuemediumAp...
border-block-start - CSS: Cascading Style Sheets
t-width, border-block-start-style, and border-block-start-color. The physical border to which it maps depends on the element's writing mode, directionality, and text orientation. It corresponds to the border-top, border-right, border-bottom, or border-left property depending on the values defined for writing-mode, direction, and text-orientation. Related properties are border-block-end, border-inline-start, and border-inline-end, which define the other borders of the element. Values The border-block-start is specified with one or more of the following, in any order: <'border-width'> The width of the border. See border-width. <'border-style'> The line style of the border. See border-style. <'color'> The color of the border. See color. Formal definition Initial valueas each of the ...
border-block-style - CSS: Cascading Style Sheets
xt orientation. It corresponds to the border-top-style and border-bottom-style, or border-left-style and border-right-style properties depending on the values defined for writing-mode, direction, and text-orientation. /* <'border-style'> values */ border-block-style: dashed; border-block-style: dotted; border-block-style: groove; The border style in the other dimension can be set with border-inline-style, which sets border-inline-start-style, and border-inline-end-style. Syntax Values <'border-style'> The line style of the border. See border-style. Formal definition Initial valuenoneApplies toall elementsInheritednoComputed valueas specifiedAnimation typediscrete Formal syntax <'border-top-style'> Examples Dashed border with vertical text HTML <div> <p class="exampleText">E...
border-block-width - CSS: Cascading Style Sheets
ting mode, directionality, and text orientation. It corresponds to the border-top-width and border-bottom-width, or border-left-width, and border-right-width property depending on the values defined for writing-mode, direction, and text-orientation. /* <'border-width'> values */ border-block-width: 5px; border-block-width: thick; The border width in the other dimension can be set with border-inline-width, which sets border-inline-start-width, and border-inline-end-width. Syntax Values <'border-width'> The width of the border. See border-width. Formal definition Initial valuemediumApplies toall elementsInheritednoPercentageslogical-width of containing blockComputed valueabsolute length; 0 if the border style is none or hiddenAnimation typediscrete Formal syntax <'border-top-width'...
border-bottom-left-radius - CSS: Cascading Style Sheets
semi-minor axes of the ellipse. As absolute length it can be expressed in any unit allowed by the CSS <length> data type. Percentages for the horizontal axis refer to the width of the box, percentages for the vertical axis refer to the height of the box. Negative values are invalid. Formal definition Initial value0Applies toall elements; but User Agents are not required to apply to table and inline-table elements when border-collapse is collapse. The behavior on internal table elements is undefined for the moment.. It also applies to ::first-letter.InheritednoPercentagesrefer to the corresponding dimension of the border boxComputed valuetwo absolute <length>s or <percentage>sAnimation typea length, percentage or calc(); Formal syntax <length-percentage>{1,2}where <length-percentage> = <le...
border-bottom-right-radius - CSS: Cascading Style Sheets
semi-minor axes of the ellipse. As absolute length it can be expressed in any unit allowed by the CSS <length> data type. Percentages for the horizontal axis refer to the width of the box, percentages for the vertical axis refer to the height of the box. Negative values are invalid. Formal definition Initial value0Applies toall elements; but User Agents are not required to apply to table and inline-table elements when border-collapse is collapse. The behavior on internal table elements is undefined for the moment.. It also applies to ::first-letter.InheritednoPercentagesrefer to the corresponding dimension of the border boxComputed valuetwo absolute <length>s or <percentage>sAnimation typea length, percentage or calc(); Formal syntax <length-percentage>{1,2}where <length-percentage> = <le...
border-color - CSS: Cascading Style Sheets
e is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Each side can be set individually using border-top-color, border-right-color, border-bottom-color, and border-left-color; or using the writing mode-aware border-block-start-color, border-block-end-color, border-inline-start-color, and border-inline-end-color. You can find more information about border colors in Borders in Applying color to HTML elements using CSS. Constituent properties This property is a shorthand for the following CSS properties: border-bottom-color border-left-color border-right-color border-top-color Syntax /* <color> values */ border-color: red; /* horizontal | vertical */ bo...
border-end-end-radius - CSS: Cascading Style Sheets
semi-minor axes of the ellipse. As absolute length it can be expressed in any unit allowed by the CSS <length> data type. Percentages for the horizontal axis refer to the width of the box, percentages for the vertical axis refer to the height of the box. Negative values are invalid. Formal definition Initial value0Applies toall elements; but User Agents are not required to apply to table and inline-table elements when border-collapse is collapse. The behavior on internal table elements is undefined for the moment.. It also applies to ::first-letter.InheritednoPercentagesrefer to the corresponding dimension of the border boxComputed valuetwo absolute <length>s or <percentage>sAnimation typea length, percentage or calc(); Formal syntax <length-percentage>{1,2}where <length-percentage> = <le...
border-end-start-radius - CSS: Cascading Style Sheets
semi-minor axes of the ellipse. As absolute length it can be expressed in any unit allowed by the CSS <length> data type. Percentages for the horizontal axis refer to the width of the box, percentages for the vertical axis refer to the height of the box. Negative values are invalid. Formal definition Initial value0Applies toall elements; but User Agents are not required to apply to table and inline-table elements when border-collapse is collapse. The behavior on internal table elements is undefined for the moment.. It also applies to ::first-letter.InheritednoPercentagesrefer to the corresponding dimension of the border boxComputed valuetwo absolute <length>s or <percentage>sAnimation typea length, percentage or calc(); Formal syntax <length-percentage>{1,2}where <length-percentage> = <le...
border-image-slice - CSS: Cascading Style Sheets
hese regions form the components of an element's border image. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. The slicing process creates nine regions in total: four corners, four edges, and a middle region. Four slice lines, set a given distance from their respective sides, control the size of the regions. The above diagram illustrates the location of each region. Zones 1-4 are corner regions. Each one is used a single time to form the corners of the final border image. Zones 5-8 are edge regions. These are repeated, scaled, or otherwise modified in the final border image to match the dimensions of the eleme...
border-radius - CSS: Cascading Style Sheets
The behavior on internal table elements is undefined for the moment.. It also applies to ::first-letter.InheritednoPercentagesrefer to the corresponding dimension of the border boxComputed valueas each of the properties of the shorthand:border-bottom-left-radius: two absolute <length>s or <percentage>sborder-bottom-right-radius: two absolute <lengt...
border-spacing - CSS: Cascading Style Sheets
en cells. When two <length> values are specified, the first value defines the horizontal spacing between cells (i.e., the space between cells in adjacent columns), and the second value defines the vertical spacing between cells (i.e., the space between cells in adjacent rows). Values <length> The size of the spacing as a fixed value. Formal definition Initial value0Applies totable and inline-table elementsInheritedyesComputed valuetwo absolute lengthsAnimation typediscrete Formal syntax <length> <length>? Examples Spacing and padding table cells This example applies a spacing of .5em vertically and 1em horizontally between a table's cells. Note how, along its outside edges, the table's padding values are added to its border-spacing values. HTML <table> <tr> <td>1</td><td...
border-start-end-radius - CSS: Cascading Style Sheets
semi-minor axes of the ellipse. As absolute length it can be expressed in any unit allowed by the CSS <length> data type. Percentages for the horizontal axis refer to the width of the box, percentages for the vertical axis refer to the height of the box. Negative values are invalid. Formal definition Initial value0Applies toall elements; but User Agents are not required to apply to table and inline-table elements when border-collapse is collapse. The behavior on internal table elements is undefined for the moment.. It also applies to ::first-letter.InheritednoPercentagesrefer to the corresponding dimension of the border boxComputed valuetwo absolute <length>s or <percentage>sAnimation typea length, percentage or calc(); Formal syntax <length-percentage>{1,2}where <length-percentage> = <le...
border-start-start-radius - CSS: Cascading Style Sheets
semi-minor axes of the ellipse. As absolute length it can be expressed in any unit allowed by the CSS <length> data type. Percentages for the horizontal axis refer to the width of the box, percentages for the vertical axis refer to the height of the box. Negative values are invalid. Formal definition Initial value0Applies toall elements; but User Agents are not required to apply to table and inline-table elements when border-collapse is collapse. The behavior on internal table elements is undefined for the moment.. It also applies to ::first-letter.InheritednoPercentagesrefer to the corresponding dimension of the border boxComputed valuetwo absolute <length>s or <percentage>sAnimation typea length, percentage or calc(); Formal syntax <length-percentage>{1,2}where <length-percentage> = <le...
border-top-left-radius - CSS: Cascading Style Sheets
semi-minor axes of the ellipse. As absolute length it can be expressed in any unit allowed by the CSS <length> data type. Percentages for the horizontal axis refer to the width of the box, percentages for the vertical axis refer to the height of the box. Negative values are invalid. Formal definition Initial value0Applies toall elements; but User Agents are not required to apply to table and inline-table elements when border-collapse is collapse. The behavior on internal table elements is undefined for the moment.. It also applies to ::first-letter.InheritednoPercentagesrefer to the corresponding dimension of the border boxComputed valuetwo absolute <length>s or <percentage>sAnimation typea length, percentage or calc(); Formal syntax <length-percentage>{1,2}where <length-percentage> = <le...
border-top-right-radius - CSS: Cascading Style Sheets
semi-minor axes of the ellipse. As absolute length it can be expressed in any unit allowed by the CSS <length> data type. Percentages for the horizontal axis refer to the width of the box, percentages for the vertical axis refer to the height of the box. Negative values are invalid. Formal definition Initial value0Applies toall elements; but User Agents are not required to apply to table and inline-table elements when border-collapse is collapse. The behavior on internal table elements is undefined for the moment.. It also applies to ::first-letter.InheritednoPercentagesrefer to the corresponding dimension of the border boxComputed valuetwo absolute <length>s or <percentage>sAnimation typea length, percentage or calc(); Formal syntax <length-percentage>{1,2}where <length-percentage> = <le...
bottom - CSS: Cascading Style Sheets
Web › CSS › bottom
yntax <length> | <percentage> | auto Examples Absolute and fixed positioning This example demonstrates the difference in behavior of the bottom property, when position is absolute versus fixed. ...
box-direction - CSS: Cascading Style Sheets
Notes The edge of the box designated the start for layout purposes depends on the box's orientation: Horizontal left Vertical top The edge opposite to the start is designated the end. If the direction is set using the element's dir attribute, then the style is ignored. Formal definition Initial valuenormalApplies toelements with a CSS display value of box or inline-boxInheritednoComputed valueas specifiedAnimation typediscrete Formal syntax normal | reverse | inherit Examples Setting box direction .example { /* bottom-to-top layout */ -moz-box-direction: reverse; /* Mozilla */ -webkit-box-direction: reverse; /* WebKit */ box-direction: reverse; /* As specified */ } Specifications Not part of any standard. Browser compatibil...
box-sizing - CSS: Cascading Style Sheets
ng, this is then added to the width and height to arrive at the size of the box that's rendered on the screen. This means that when you set width and height, you have to adjust the value you give to allow for any border or padding that may be added. For example, if you have four boxes with width: 25%;, if any has left or right padding or a left or right border, they will not by default fit on one line within the constraints of the parent container. The box-sizing property can be used to adjust this behavior: content-box gives you the default CSS box-sizing behavior. If you set an element's width to 100 pixels, then the element's content box will be 100 pixels wide, and the width of any border or padding will be added to the final rendered width, making the element wider than 100px. border...
break-after - CSS: Cascading Style Sheets
n sed pellentesque augue. Nam risus justo, faucibus non porta a, congue vel massa. Cras luctus lacus nisl, sed tincidunt velit pharetra ac. Duis suscipit faucibus dui sed ultricies.</p> </article> CSS html { font-family: helvetica, arial, sans-serif; } h1 { font-size: 3rem; letter-spacing: 2px; column-span: all; } h2 { font-size: 1.2rem; color: red; letter-spacing: 1px; } p { line-height: 1.5; break-after: column; } article { column-width: 200px; gap: 20px; } Result Specifications Specification Status Comment CSS Fragmentation Module Level 3The definition of 'break-after' in that specification. Candidate Recommendation Adds the recto and verso keywords. Changes the media type of this property from paged to visual. Defines the b...
break-before - CSS: Cascading Style Sheets
. Nam risus justo, faucibus non porta a, congue vel massa. Cras luctus lacus nisl, sed tincidunt velit pharetra ac. Duis suscipit faucibus dui sed ultricies.</p> </article> CSS html { font-family: helvetica, arial, sans-serif; } h1 { font-size: 3rem; letter-spacing: 2px; column-span: all; } h2 { font-size: 1.2rem; color: red; letter-spacing: 1px; break-before: column; } p { line-height: 1.5; } article { column-width: 200px; gap: 20px; } Result Specifications Specification Status Comment CSS Fragmentation Module Level 3The definition of 'break-before' in that specification. Candidate Recommendation Adds the recto and verso keywords. Changes the media type of this property from paged to visual. Defines the breaking algorithm with...
break-inside - CSS: Cascading Style Sheets
pellentesque augue. Nam risus justo, faucibus non porta a, congue vel massa. Cras luctus lacus nisl, sed tincidunt velit pharetra ac. ...
calc() - CSS: Cascading Style Sheets
Web › CSS › calc
> [ '*' <calc-value> | '/' <number> ]*where <calc-value> = <number> | <dimension> | <percentage> | ( <calc-sum> ) Accessibility concerns When calc() is used for controlling text size, be sure that one of the values includes a relative length unit, for example: h1 { font-size: calc(1.5rem + 3vw); } This ensures that text size will scale if the page is zoomed. MDN Understanding WCAG, Guideline 1.4 explanations Understanding Success Criterion 1.4.4 | W3C Understanding WCAG 2.0 Usage with integers When calc() is used where an <integer> is expected, the value will be rounded to the nearest integer. For example: .modal { z-index: calc(3 / 2); } This will give .modal a final z-index value of 2. Note: The Chrome browser currently won't accept some values returned by calc() when an ...
caret-color - CSS: Cascading Style Sheets
By default, it is black, but its color can be altered with this property. ...
clip-path - CSS: Cascading Style Sheets
Web › CSS › clip-path
flex-direction: row; flex-wrap: wrap; } .col { flex: 1 auto; } .cell { margin: .5em; padding: .5em; background-color: #FFF; overflow: hidden; text-align: center; flex: 1; } .note { background: #fff3d4; padding: 1em; margin: .5em .5em 0; font: .8em sans-serif; text-align: left; white-space: nowrap; } .note + .row .cell { margin-top: 0; } .container { display: inline-block; border: 1px dotted grey; position:relative; } .container:before { content: 'margin'; position: absolute; top: 2px; left: 2px; font: italic .6em sans-serif; } .viewbox { box-shadow: 1rem 1rem 0 #EFEFEF inset, -1rem -1rem 0 #EFEFEF inset; } .container.viewbox:after { content: 'viewbox'; position: absolute; left: 1.1rem; top: 1.1rem; font: italic .6em sans-serif; ...
<color> - CSS: Cascading Style Sheets
ightgreen #90ee90 lightgrey #d3d3d3 lightpink #ffb6c1 lightsalmon #ffa07a lightseagreen #20b2aa lightskyblue #87cefa lightslategray #778899 lightslategrey #778899 lightsteelblue #b0c4de lightyellow #ffffe0 limegreen #32cd32 linen #faf0e6 magenta (synonym of fuchsia) #ff00ff mediumaquamarine #66cdaa mediumblue #0000cd mediumorchid #ba55d3 mediumpurple #9370db mediumseagreen #3cb371 mediumslateblue #7b68ee mediumspringgreen #00fa9a mediumturquoise #48d1cc medium...
column-rule - CSS: Cascading Style Sheets
The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. It is a shorthand property that sets the individual column-rule-* properties in a single, convenient declaration: column-rule-width, column-rule-style, and column-rule-color. ...
<custom-ident> - CSS: Cascading Style Sheets
rty that uses <custom-ident> forbids the use of specific values: animation-name Forbids the global CSS values (unset, initial, and inherit), as well as none. counter-reset counter-increment Forbids the global CSS values (unset, initial, and inherit), as well as none. @counter-style list-style-type Forbids the global CSS values (unset, initial, and inherit), as well as the values none, inline, and outside. Also, quite a few predefined values are implemented by the different browsers: disc, circle, square, decimal, cjk-decimal, decimal-leading-zero, lower-roman, upper-roman, lower-greek, lower-alpha, lower-latin, upper-alpha, upper-latin, arabic-indic, armenian, bengali, cambodian, cjk-earthly-branch, cjk-heavenly-stem, cjk-ideographic, devanagari, ethiopic-numeric, georgian, gujarati,...
direction - CSS: Cascading Style Sheets
Web › CSS › direction
perties which are not affected by the all shorthand property. Syntax /* Keyword values */ direction: ltr; direction: rtl; /* Global values */ direction: inherit; direction: initial; direction: unset; Values ltr Text and other elements go from left to right. This is the default value. rtl Text and other elements go from right to left. For the direction property to have any effect on inline-level elements, the unicode-bidi property's value must be embed or override. Formal definition Initial valueltrApplies toall elementsInheritedyesComputed valueas specifiedAnimation typediscrete Formal syntax ltr | rtl Examples Setting right-to-left direction blockquote { direction: rtl; } Specifications Specification Status Comment CSS Writing Modes Module ...
element() - CSS: Cascading Style Sheets
Web › CSS › element
ound element uses a gradient, but also includes text that is rendered as part of the background. <div style="width:400px; height:400px; background:-moz-element(#myBackground1) no-repeat;"> <p>This box uses the element with the #myBackground1 ID as its background!</p> </div> <div style="overflow:hidden; height:0;"> <div id="myBackground1" style="width:1024px; height:1024px; background-image: linear-gradient(to right, red, orange, yellow, white);"> <p style="transform-origin:0 0; transform: rotate(45deg); color:white;">This text is part of the background. Cool, huh?</p> </div> </div> The <div> element with the ID "myBackground1" is used as the background for the content including the paragraph "This box uses the element with the #myBackground1 ID as its background!". A somewhat mor...
brightness() - CSS: Cascading Style Sheets
Its result is a <filter-function>. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Syntax brightness(amount) Parameters amount The brightness of the result, specified as a <number> or a <percentage>. A value under 100% darkens the image, while a value over 100% brightens it. A value of 0% will create an image that is completely black, while a value of 100% leaves the input unchanged. The lacuna value for interpolation is 1. ...
grayscale() - CSS: Cascading Style Sheets
itory. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Syntax grayscale(amount) Parameters amount The amount of the conversion, specified as a <number> or a <percentage>. A value of 100% is completely grayscale, while a value of 0% leaves the input unchanged. Values between 0% and 100% are linear multipliers on the effect. Default value when omitted is 1. The initial value for interpolation is 0. Examples grayscale(0) /* No effect */ grayscale(.7) /* 70% grayscale */ grayscale(100%) /* Completely grayscale */ Specifications Specification Status Filter Effects Module Level 1The definition of 'grayscale()' in that specification. Working Draft ...
invert() - CSS: Cascading Style Sheets
epository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Syntax invert(amount) Parameters amount The amount of the conversion, specified as a <number> or a <percentage>. A value of 100% is completely inverted, while a value of 0% leaves the input unchanged. Values between 0% and 100% are linear multipliers on the effect. The lacuna value for interpolation is 0. Examples invert(0) /* No effect */ invert(.6) /* 60% inversion */ invert(100%) /* Completely inverted */ Specifications Specification Status Filter Effects Module Level 1The definition of 'invert()' in that specification. Working Draft ...
opacity() - CSS: Cascading Style Sheets
similar to the more established opacity property. The difference is that with filters, some browsers provide hardware acceleration for better performance. Syntax opacity(amount) Parameters amount The amount of the conversion, specified as a <number> or a <percentage>. A value of 0% is completely transparent, while a value of 100% leaves the input unchanged. Values between 0% and 100% are linear multipliers on the effect. The lacuna value for interpolation is 1. Examples opacity(0%) /* Completely transparent */ opacity(50%) /* 50% transparent */ opacity(1) /* No effect */ Specifications Specification Status Filter Effects Module Level 1The definition of 'opacity()' in that specification. Working Draft ...
sepia() - CSS: Cascading Style Sheets
ub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Syntax sepia(amount) Parameters amount The amount of the conversion, specified as a <number> or a <percentage>. A value of 100% is completely sepia, while a value of 0% leaves the input unchanged. Values between 0% and 100% are linear multipliers on the effect. The lacuna value for interpolation is 0. Examples sepia(0) /* No effect */ sepia(.65) /* 65% sepia */ sepia(100%) /* Completely sepia */ Specifications Specification Status Filter Effects Module Level 1The definition of 'sepia()' in that specification. Working Draft ...
fit-content() - CSS: Cascading Style Sheets
size. Syntax The fit-content() function accepts a <length> or a <percentage> as an argument. /* <length> values */ fit-content(200px) fit-content(5cm) fit-content(30vw) fit-content(100ch) /* <percentage> value */ fit-content(40%) Values <length> An absolute length. <percentage> A percentage relative to the available space in the given axis. In grid properties it is relative to the inline size of the grid container in column tracks and to the block size of the grid container for row tracks. Otherwise it is relative to the available inline size or block size of the laid out box depending on the writing mode. Examples Sizing grid columns with fit-content HTML <div id="container"> <div>Item as wide as the content.</div> <div> Item with more text in it. Because the conten...
flex-flow - CSS: Cascading Style Sheets
Web › CSS › flex-flow
Candidate Recommendation Initial definition ...
font-feature-settings - CSS: Cascading Style Sheets
The value is a positive integer. The two keywords on and off are synonyms for 1 and 0 respectively. If no value is set, the default is 1. For non-Boolean OpenType features (e.g. stylistic alternates), the value implies a particular glyph to be selected; for Boolean values, it is a switch. Formal definition Initial valuenormalApplies toall elements. ...
font-kerning - CSS: Cascading Style Sheets
her font kerning should be used or not. For example, some browsers will disable kerning on small fonts, since applying it could harm the readability of text. normal Font kerning information stored in the font must be applied. none Font kerning information stored in the font is disabled. Formal definition Initial valueautoApplies toall elements. It also applies to ::first-letter and ::first-line.InheritedyesComputed valueas specifiedAnimation typediscrete Formal syntax auto | normal | none Examples Enabling and disabling kerning HTML <div id="kern"></div> <div id="nokern"></div> <textarea id="input">AV T. ij</textarea> CSS div { font-size: 2rem; font-family: serif; } #nokern { font-kerning: none; } #kern { font-kerning: normal; } JavaScript let input = document.getEl...
font-language-override - CSS: Cascading Style Sheets
by the lang attribute. This is the default value. <string> Tells the browser to use font glyphs that are appropriate for the language specified by the string. The string must match a language tag found in the OpenType language system. For example, "ENG" is English, and "KOR" is Korean. Formal definition Initial valuenormalApplies toall elements. ...
font-optical-sizing - CSS: Cascading Style Sheets
tical size variation axis is represented by opsz in font-variation-settings. When optical sizing is used, small text sizes are often rendered with thicker strokes and larger serifs, whereas larger text is often rendered more delicately with more contrast between thicker and thinner strokes. Formal definition Initial valueautoApplies toall elements. It also applies to ::first-letter and ::first-line.InheritedyesComputed valueas specifiedAnimation typediscrete Formal syntax auto | none Examples Disabling optical sizing <p class="optical-sizing">This paragraph is optically sized. This is the default across browsers.</p> <p class="no-optical-sizing">This paragraph is not optically sized. You should see a difference in supporting browsers.</p> @font-face { src: url('AmstelvarAlpha-V...
font-size-adjust - CSS: Cascading Style Sheets
d should generally be the aspect ratio (ratio of x-height to font size) of the first choice font-family. This means that the first-choice font, when available, will appear the same size in browsers, whether or not they support font-size-adjust. 0 yields text of zero height (hidden text). Formal definition Initial valuenoneApplies toall elements. ...
font-size - CSS: Cascading Style Sheets
Web › CSS › font-size
ont-size: 1.6rem; } Then we apply this CSS to the same HTML, which looks like this: <span>Outer <span>inner</span> outer</span> In this example, the words "outer inner outer" are all displayed at 16px (assuming that the browser's font-size has been left at the default value of 10px). Formal definition Initial valuemediumApplies toall elements. ...
font-stretch - CSS: Cascading Style Sheets
ddition to the normal face. All values of font-stretch less than 100% select the condensed face, while all other values select the normal face. League Mono Variable is a variable font that offers something like a continuous range of widths for different percentage values of font-stretch. Formal definition Initial valuenormalApplies toall elements. ...
font-synthesis - CSS: Cascading Style Sheets
t many novelty fonts do not. Fonts used for Chinese, Japanese, Korean and other logographic scripts tend not to include these variants, and synthesizing them may impede the legibility of the text. In these cases, it may be desirable to switch off the browser's default font-synthesis. Formal definition Initial valueweight styleApplies toall elements. ...
font-variant-alternates - CSS: Cascading Style Sheets
character (U+2022). Be aware that some existing fonts don't follow this advice. annotation() This function enables annotations, like circled digits or inverted characters. The parameter is a font-specific name mapped to a number. It corresponds to the OpenType value nalt, like nalt 2. Formal definition Initial valuenormalApplies toall elements. ...
font-variant-east-asian - CSS: Cascading Style Sheets
proportional-width activating the set of East Asian characters which vary in width. It corresponds to the OpenType values pwid. full-width activating the set of East Asian characters which are all of the same, roughly square, width metric. It corresponds to the OpenType values fwid. Formal definition Initial valuenormalApplies toall elements. ...
font-variant-ligatures - CSS: Cascading Style Sheets
apt to the surrounding letters. These values correspond to the OpenType values calt. Two values are possible: contextual specifies that the contextual alternates are to be used. Note that the keyword normal usually activates these ligatures too. no-contextual prevents their use. Formal definition Initial valuenormalApplies toall elements. ...
font-variant - CSS: Cascading Style Sheets
s, ordinal, and slashed-zero. <east-asian-variant-values>, <east-asian-width-values>, ruby Specifies the keywords related to the font-variant-east-asian longhand property. The possible values are: jis78, jis83, jis90, jis04, simplified, traditional, full-width, proportional-width, ruby. Formal definition Initial valuenormalApplies toall elements. ...
font-variation-settings - CSS: Cascading Style Sheets
d to make sure that it is up to date. For example Linux OSes need the latest Linux Freetype version, and macOS prior to 10.13 does not support variable fonts. If your operating system is not up to date, you will not be able to use variable fonts in web pages or the Firefox Developer Tools. Formal definition Initial valuenormalApplies toall elements. It also applies to ::first-letter and ::first-line.InheritedyesComputed valueas specifiedAnimation typea transform Formal syntax normal | [ <string> <number> ]# Examples You can find a number of other variable fonts examples at our Variable fonts guide, v-fonts.com, and axis-praxis.org. Weight (wght) The following live example's CSS can be edited to allow you to play with font weight values. Slant (slnt) The following live example's CSS...
gap (grid-gap) - CSS: Cascading Style Sheets
Web › CSS › gap
5px); /* Global values */ gap: inherit; gap: initial; gap: unset; This property is specified as a value for <'row-gap'> followed optionally by a value for <'column-gap'>. If <'column-gap'> is omitted, it's set to the same value as <'row-gap'>. <'row-gap'> and <'column-gap'> are each specified as a <length> or a <percentage>. Values <length> Is the width of the gutter separating the grid lines. <percentage> Is the width of the gutter separating the grid lines, relative to the dimension of the element. Formal definition Initial valueas each of the properties of the shorthand:row-gap: normalcolumn-gap: normalApplies tomulti-column elements, flex containers, grid containersInheritednoComputed valueas each of the properties of the shorthand:row-gap: as specified, with <length>s made ...
height - CSS: Cascading Style Sheets
Web › CSS › height
nt The intrinsic minimum height. fit-content(<length-percentage>) Uses the fit-content formula with the available space replaced by the specified argument, i.e. min(max-content, max(min-content, )). Accessibility concerns Ensure that elements set with a height are not truncated and/or do not obscure other content when the page is zoomed to increase text size. MDN Understanding WCAG, Guideline 1.4 explanations Understanding Success Criterion 1.4.4 | W3C Understanding WCAG 2.0 Formal definition Initial valueautoApplies toall elements but non-replaced inline elements, table columns, and column groupsInheritednoPercentagesThe percentage is calculated with respect to the height of the generated box's containing block. If the height of the containing block is not specified explicitly (i...
image-rendering - CSS: Cascading Style Sheets
algorithm specified by image-rendering. This property has no effect on non-scaled images. Syntax /* Keyword values */ image-rendering: auto; image-rendering: crisp-edges; image-rendering: pixelated; /* Global values */ image-rendering: inherit; image-rendering: initial; image-rendering: unset; Values auto The scaling algorithm is UA dependent. Since version 1.9 (Firefox 3.0), Gecko uses bilinear resampling (high quality). smooth The image should be scaled with an algorithm that maximizes the appearance of the image. In particular, scaling algorithms that "smooth" colors are acceptable, such as bilinear interpolation. This is intended for images such as photos. high-quality Identical to smooth, but with a preference for higher-quality scaling. If system resources are constrained...
image-set() - CSS: Cascading Style Sheets
Web › CSS › image-set
ot provide any special information on background images to assistive technology. This is important primarily for screen readers, as a screen reader will not announce its presence and therefore convey nothing to its users. If the image contains information critical to understanding the page's overall purpose, it is better to describe it semantically in the document. MDN Understanding WCAG, Guideline 1.1 explanations Understanding Success Criterion 1.1.1 | W3C Understanding WCAG 2.0 Specifications Specification Status Comment CSS Images Module Level 4The definition of 'The image-set() notation' in that specification. Working Draft Browser compatibility The compatibility table on this page is generated from structured data. If you'd like to contri...
image() - CSS: Cascading Style Sheets
ot provide any special information on background images to assistive technology. This is important primarily for screen readers, as a screen reader will not announce its presence and therefore convey nothing to its users. If the image contains information critical to understanding the page's overall purpose, it is better to describe it semantically in the document. MDN Understanding WCAG, Guideline 1.1 explanations Understanding Success Criterion 1.1.1 | W3C Understanding WCAG 2.0 This feature can help improve accessibility by providing a fallback color when an image fails to load. While this can and should be done by including a background-color on every background image, the CSS image() function allows adding allows only including background colors should an image fail to load, which m...
inset - CSS: Cascading Style Sheets
Web › CSS › inset
It has the same multi-value syntax of the margin shorthand. It is a shorthand that corresponds to the top, right, bottom, and/or left properties. ...
left - CSS: Cascading Style Sheets
Web › CSS › left
relative position</p> </div> <div id="example_5"> <pre> position: absolute; right: 0; left: 0; top: 200px; </pre> <p>Absolute position with both left and right declared</p> </div> </div> </div> CSS #wrap { width: 700px; margin: 0 auto; background: #5C5C5C; } pre { white-space: pre; white-space: pre-wrap; white-space: pre-line; word-wrap: break-word; } #example_1 { width: 200px; height: 200px; position: absolute; left: 20px; top: 20px; background-color: #D8F5FF; } #example_2 { width: 200px; height: 200px; position: relative; top: 0; right: 0; background-color: #C1FFDB; } #example_3 { width: 600px; height: 400px; position: relative; top: 20px; left: 20px; background-color: #FFD7C...
<length-percentage> - CSS: Cascading Style Sheets
ividual syntaxes allowed by this type. Examples length-percentage examples The following simple example demonstrates several properties that use <length-percentage> values. HTML <p>You can use percentages and lengths in so many places.</p> CSS p { /* length-percentage examples */ width: 75%; height: 200px; margin: 3rem; padding: 1%; border-radius: 10px 10%; font-size: 250%; line-height: 1.5em; /* length examples */ text-shadow: 1px 1px 1px red; border: 5px solid red; letter-spacing: 3px; /* percentage example */ text-size-adjust: 20%; } Result Use in calc() Where a <length-percentage> is specified as an allowable type, this means that the percentage resolves to a length and therefore can be used in a calc() expression. Therefore, all of the following v...
list-style-position - CSS: Cascading Style Sheets
ist-item;. By default this includes <li> elements. Because this property is inherited, it can be set on the parent element (normally <ol> or <ul>) to let it apply to all list items. Note that there is variance among browsers regarding behavior when a block element is placed first within a list element declared as list-style-position: inside. Chrome and Safari both place this element on the same line as the marker box, whereas Firefox, Internet Explorer, and Opera place it on the next line. For more information on this, see bug 36854. Syntax /* Keyword values */ list-style-position: inside; list-style-position: outside; /* Global values */ list-style-position: inherit; list-style-position: initial; list-style-position: unset; The list-style-position property is specified as one of the ke...
list-style-type - CSS: Cascading Style Sheets
ced as a list. To address this, add a zero-width space as pseudo content before each list item to ensure the list is announced properly. This ensures the design is unaffected by the bug fix and that list items are not improperly described. ...
list-style - CSS: Cascading Style Sheets
sibility tree. To address this, add a zero-width space as pseudo-content before each list item to ensure the list is recognized properly. This ensures the design is unaffected by the bug fix and that list items are not improperly described. ...
margin-block-end - CSS: Cascading Style Sheets
he nearest block container's width */ /* Keyword values */ margin-block-end: auto; /* Global values */ margin-block-end: inherit; margin-block-end: initial; margin-block-end: unset; It corresponds to the margin-top, margin-right, margin-bottom, or margin-left property depending on the values defined for writing-mode, direction, and text-orientation. It relates to margin-block-start, margin-inline-start, and margin-inline-end, which define the other margins of the element. Values The margin-block-end property takes the same values as the margin-left property. Formal definition Initial value0Applies tosame as marginInheritednoPercentagesdepends on layout modelComputed valueif specified as a length, the corresponding absolute length; if specified as a percentage, the specified value; oth...
margin-block-start - CSS: Cascading Style Sheets
rest block container's width */ /* Keyword values */ margin-block-start: auto; /* Global values */ margin-block-start: inherit; margin-block-start: initial; margin-block-start: unset; It corresponds to the margin-top, margin-right, margin-bottom, or margin-left property depending on the values defined for writing-mode, direction, and text-orientation. It relates to margin-block-end, margin-inline-start, and margin-inline-end, which define the other margins of the element. Values The margin-block-start property takes the same values as the margin-left property. Formal definition Initial value0Applies tosame as marginInheritednoPercentagesdepends on layout modelComputed valueif specified as a length, the corresponding absolute length; if specified as a percentage, the specified value; o...
mask-border-slice - CSS: Cascading Style Sheets
presents an edge offset as a percentage of the source image's size: the width of the image for horizontal offsets, the height for vertical offsets. fill Preserves the middle image region. Its width and height are sized to match the top and left image regions, respectively. Description The slicing process creates nine regions in total: four corners, four edges, and a middle region. Four slice lines, set a given distance from their respective sides, control the size of the regions. The above diagram illustrates the location of each region. Zones 1-4 are corner regions. Each one is used a single time to form the corners of the final border image. Zones 5-8 are edge regions. These are repeated, scaled, or otherwise modified in the final border image to match the dimensions of the eleme...
mask-mode - CSS: Cascading Style Sheets
Web › CSS › mask-mode
efinition Initial valuematch-sourceApplies toall elements; In SVG, it applies to container elements excluding the defs element and all graphics elementsInheritednoComputed valueas specifiedAnimation typediscrete Formal syntax <masking-mode>#where <masking-mode> = alpha | luminance | match-source Examples Using alpha mask mode CSS #masked { width: 227px; height: 200px; background: blue linear-gradient(red, blue); mask-image: url(https://mdn.mozillademos.org/files/12668/MDN.svg); mask-mode: alpha; /* Can be changed in the live sample */ } HTML <div id="masked"> </div> <select id="maskMode"> <option value="alpha">alpha</option> <option value="luminance">luminance</option> <option value="match-source">match-source</option> </select> JavaScript var maskMode = document.g...
mask-origin - CSS: Cascading Style Sheets
webkit-mask-origin: padding; -webkit-mask-origin: border; /* Global values */ mask-origin: inherit; mask-origin: initial; mask-origin: unset; For elements rendered as a single box, this property specifies the mask positioning area. In other words, this property specifies the origin position of an image specified by the mask-image CSS property. For elements rendered as multiple boxes, such as inline boxes on several lines or boxes on several pages, it specifies which boxes box-decoration-break operates upon to determine the mask positioning area. Syntax One or more of the keyword values listed below, separated by commas. Values content-box The position is relative to the content box. padding-box The position is relative to the padding box. For single boxes 0 0 is the upper left corn...
mask-position - CSS: Cascading Style Sheets
ter | right | <length-percentage> ] [ top | center | bottom | <length-percentage> ]? ...
mask-repeat - CSS: Cascading Style Sheets
ies to container elements excluding the defs element and all graphics elementsInheritednoComputed valueConsists of two keywords, one per dimensionAnimation typediscrete Formal syntax <repeat-style>#where <repeat-style> = repeat-x | repeat-y | [ repeat | space | round | no-repeat ]{1,2} Examples Setting repeat for a single mask CSS #masked { width: 250px; height: 250px; background: blue linear-gradient(red, blue); mask-image: url(https://mdn.mozillademos.org/files/12676/star.svg); mask-repeat: repeat; /* Can be changed in the live sample */ margin-bottom: 10px; } HTML Content <div id="masked"> </div> <select id="repetition"> <option value="repeat-x">repeat-x</option> <option value="repeat-y">repeat-y</option> <option value="repeat" selected>repeat</option> <option v...
mask-size - CSS: Cascading Style Sheets
Web › CSS › mask-size
fied, but with relative lengths converted into absolute lengthsAnimation typerepeatable list of simple list of length, percentage, or calc Formal syntax <bg-size>#where <bg-size> = [ <length-percentage> | auto ]{1,2} | cover | containwhere <length-percentage> = <length> | <percentage> Examples Setting mask size as a percentage CSS #masked { width: 200px; height: 200px; background: blue linear-gradient(red, blue); -webkit-mask-image: url(https://mdn.mozillademos.org/files/12668/MDN.svg); mask-image: url(https://mdn.mozillademos.org/files/12668/MDN.svg); -webkit-mask-size: 50%; mask-size: 50%; /* Can be changed in the live sample */ margin-bottom: 10px; } HTML <div id="masked"> </div> <select id="maskSize"> <option value="auto">auto</option> <option value="40% 80%">4...
max-height - CSS: Cascading Style Sheets
minimum max-height. fit-content(<length-percentage>) Uses the fit-content formula with the available space replaced by the specified argument, i.e. min(max-content, max(min-content, argument)). Accessibility concerns Ensure that elements set with a max-height are not truncated and/or do not obscure other content when the page is zoomed to increase text size. MDN Understanding WCAG, Guideline 1.4 explanations Understanding Success Criterion 1.4.4 | W3C Understanding WCAG 2.0 Formal definition Initial valuenoneApplies toall elements but non-replaced inline elements, table columns, and column groupsInheritednoPercentagesThe percentage is calculated with respect to the height of the generated box's containing block. If the height of the containing block is not specified explicitly (i...
max() - CSS: Cascading Style Sheets
Web › CSS › max
size, make sure the text is always large enough to read. A suggestion is to use the min() function nested within a max() that has as its second value a relative length unit that is always large enough to read. For example: small { font-size: max(min(0.5vw, 0.5em), 1rem); } This ensures a minimum size of 1rem, with a text size that scales if the page is zoomed. MDN Understanding WCAG, Guideline 1.4 explanations Understanding Success Criterion 1.4.4 | W3C Understanding WCAG 2.0 Specifications Specification Status Comment CSS Values and Units Module Level 4The definition of 'max()' in that specification. Editor's Draft Initial definition ...
min-block-size - CSS: Cascading Style Sheets
es */ min-block-size: max-content; min-block-size: min-content; min-block-size: fit-content(20em); /* Global values */ min-block-size: inherit; min-block-size: initial; min-block-size: unset; If the writing mode is vertically oriented, the value of min-block-size relates to the minimum width of the element; otherwise, it relates to the minimum height of the element. A related property is min-inline-size, which defines the other dimension of the element. Values The min-block-size property takes the same values as the min-width and min-height properties. Formal definition Initial value0Applies tosame as width and heightInheritednoPercentagesblock-size of containing blockComputed valuesame as min-width and min-heightAnimation typea length, percentage or calc(); Formal syntax <'min-width...
min-height - CSS: Cascading Style Sheets
ment. none No limit on the size of the box. max-content The intrinsic preferred min-height. min-content The intrinsic minimum min-height. fit-content(<length-percentage>) Uses the fit-content formula with the available space replaced by the specified argument, i.e. min(max-content, max(min-content, argument)). Formal definition Initial valueautoApplies toall elements but non-replaced inline elements, table columns, and column groupsInheritednoPercentagesThe percentage is calculated with respect to the height of the generated box's containing block. If the height of the containing block is not specified explicitly (i.e., it depends on content height), and this element is not absolutely positioned, the percentage value is treated as 0.Computed valuethe percentage as specified or the a...
min-width - CSS: Cascading Style Sheets
Web › CSS › min-width
lement. none No limit on the size of the box. max-content The intrinsic preferred min-width. min-content The intrinsic minimum min-width. fit-content(<length-percentage>) Uses the fit-content formula with the available space replaced by the specified argument, i.e. min(max-content, max(min-content, argument)). ...
minmax() - CSS: Cascading Style Sheets
Web › CSS › minmax
ch parameter can be a <length>, a <percentage>, a <flex> value, or one of the keyword values max-content, min-content, or auto. If max < min, then max is ignored and minmax(min,max) is treated as min. As a maximum, a <flex> value sets the flex factor of a grid track; it is invalid as a minimum. Values <length> A non-negative length. <percentage> A non-negative percentage relative to the inline size of the grid container in column grid tracks, and the block size of the grid container in row grid tracks. If the size of the grid container depends on the size of its tracks, then the <percentage> must be treated as auto. The user agent may adjust the intrinsic size contributions of the track to the size of the grid container and increase the final size of the track by the minimum amount tha...
offset - CSS: Cascading Style Sheets
Web › CSS › offset
Working Draft Initial definition ...
order - CSS: Cascading Style Sheets
Web › CSS › order
on of content and DOM order. This will adversely affect users experiencing low vision navigating with the aid of assistive technology such as a screen reader. If the visual (css) order is important, then screen reader users will not have access to the correct reading order. ...
overscroll-behavior-x - CSS: Cascading Style Sheets
nside the element this value is set on (e.g. "bounce" effects or refreshes), but no scroll chaining occurs to neighbouring scrolling areas, e.g. underlying elements will not scroll. none No scroll chaining occurs to neighbouring scrolling areas, and default scroll overflow behavior is prevented. Formal definition Initial valueautoApplies tonon-replaced block-level elements and non-replaced inline-block elementsInheritednoComputed valueas specifiedAnimation typediscrete Formal syntax contain | none | auto Examples Preventing an underlying element from scrolling horizontally In our simple overscroll-behavior-x example (see source code also), we have two block-level boxes, one inside the other. The outer box has a large width set on it so the page will scroll horizontally. The inner box...
overscroll-behavior - CSS: Cascading Style Sheets
nside the element this value is set on (e.g. "bounce" effects or refreshes), but no scroll chaining occurs to neighbouring scrolling areas, e.g. underlying elements will not scroll. none No scroll chaining occurs to neighbouring scrolling areas, and default scroll overflow behavior is prevented. Formal definition Initial valueautoApplies tonon-replaced block-level elements and non-replaced inline-block elementsInheritednoComputed valueas specifiedAnimation typediscrete Formal syntax [ contain | none | auto ]{1,2} Examples Preventing an underlying element from scrolling In our overscroll-behavior example (see the source code also), we present a full-page list of fake contacts, and a dialog box containing a chat window. Both of these areas scroll; normally if you scrolled the chat w...
padding-block-end - CSS: Cascading Style Sheets
nherit; padding-block-end: initial; padding-block-end: unset; Values The padding-block-end property takes the same values as the padding-left property. Description This property corresponds to the padding-top, padding-right, padding-bottom, or padding-left property depending on the values defined for writing-mode, direction, and text-orientation. It relates to padding-block-start, padding-inline-start, and padding-inline-end, which define the other paddings of the element. Formal definition Initial value0Applies toall elementsInheritednoPercentageslogical-width of containing blockComputed valueas <length>Animation typea length Formal syntax <'padding-left'> Examples Setting block end padding for vertical text HTML Content <div> <p class="exampleText">Example text</p> </div> ...
padding-block-start - CSS: Cascading Style Sheets
it; padding-block-start: initial; padding-block-start: unset; Values The padding-block-start property takes the same values as the padding-left property. Description This property corresponds to the padding-top, padding-right, padding-bottom, or padding-left property depending on the values defined for writing-mode, direction, and text-orientation. It relates to padding-block-end, padding-inline-start, and padding-inline-end, which define the other paddings of the element. Formal definition Initial value0Applies toall elementsInheritednoPercentageslogical-width of containing blockComputed valueas <length>Animation typea length Formal syntax <'padding-left'> Examples Setting block start padding for vertical text HTML <div> <p class="exampleText">Example text</p> </div> CSS di...
padding-bottom - CSS: Cascading Style Sheets
size of the padding as a fixed value. Must be nonnegative. <percentage> The size of the padding as a percentage, relative to the width of the containing block. Must be nonnegative. Formal definition Initial value0Applies toall elements, except table-row-group, table-header-group, table-footer-group, table-row, table-column-group and table-column. ...
padding-left - CSS: Cascading Style Sheets
size of the padding as a fixed value. Must be nonnegative. <percentage> The size of the padding as a percentage, relative to the width of the containing block. Must be nonnegative. Formal definition Initial value0Applies toall elements, except table-row-group, table-header-group, table-footer-group, table-row, table-column-group and table-column. ...
padding-right - CSS: Cascading Style Sheets
size of the padding as a fixed value. Must be nonnegative. <percentage> The size of the padding as a percentage, relative to the width of the containing block. Must be nonnegative. Formal definition Initial value0Applies toall elements, except table-row-group, table-header-group, table-footer-group, table-row, table-column-group and table-column. ...
padding-top - CSS: Cascading Style Sheets
size of the padding as a fixed value. Must be nonnegative. <percentage> The size of the padding as a percentage, relative to the width of the containing block. Must be nonnegative. Formal definition Initial value0Applies toall elements, except table-row-group, table-header-group, table-footer-group, table-row, table-column-group and table-column. ...
padding - CSS: Cascading Style Sheets
Web › CSS › padding
of the padding as a percentage, relative to the width of the containing block. Formal definition Initial valueas each of the properties of the shorthand:padding-bottom: 0padding-left: 0padding-right: 0padding-top: 0Applies toall elements, except table-row-group, table-header-group, table-footer-group, table-row, table-column-group and table-column. ...
perspective-origin - CSS: Cascading Style Sheets
ive-origin: 200% -200%; } /* Define the container div, the cube div, and a generic face */ .container { width: 100px; height: 100px; margin: 24px; border: none; } .cube { width: 100%; height: 100%; backface-visibility: visible; perspective: 300px; transform-style: preserve-3d; } .face { display: block; position: absolute; width: 100px; height: 100px; border: none; line-height: 100px; font-family: sans-serif; font-size: 60px; color: white; text-align: center; } /* Define each face based on direction */ .front { background: rgba(0, 0, 0, 0.3); transform: translateZ(50px); } .back { background: rgba(0, 255, 0, 1); color: black; transform: rotateY(180deg) translateZ(50px); } .right { background: rgba(196, 0, 0, 0.7); transform: rotateY(90deg)...
perspective - CSS: Cascading Style Sheets
px; } /* Define the container div, the cube div, and a generic face */ .container { width: 200px; height: 200px; margin: 75px 0 0 75px; border: none; } .cube { width: 100%; height: 100%; backface-visibility: visible; perspective-origin: 150% 150%; transform-style: preserve-3d; } .face { display: block; position: absolute; width: 100px; height: 100px; border: none; line-height: 100px; font-family: sans-serif; font-size: 60px; color: white; text-align: center; } /* Define each face based on direction */ .front { background: rgba(0, 0, 0, 0.3); transform: translateZ(50px); } .back { background: rgba(0, 255, 0, 1); color: black; transform: rotateY(180deg) translateZ(50px); } .right { background: rgba(196, 0, 0, 0.7); transform: rotateY(90de...
repeat() - CSS: Cascading Style Sheets
Web › CSS › repeat
<fixed-repeat> values */ repeat(4, 250px) repeat(4, [col-start] 250px [col-end]) repeat(4, [col-start] 60% [col-end]) repeat(4, [col-start] minmax(100px, 1fr) [col-end]) repeat(4, [col-start] fit-content(200px) [col-end]) repeat(4, 10px [col-start] 30% [col-middle] 400px [col-end]) Syntax Values <length> A positive integer length. <percentage> A non-negative percentage relative to the inline size of the grid container in column grid tracks, and the block size of the grid container in row grid tracks. If the size of the grid container depends on the size of its tracks, then the <percentage> must be treated as auto. The user-agent may adjust the intrinsic size contributions of the track to the size of the grid container and increase the final size of the track by the minimum amount tha...
revert - CSS: Cascading Style Sheets
Web › CSS › revert
is just a value. It is still possible to override revert value using specificity. The revert keyword is different from and should not be confused with initial, which uses the initial value defined on a per-property basis by the CSS specifications. In contrast, user-agent stylesheets set default values on the basis of CSS selectors. For example, the initial value for the display property is inline, whereas a normal user-agent stylesheet sets the default display value of <div>s to block, of <table>s to table, etc. Examples Revert vs unset Although revert and unset are similar they differ for some properties for some elements. So in the below example, we set custom font-weight in a global stylesheet, but then try to unset and revert. Unset will keep the text normal because this is an in...
right - CSS: Cascading Style Sheets
Web › CSS › right
et both. When the position of the element is overspecified, the precende is based on the container's direction: The left will take precendence if the container's direction is left-to-right. The right will take precedence if the container's direction is right-to-left. ...
rotate - CSS: Cascading Style Sheets
Web › CSS › rotate
to a rotate() (2D rotation) function. x, y, or z axis name plus angle value The name of the axis you want to rotate the affected element around ("x", "y", or "z"), plus an <angle> specifying the angle to rotate the element through. Equivalent to a rotateX()/rotateY()/rotateZ() (3D rotation) function. vector plus angle value Three <number>s representing an origin-centered vector that defines a line around which you want to rotate the element, plus an <angle> specifying the angle to rotate the element through. Equivalent to a rotate3d() (3D rotation) function. none Specifies that no rotation should be applied. Formal definition Initial valuenoneApplies totransformable elementsInheritednoComputed valueas specifiedAnimation typea transformCreates stacking contextyes Formal syntax none |...
ruby-position - CSS: Cascading Style Sheets
ition ExperimentalChrome No support NoEdge No support 12 -- 79Firefox Full support 38IE No support NoNotes No support NoNotes Notes Internet Explorer 9 and later support an old draft values: inline (equivalent of having display: inline on the ruby), and above (synonym of the modern over).Opera No support NoSafari No support NoNotes No support NoNotes Notes Safari implements a non-standard, prefixed, version of ruby-position, -webkit-ruby-position: it has tw...
scroll-behavior - CSS: Cascading Style Sheets
alueas specifiedAnimation typediscrete Formal syntax auto | smooth Examples Setting smooth scroll behavior HTML <nav> <a href="#page-1">1</a> <a href="#page-2">2</a> <a href="#page-3">3</a> </nav> <scroll-container> <scroll-page id="page-1">1</scroll-page> <scroll-page id="page-2">2</scroll-page> <scroll-page id="page-3">3</scroll-page> </scroll-container> CSS a { display: inline-block; width: 50px; text-decoration: none; } nav, scroll-container { display: block; margin: 0 auto; text-align: center; } nav { width: 339px; padding: 5px; border: 1px solid black; } scroll-container { display: block; width: 350px; height: 200px; overflow-y: scroll; scroll-behavior: smooth; } scroll-page { display: flex; align-items: center; justify-content: cente...
scroll-margin - CSS: Cascading Style Sheets
s that when scrolling past the middle child elements, the scrolling will snap to 1rem outside the left edge of the second <div>, and 2rems outside the left edge of the third <div>. Note: Here we are setting scroll-margin on all sides at once, but only the start edge is really relevant. It would work just as well here to only set a scroll margin on that one edge, for example with scroll-margin-inline-start: 1rem, or scroll-margin: 0 0 0 1rem. Result Try it for yourself: Specifications Specification Status Comment CSS Scroll Snap Module Level 1The definition of 'scroll-margin' in that specification. Candidate Recommendation Initial definition ...
scroll-snap-coordinate - CSS: Cascading Style Sheets
ner coordinate50"> <div>1</div> <div>2</div> <div>3</div> </div> </div> </div> CSS #container { display: flex; } #container > div:nth-child(-n+2) { margin-right: 20px; } .scrollContainer { width: 100px; overflow: auto; white-space: nowrap; scroll-snap-type: mandatory; font-size: 0; } .scrollContainer > div { width: 100px; height: 100px; display: inline-block; line-height: 100px; text-align: center; font-size: 50px; } .coordinate0 > div { scroll-snap-coordinate: 0 0; } .coordinate25 > div { scroll-snap-coordinate: 25px 0; } .coordinate50 > div { scroll-snap-coordinate: 50px 0; } .scrollContainer > div:nth-child(even) { background-color: #87ea87; } .scrollContainer > div:nth-child(odd) { background-color: #87ccea; } Result ...
symbols() - CSS: Cascading Style Sheets
Web › CSS › symbols
Unlike @counter-style, symbols() is anonymous (i.e., it can only be used once). Although less powerful, it is shorter and easier to write than @counter-style. Syntax symbols() = symbols( <symbols-type>? [ <string> | <image> ]+ ); <symbols-type> can be one of the following: cyclic: The system cycles through the given values in the order of their definition, and returns to the start when it reaches the end. numeric: The system interprets the given values as the successive units of a place-value numbering system. ...
table-layout - CSS: Cascading Style Sheets
een downloaded and analyzed. This can speed up rendering time over the "automatic" layout method, but subsequent cell content might not fit in the column widths provided. Cells use the overflow property to determine whether to clip any overflowing content, but only if the table has a known width; otherwise, they won't overflow the cells. Formal definition Initial valueautoApplies totable and inline-table elementsInheritednoComputed valueas specifiedAnimation typediscrete Formal syntax auto | fixed Examples Fixed-width tables with text-overflow This example uses a fixed table layout, combined with the width property, to restrict the table's width. The text-overflow property is used to apply an ellipsis to words that are too long to fit. If the table layout were auto, the table would gro...
text-emphasis-position - CSS: Cascading Style Sheets
The text-emphasis-position CSS property sets where emphasis marks are drawn. Like ruby text, if there isn't enough room for emphasis marks, the line height is increased. /* Initial value */ text-emphasis-position: over right; /* Keywords value */ text-emphasis-position: over left; text-emphasis-position: under right; text-emphasis-position: under left; text-emphasis-position: left over; text-emphasis-position: right under; text-emphasis-position: left under; /* Global values */ text-emphasis-position: inherit; text-emphasis-position: initial; text-emphasis-position: unset; Syntax Values over Draw marks over the text in horizontal writing mode. under Draw marks under the text in horizontal writing mode. right Draws marks to the right of the text in vertical writing mode. left...
text-emphasis - CSS: Cascading Style Sheets
t-emphasis property is quite different from text-decoration. The text-decoration property does not inherit, and the decoration specified is applied across the whole element. However, text-emphasis does inherit, which means it is possible to change emphasis marks for descendents. The size of the emphasis symbol, like ruby symbols, is about 50% of the size of the font, and text-emphasis may affect line height when the current leading is not enough for the marks. text-emphasis doesn't reset the value of text-emphasis-position. This is because if the style and the color of emphasis marks may vary in a text, it is extremely unlikely that their position will. In the very rare cases when this is needed, the property text-emphasis-position. Constituent properties This property is a shorthand for...
text-justify - CSS: Cascading Style Sheets
or languages that separate words using spaces, like English or Korean. inter-character The text is justified by adding space between characters (effectively varying letter-spacing), which is most appropriate for languages like Japanese. distribute Exhibits the same behaviour as inter-character; this value is kept for backwards compatibility. Formal definition Initial valueautoApplies toinline-level and table-cell elementsInheritedyesComputed valueas specifiedAnimation typediscrete Formal syntax auto | inter-character | inter-word | none Examples <p class="none"><code>text-justify: none</code> --<br>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc ornare maximus vehicula. Duis nisi velit, dictum id mauris vitae, lobortis pretium quam. Quisque sed nisi pulvinar, conseq...
text-rendering - CSS: Cascading Style Sheets
er legibility and geometric precision when drawing text. It disables kerning and ligatures. optimizeLegibility The browser emphasizes legibility over rendering speed and geometric precision. This enables kerning and optional ligatures. geometricPrecision The browser emphasizes geometric precision over rendering speed and legibility. Certain aspects of fonts -- such as kerning -- don't scale linearly. So this value can make text using those fonts look good. In SVG, when text is scaled up or down, browsers calculate the final size of the text (which is determined by the specified font size and the applied scale) and request a font of that computed size from the platform's font system. But if you request a font size of, say, 9 with a scale of 140%, the resulting font size of 12.6 doesn't ...
transform-box - CSS: Cascading Style Sheets
Specifications Specification Status Comment CSS Transforms Level 1The definition of 'transform-box' in that specification. Working Draft Initial definition ...
matrix() - CSS: Cascading Style Sheets
for matrix3d(a, b, 0, 0, c, d, 0, 0, 0, 0, 1, 0, tx, ty, 0, 1). Syntax The matrix() function is specified with six values. The constant values are implied and not passed as parameters; the other parameters are described in the column-major order. Note: Until Firefox 16, Gecko accepted a <length> value for tx and ty. matrix(a, b, c, d, tx, ty) Values a b c d Are <number>s describing the linear transformation. tx ty Are <number>s describing the translation to apply. Cartesian coordinates on R2 Homogeneous coordinates on RP2 Cartesian coordinates on R3 Homogeneous coordinates on RP3 ac bd actxbdty001 actxbdty001 ac0txbd0ty00100001 [a b c d tx ty] The values represent the following functions: matrix( scale...
rotate() - CSS: Cascading Style Sheets
Work...
scale() - CSS: Cascading Style Sheets
you need to include such animations on your website, you should provide a control to allow users to turn off animations, preferrably site-wide. Also, consider making use of the prefers-reduced-motion media feature -- use it to write a media query that will turn off animations if the user has reduced animation specified in their system preferences. ...
translate() - CSS: Cascading Style Sheets
abscissa (x-coordinate) and the ordinate (y-coordinate) of the translating vector. A percentage as first value refers to the width, as second part to the height of the reference box defined by the transform-box property. Cartesian coordinates on R2 Homogeneous coordinates on RP2 Cartesian coordinates on R3 Homogeneous coordinates on RP3 A translation is not a linear transformation in R2 and can't be represented using a Cartesian-coordinate matrix. 10tx01ty001 10tx01ty001 100tx010ty00100001 [1 0 0 1 tx ty] Formal syntax translate(<length-percentage> , <length-percentage>?) Examples Using a single-axis translation HTML <div>Static</div> <div class="moved">Moved</div> <div>Static</div> CSS div { width: 60px; h...
translate3d() - CSS: Cascading Style Sheets
he translating vector. It can't be a <percentage> value; in that case the property containing the transform is considered invalid. Cartesian coordinates on R2 Homogeneous coordinates on RP2 Cartesian coordinates on R3 Homogeneous coordinates on RP3 This transformation applies to the 3D space and can't be represented on the plane. A translation is not a linear transformation in R3 and can't be represented using a Cartesian-coordinate matrix. 100tx010ty001tz0001 Examples Using a single axis translation HTML <div>Static</div> <div class="moved">Moved</div> <div>Static</div> CSS div { width: 60px; height: 60px; background-color: skyblue; } .moved { /* Equivalent to perspective(500px) translateX(10px) */ transform: perspectiv...
translateX() - CSS: Cascading Style Sheets
50%); Values <length-percentage> Is a <length> or <percentage> representing the abscissa of the translating vector. A percentage value refers to the width of the reference box defined by the transform-box property. Cartesian coordinates on R2 Homogeneous coordinates on RP2 Cartesian coordinates on R3 Homogeneous coordinates on RP3 A translation is not a linear transformation in R2 and can't be represented using a Cartesian-coordinate matrix. 10t010001 10t010001 100t010000100001 [1 0 0 1 t 0] Formal syntax translateX(<length-percentage>) Examples HTML <div>Static</div> <div class="moved">Moved</div> <div>Static</div> CSS div { width: 60px; height: 60px; background-color: skyblue; } .moved { transfo...
translateY() - CSS: Cascading Style Sheets
ues <length-percentage> The value is a <length> or <percentage> representing the ordinate of the translating vector. A percentage value refers to the height of the reference box defined by the transform-box property. Cartesian coordinates on R2 Homogeneous coordinates on RP2 Cartesian coordinates on R3 Homogeneous coordinates on RP3 A translation is not a linear transformation in R2 and can't be represented using a Cartesian-coordinate matrix. 10001t001 10001t001 1000010t00100001 [1 0 0 1 0 t] Formal syntax translateY(<length-percentage>) Examples HTML <div>Static</div> <div class="moved">Moved</div> <div>Static</div> CSS div { width: 60px; height: 60px; background-color: skyblue; } .moved { transf...
translateZ() - CSS: Cascading Style Sheets
enting the z-component of the translating vector. A positive value moves the element towards the viewer, and a negative value farther away. Cartesian coordinates on R2 Homogeneous coordinates on RP2 Cartesian coordinates on R3 Homogeneous coordinates on RP3 This transformation applies to the 3D space and can't be represented on the plane. A translation is not a linear transformation in R3 and can't be represented using a Cartesian-coordinate matrix. 10000100001t0001 Examples In this example, two boxes are created. One is positioned normally on the page, without being translated at all. The second is altered by applying perspective to create a 3D space, then moved towards the user. HTML <div>Static</div> <div class="moved">Moved</div> CSS di...
transition - CSS: Cascading Style Sheets
rties of the shorthand:transition-delay: as specifiedtransition-duration: as specifiedtransition-property: as specifiedtransition-timing-function: as specifiedAnimation typediscrete Formal syntax <single-transition>#where <single-transition> = [ none | <single-transition-property> ] | <time> | <timing-function> | <time>where <single-transition-property> = all | <custom-ident><timing-function> = linear | <cubic-bezier-timing-function> | <step-timing-function>where <cubic-bezier-timing-function> = ease | ease-in | ease-out | ease-in-out | cubic-bezier(<number <a href="/docs/CSS/Value_definition_syntax#Brackets" title="Brackets: enclose several entities, combinators, and multipliers to transform them as a single component">[0,1]>, <number>, <number <a href="/docs/CSS/Value_definition_syntax#Bra...
var() - CSS: Cascading Style Sheets
Web › CSS › var
ented by an identifier that starts with two dashes. Custom properties are solely for use by authors and users; CSS will never give them a meaning beyond what is presented here. <declaration-value> The custom property's fallback value, which is used in case the custom property is invalid in the used context. This value may contain any character except some characters with special meaning like newlines, unmatched closing brackets, i.e. ), ], or }, top-level semicolons, or exclamation marks. Examples :root { --main-bg-color: pink; } body { background-color: var(--main-bg-color); } /* Fallback */ /* In the component's style: */ .component .header { color: var(--header-color, blue); /* header-color isn't set, and so remains blue, the fallback value */ } .component .text { color: va...
CSS: Cascading Style Sheets
Web › CSS
t some basic experience with using it, its time to dive a bit deeper. This module looks at the cascade and inheritance, all the selector types we have available, units, sizing, styling backgrounds and borders, debugging, and lots more. The aim here is to provide you with a toolkit for writing competent CSS and help you understand all the essential theory, before moving on to more specific disciplines like text styling and CSS layout. Styling text With the basics of the CSS language covered, the next CSS topic for you to concentrate on is styling text -- one of the most common things you'll do with CSS. Here we look at text styling fundamentals, including setting font, boldness, italics, line and letter spacing, drop shadows, and other text features. We round off the module by looking at ...
Guide to Web APIs - Developer guides
Web › Guide › API
ming APIFullscreen APIGGamepad API Geolocation APIHHTML Drag and Drop APIHigh Resolution TimeHistory APIIImage Capture APIIndexedDBIntersection Observer APILLong Tasks API MMedia Capabilities API Media Capture and StreamsMedia Session APIMedia Source Extensions MediaStream RecordingNNavigation TimingNetwork Information API PPage Visibility APIPayment Request APIPerformance APIPerformance Timeline APIPermissions APIPointer EventsPointer Lock APIProximity Events Push API RResize Observer APIResource Timing APISServer Sent EventsService Workers APIStorageStorage Access APIStreams TTouch EventsUURL APIVVibration APIVisual Viewport WWeb AnimationsWeb Audio APIWeb Authentication APIWeb Crypto APIWeb NotificationsWeb Storage APIWeb Workers APIWebGLWebRTCWebVTTWebXR Device APIWebsockets API ...
Media buffering, seeking, and time ranges - Developer guides
he media is ready to be played. In practice a good way to do this is use the seekable attribute, although as we have seen above seekable parts of the media are not neccessarily contiguous -- they often are however and we can safely approximate this information to give the user an indication of which parts of the media can be played directly. We can find this point in the media using the following line of code: var seekableEnd = myAudio.seekable.end(myAudio.seekable.length - 1); Note: myAudio.seekable.end(myAudio.seekable.length - 1) actually tells us the end point of the last time range that is seekable (not all seekable media). In practice this is good enough as the browser either enables range requests or it doesn't. If it doesn't then audio.seekable will be equivalent to audio.buffered, ...
DOM onevent handlers - Developer guides
event handlers on their parent Window object. (The HTML specification names these: onblur, onerror, onfocus, onload, and onscroll.) Event handler's parameters, this binding, and the return value When the event handler is specified as an HTML attribute, the specified code is wrapped into a function with the following parameters: event -- for all event handlers except onerror. event, source, lineno, colno, and error for the onerror event handler. Note that the event parameter actually contains the error message as a string. When the event handler is invoked, the this keyword inside the handler is set to the DOM element on which the handler is registered. For more details, see the this keyword documentation. The return value from the handler determines if the event is canceled. The spec...
Media events - Developer guides
document.getElementsByTagName("video")[0]; v.addEventListener("seeked", function() { v.play(); }, true); v.currentTime = 10.0; This example fetches the first video element in the document and attaches an event listener to it, watching for the seeked event, which is sent whenever a seek operation completes. The listener simply calls the element's play() method, which starts playback. Then, in line 3, the example sets the element's currentTime attribute to 10.0, which initiates a seek operation to the 10-second mark in the media. This causes a seeking event to be sent when the operation begins, then a seeked event to be dispatched when the seek is completed. In other words, this example seeks to the 10-second mark in the media, then begins playback as soon as that's finished. ...
Orientation and motion data explained - Developer guides
of the Earth coordinate frame. The X axis follows along the ground plane, perpendicular to the Y axis and positive toward the east (and therefore negative toward the west). The Y axis follows along the ground plane, and is positive toward true north (that is, the North Pole, not magnetic north) and negative toward true south. The Z axis is perpendicular to the ground plane; think of it as a line drawn between the device and the center of the Earth. The value of the Z coordinate is positive upward (away from the center of the Earth) and negative downward (toward the center of the Earth). Device coordinate frame The device coordinate frame is the coordination frame fixed on the center of the device. We use lower-case letters ("x", "y", and "z") to describe the axes of the device coordin...
Graphics on the Web - Developer guides
ng the <img> element, or by setting the background of HTML elements using the background-image property. You can also construct graphics on-the-fly, or manipulate images after the fact. These articles provide insight into how you can accomplish this. 2D Graphics Canvas The <canvas> element provides APIs to draw 2D graphics using JavaScript. SVG Scalable Vector Graphics (SVG) lets you use lines, curves, and other geometric shapes to render graphics. With vectors, you can create images that scale cleanly to any size. View All... 3D Graphics WebGL A guide to getting started with WebGL, the 3D graphics API for the Web. This technology lets you use standard OpenGL ES in web content. Video Using HTML5 audio and video Embedding video and/or audio in a web page and controlling ...
Content categories - Developer guides
d Text. A few other elements belong to this category, but only if a specific condition is fulfilled: <area>, if it is a descendant of a <map> element <link>, if the itemprop attribute is present <meta>, if the itemprop attribute is present <style>, if the scoped attribute is present Sectioning content Elements belonging to the sectioning content model create a section in the current outline that defines the scope of <header> elements, <footer> elements, and heading content. Elements belonging to this category are <article>, <aside>, <nav> and <section>. Do not confuse this content model with the sectioning root category, which isolates its content from the regular outline. Heading content Heading content defines the title of a section, whether marked by an explicit sectioning ...
Index - Developer guides
Web › Guide › Index
sponsive design. If you need to slightly alter the site's message for mobile users, but want to reap the benefits of a responsive design, a hybrid approach may be your best bet. Decisions like these are at the heart of mobile web development: be specific about what you would like to accomplish, and pick a practical approach while being aware of the tradeoffs. Good luck! 34 Mobile-friendliness Mobile, Web Development Mobile friendliness can mean a multitude of things, depending on who you're talking to. It can be helpful to think of it in terms of three goals for improving your site's user experience: Presentation, Content, and Performance. 35 Separate sites for mobile and desktop Mobile, Web Development The "separate sites" approach to mobile Web devel...
Localizations and character encodings - Developer guides
encoding (which can represent all of Unicode) and regardless of the encoding used requires Web content to declare what encoding was used. The <meta> element's charset attribute is used to specify the page's character encoding. It must be used within a <head> block. To specify that a page is using, for example, the UTF-8 character encoding (as per the recommendation), simply place the following line in the <head> block: <meta charset="utf-8"> Details and browser internals When the encoding is declared by Web content like the HTML specification requires, Firefox will use that encoding for turning the bytes into the internal representation. Unfortunately, using UTF-8 and declaring that UTF-8 was used was not always the prevalent way of offering Web content. In the 1990s, it was common to l...
Separate sites for mobile and desktop - Developer guides
s strategy for the mobile versions of addons.mozilla.org (AMO) and support.mozilla.org (SUMO). If you'd like to see the source code behind an example of this approach in action, feel free to check out the github repository for AMO or SUMO. Approaches to mobile Web development See the following articles for background and other approaches to developing for mobile platforms. What is mobile-friendliness? Responsive design A hybrid approach Original document information This article was originally published on 13 May 2011, on the Mozilla Webdev blog as "Approaches to Mobile Web Development Part 2 - Separate Sites", by Jason Grlicky. ...
Printing - Developer guides
...
Writing forward-compatible websites - Developer guides
.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. So appending a script that depends on non-strict-mode behavior to a strict-mode script will cause things to break. Ask the authors of any JavaScript libraries you use to also follow these guidelines Suggest to the developers of your favorite libraries that they follow these guidelines too. If they don't, you can't rely on that library not breaking in the future. Unfortunately, libraries are common transgressors of these guidelines. Sniffing Sniff for specific features If you plan to use some feature, use object-detection to sniff for that exact feature, if possible. As a simple example...
HTML attribute: minlength - HTML: Hypertext Markup Language
long</label> <input type="text" minlength="5" id="fruit"> We can use pseudoclasses to style the element based on whether the value is valid. The value will be valid as long as it is either null (empty) or five or more characters long. Lime is invalid, lemon is valid. input { border: 2px solid currentcolor; } input:invalid { border: 2px dashed red; } input:invalid:focus { background-image: linear-gradient(pink, lightgreen); } Specifications Specification Status HTML Living StandardThe definition of 'minlength attribute' in that specification. Living Standard HTML 5.1The definition of 'minlength attribute' in that specification. Recommendation ...
HTML attribute reference - HTML: Hypertext Markup Language
submit button (type="submit"), this boolean attribute specifies that the form is not to be validated when it is submitted. If this attribute is specified, it overrides the novalidate attribute of the button's form owner. formtarget <button>, <input> If the button/input is a submit button (type="submit"), this attribute specifies the browsing context (for example, tab, window, or inline frame) in which to display the response that is received after submitting the form. If this attribute is specified, it overrides the target attribute of the button's form owner. headers <td>, <th> IDs of the <th> elements which applies to this element. height <canvas>, <embed>, <iframe>, <img>, <input>, <object>, <video> Specifies the height of elements listed h...
<acronym> - HTML: Hypertext Markup Language
Web › HTML › Element › acronym
e <p>The <acronym title="World Wide Web">WWW</acronym> is only a component of the Internet.</p> Default styling Though the purpose of this tag is purely for the convenience of the author, its default styling varies from one browser to another: Some browsers, like Internet Explorer, do not style it differently than a <span> element. Opera, Firefox, Chrome, and some others add a dotted underline to the content of the element. A few browsers not only add a dotted underline, but also put it in small caps; to avoid this styling, adding something like font-variant: none in the CSS takes care of this case. It is therefore recommended that web authors either explicitly style this element, or accept some cross-browser variation. Specifications Specification Status Comment ...
<applet>: The Embed Java Applet element - HTML: Hypertext Markup Language
Web › HTML › Element › applet
ermitted parents Any element that accepts embedded content. DOM interface HTMLAppletElement Attributes align This attribute is used to position the applet on the page relative to content that might flow around it. The HTML 4.01 specification defines values of bottom, left, middle, right, and top, whereas Microsoft and Netscape also might support absbottom, absmiddle, baseline, center, and texttop. alt This attribute causes a descriptive text alternate to be displayed on browsers that do not support Java. Page designers should also remember that content enclosed within the <applet> element may also be rendered as alternative text. archive This attribute refers to an archived or compressed version of the applet and its associated class files, which might help reduce...
<blockquote>: The Block Quotation element - HTML: Hypertext Markup Language
lobal attributes. cite A URL that designates a source document or message for the information quoted. This attribute is intended to point to information explaining the context or the reference for the quote. Usage notes To change the indentation applied to the quoted text, use the CSS margin-left and/or margin-right properties, or the margin shorthand property. To include shorter quotes inline rather than in a separate block, use the <q> (Quotation) element. Example This example demonstrates the use of the <blockquote> element to quote a passage from RFC 1149, A Standard for the Transmission of IP Datagrams on Avian Carriers. <blockquote cite="https://tools.ietf.org/html/rfc1149"> <p>Avian carriers can provide high delay, low throughput, and low altitude service. The connectio...
<body>: The Document Body element - HTML: Hypertext Markup Language
Web › HTML › Element › body
e document receives focus. onhashchange Function to call when the fragment identifier part (starting with the hash ('#') character) of the document's current address has changed. onlanguagechange Function to call when the preferred languages changed. onload Function to call when the document has finished loading. onmessage Function to call when the document has received a message. onoffline Function to call when network communication has failed. ononline Function to call when network communication has been restored. onpopstate Function to call when the user has navigated session history. onredo Function to call when the user has moved forward in undo transaction history. onresize Function to call when the document has been resized. onstorage Function to call when the stor...
<col> - HTML: Hypertext Markup Language
Web › HTML › Element › col
ign numbers or monetary values. If align is not set to char, this attribute is ignored. charoff This attribute is used to indicate the number of characters to offset the column data from the alignment characters specified by the char attribute. valign This attribute specifies the vertical alignment of the text within each cell of the column. Possible values for this attribute are: baseline, which will put the text as close to the bottom of the cell as it is possible, but align it on the baseline of the characters instead of the bottom of them. If characters are all of the size, this has the same effect as bottom. bottom, which will put the text as close to the bottom of the cell as it is possible; middle, which will center the text in the cell; and top, which will put the tex...
<colgroup> - HTML: Hypertext Markup Language
Web › HTML › Element › colgroup
e default value for the align of the <col> which are members of this column group. charoff This attribute is used to indicate the number of characters to offset the column data from the alignment character specified by the char attribute. valign This attribute specifies the vertical alignment of the text within each cell of the column. Possible values for this attribute are: baseline, which will put the text as close to the bottom of the cell as it is possible, but align it on the baseline of the characters instead of the bottom of them. If characters are all of the size, this has the same effect as bottom. bottom, which will put the text as close to the bottom of the cell as it is possible; middle, which will center the text in the cell; and top, which will put the tex...
<dir>: The Directory element (obsolete) - HTML: Hypertext Markup Language
Web › HTML › Element › dir
utes. compact This Boolean attribute hints that the list should be rendered in a compact style. The interpretation of this attribute depends on the user agent and it doesn't work in all browsers. Usage note: Do not use this attribute, as it has been deprecated: the <dir> element should be styled using CSS. To give a similar effect as that achieved with the compact attribute, the CSS property line-height can be used with a value of 80%. ...
<div>: The Content Division element - HTML: Hypertext Markup Language
Web › HTML › Element › div
box by applying a style to the <div> using CSS. Note the use of the class attribute on the <div> to apply the style named "shadowbox" to the element. HTML <div class="shadowbox"> <p>Here's a very interesting note displayed in a lovely shadowed box.</p> </div> CSS .shadowbox { width: 15em; border: 1px solid #333; box-shadow: 8px 8px 5px #444; padding: 8px 12px; background-image: linear-gradient(180deg, #fff, #ddd 40%, #ccc); } Result Specifications Specification Status Comment HTML Living StandardThe definition of '<div>' in that specification. Living Standard No changes since the latest snapshot HTML5The definition of '<div>' in that specification. Recommendation Obsoleted align HTML 4.01 SpecificationThe definit...
<figure>: The Figure with Optional Caption element - HTML: Hypertext Markup Language
Web › HTML › Element › figure
mitted roles DOM interface HTMLElement Attributes This element only includes the global attributes. Usage notes Usually a <figure> is an image, illustration, diagram, code snippet, etc., that is referenced in the main flow of a document, but that can be moved to another part of the document or to an appendix without affecting the main flow. Being a sectioning root, the outline of the content of the <figure> element is excluded from the main outline of the document. A caption can be associated with the <figure> element by inserting a <figcaption> inside it (as the first or the last child). The first <figcaption> element found in the figure is presented as the figure's caption. Examples Images <!-- Just an image --> <figure> <img src="https://udn.realityripple.c...
<footer> - HTML: Hypertext Markup Language
Web › HTML › Element › footer
on Permitted ARIA roles group, presentation or none DOM interface HTMLElement Attributes This element only includes the global attributes. Usage notes Enclose information about the author in an <address> element that can be included into the <footer> element. The <footer> element is not sectioning content and therefore doesn't introduce a new section in the outline. Examples <footer> Some copyright info or perhaps some author info for an &lt;article&gt;? </footer> Accessibility concerns The VoiceOver screen reader has an issue where the footer landmark role is not announced in the landmark rotor. To address this, add role="contentinfo" to the footer element. WebKit Bugzilla: 146930 - AX: HTML native elements (header, footer, main, aside, nav) s...
<head>: The Document Metadata (Header) element - HTML: Hypertext Markup Language
Web › HTML › Element › head
s. Note: <head> primarily holds information for machine processing, not human-readability. For human-visible information, like top-level headings and listed authors, see the <header> element. Content categories None. Permitted content If the document is an <iframe> srcdoc document, or if title information is available from a higher level protocol (like the subject line in HTML email), zero or more elements of metadata content. Otherwise, one or more elements of metadata content where exactly one is a <title> element. Tag omission The start tag may be omitted if the first thing inside the <head> element is an element. The end tag may be omitted if the first thing following the <head> element is not a space character or a comment. ...
<header> - HTML: Hypertext Markup Language
Web › HTML › Element › header
banner, or no corresponding role if a descendant of an article, aside, main, nav or section element, or an element with role=article, complementary, main, navigation or region Permitted ARIA roles group, presentation or none DOM interface HTMLElement Usage notes The <header> element is not sectioning content and therefore does not introduce a new section in the outline. That said, a <header> element is intended to usually contain the surrounding section's heading (an h1-h6 element), but this is not required. Historical Usage Although the <header> element didn't make its way into specifications until HTML5, it actually existed at the very beginning of HTML. As seen in the very first website, it was originally used as the <head> element. At some point, it was d...
<hr>: The Thematic Break (Horizontal Rule) element - HTML: Hypertext Markup Language
Web › HTML › Element › hr
en paragraph-level elements: for example, a change of scene in a story, or a shift of topic within a section. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Historically, this has been presented as a horizontal rule or line. While it may still be displayed as a horizontal rule in visual browsers, this element is now defined in semantic terms, rather than presentational terms, so if you wish to draw a horizontal line, you should do so using appropriate CSS. Content categories Flow content. Permitted content None, it is an empty element. Tag omission It must have start tag, but mus...
<html>: The HTML Document / Root element - HTML: Hypertext Markup Language
Web › HTML › Element › html
language used by the majority of the content of the page. Without it, screen readers will typically default to the operating system's set language, which may cause mispronunciations. Including a valid lang declaration on the <html> element also ensures that important metadata contained in the page's <head>, such as the page's <title>, are also announced properly. MDN Understanding WCAG, Guideline 3.1 explanations Understanding Success Criterion 3.1.1 | W3C Understanding WCAG 2.0 Specifications Specification Status Comment HTML Living StandardThe definition of '<html>' in that specification. Living Standard HTML5The definition of '<html>' in that specification. Recommendation Added support for the manifest attribute (deprecated later). ...
<input type="checkbox"> - HTML: Hypertext Markup Language
Web › HTML › Element › input › checkbox
checked and unchecked states, there is a third state a checkbox can be in: indeterminate. This is a state in which it's impossible to say whether the item is toggled on or off. This is set using the HTMLInputElement object's indeterminate property via JavaScript (it cannot be set using an HTML attribute): inputInstance.indeterminate = true; A checkbox in the indeterminate state has a horizontal line in the box (it looks somewhat like a hyphen or minus sign) instead of a check/tick in most browsers. There are not many use cases for this property. The most common is when a checkbox is available that "owns" a number of sub-options (which are also checkboxes). If all of the sub-options are checked, the owning checkbox is also checked, and if they're all unchecked, the owning checkbox is uncheck...
<input type="datetime-local"> - HTML: Hypertext Markup Language
lid and :invalid CSS properties to style the input based on whether or not the current value is valid. We had to put the icons on a <span> next to the input, not on the input itself, because in Chrome the generated content is placed inside the form control, and can't be styled or shown effectively. div { margin-bottom: 10px; display: flex; align-items: center; } label { display: inline-block; width: 300px; } input:invalid+span:after { content: '?'; padding-left: 5px; } input:valid+span:after { content: '?'; padding-left: 5px; } Important: HTML form validation is not a substitute for scripts that ensure that the entered data is in the proper format. It's far too easy for someone to make adjustments to the HTML that allow them to bypass the validation, or t...
<input type="number"> - HTML: Hypertext Markup Language
Web › HTML › Element › input › number
minimum value. This value must be less than or equal to the value of the max attribute. placeholder The placeholder attribute is a string that provides a brief hint to the user as to what kind of information is expected in the field. It should be a word or short phrase that demonstrates the expected type of data, rather than an explanatory message. The text must not include carriage returns or line feeds. If the control's content has one directionality (LTR or RTL) but needs to present the placeholder in the opposite directionality, you can use Unicode bidirectional algorithm formatting characters to override directionality within the placeholder; see Overriding BiDi using Unicode control characters in The Unicode Bidirectional Text Algorithm for those characters. Note: Avoid using the p...
<input type="range"> - HTML: Hypertext Markup Language
Web › HTML › Element › input › range
nput type="range" min="0" max="11" value="7" step="1"> </div> CSS Now we need some CSS. First is the CSS for the wrapper itself; this specifies the display mode and size we want so that the page lays out correctly; in essence, it's reserving an area of the page for the slider so that the rotated slider fits into the reserved space without making a mess of things. .slider-wrapper { display: inline-block; width: 20px; height: 150px; padding: 0; } Then comes the style information for the <input> element within the reserved space: .slider-wrapper input { width: 150px; height: 20px; margin: 0; transform-origin: 75px 75px; transform: rotate(-90deg); } The size of the control is set to be 150 pixels long by 20 pixels tall. The margins are set to 0 and the transform-origin is ...
<input type="search"> - HTML: Hypertext Markup Language
Web › HTML › Element › input › search
lanatory text nearby. See the section Specifying a pattern for details and an example. placeholder The placeholder attribute is a string that provides a brief hint to the user as to what kind of information is expected in the field. It should be a word or short phrase that demonstrates the expected type of data, rather than an explanatory message. The text must not include carriage returns or line feeds. If the control's content has one directionality (LTR or RTL) but needs to present the placeholder in the opposite directionality, you can use Unicode bidirectional algorithm formatting characters to override directionality within the placeholder; see Overriding BiDi using Unicode control characters in The Unicode Bidirectional Text Algorithm for those characters. Note: Avoid using the p...
<input type="url"> - HTML: Hypertext Markup Language
Web › HTML › Element › input › url
xplanatory text nearby. See the section Pattern validation for details and an example. placeholder The placeholder attribute is a string that provides a brief hint to the user as to what kind of information is expected in the field. It should be a word or short phrase that demonstrates the expected type of data, rather than an explanatory message. The text must not include carriage returns or line feeds. If the control's content has one directionality (LTR or RTL) but needs to present the placeholder in the opposite directionality, you can use Unicode bidirectional algorithm formatting characters to override directionality within the placeholder; see Overriding BiDi using Unicode control characters in The Unicode Bidirectional Text Algorithm for those characters. Note: Avoid using the p...
<isindex> - HTML: Hypertext Markup Language
Web › HTML › Element › isindex
When sent, the server would return a list of pages matching the query. Its support depended on both the browser and the server to react to the query. <isindex> is removed HTML Standard. It was deprecated in HTML 4.01. The same behaviour can be achieved with an HTML form. All major browsers have now removed <isindex>. Attributes Like all other HTML elements, this element accepted the global attributes. prompt This attribute added its value as a prompt for text field. ...
<kbd>: The Keyboard Input element - HTML: Hypertext Markup Language
Web › HTML › Element › kbd
By convention, the user agent defaults to rendering the contents of a <kbd> element using its default monospace font, although this is not mandated by the HTML standard. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. <kbd> may be nested in various combinations with the <samp> (Sample Output) element to represent various forms of input or output based on visual cues. ...
<label> - HTML: Hypertext Markup Language
Web › HTML › Element › label
as no effect. If there are other elements which also match the id value, later in the document, they are not considered. Note: A <label> element can have both a for attribute and a contained control element, as long as the for attribute points to the contained control element. Styling with CSS There are no special styling considerations for <label> elements -- structurally they are simple inline elements, and so can be styled in much the same way as a <span> or <a> element. You can apply styling to them in any way you want, as long as you don't cause the text to become difficult to read. Examples Simple label example <label>Click me <input type="text"></label> Using the "for" attribute <label for="username">Click me</label> <input type="text" id="username"> Accessibility concer...
<link>: The External Resource Link element - HTML: Hypertext Markup Language
Web › HTML › Element › link
o: Indicates no preference. The browser may use its own heuristics to decide the priority of the resource. high: Indicates to the browser that the resource is of high priority. low: Indicates to the browser that the resource is of low priority. Note: The importance attribute may only be used for the <link> element if rel="preload" or rel="prefetch" is present. integrity Contains inline metadata -- a base64-encoded cryptographic hash of the resource (file) you're telling the browser to fetch. The browser can use this to verify that the fetched resource has been delivered free of unexpected manipulation. See Subresource Integrity. media This attribute specifies the media that the linked resource applies to. Its value must be a media type / media query. This attribute is mainly ...
<listing> - HTML: Hypertext Markup Language
Web › HTML › Element › listing
Note: Do not use this element. It is deprecated since HTML 3.2 and was neither implemented by all browsers, nor in a consistent way. ...
<main> - HTML: Hypertext Markup Language
Web › HTML › Element › main
includes the global attributes. Usage notes The content of a <main> element should be unique to the document. Content that is repeated across a set of documents or document sections such as sidebars, navigation links, copyright information, site logos, and search forms shouldn't be included unless the search form is the main function of the page. <main> doesn't contribute to the document's outline; that is, unlike elements such as <body>, headings such as <h2>, and such, <main> doesn't affect the DOM's concept of the structure of the page. It's strictly informative. Example <!-- other content --> <main> <h1>Apples</h1> <p>The apple is the pomaceous fruit of the apple tree.</p> <article> <h2>Red Delicious</h2> <p>These bright red apples are the most common found in many ...
<menu> - HTML: Hypertext Markup Language
Web › HTML › Element › menu
tains items for display, whilst <menu> is intended for interactive items, to act on. An HTML menu can be used to create context menus (typically activated by right-clicking another element) or toolbars. Context menus consist of a <menu> element which contains <menuitem> elements for each selectable option in the menu, <menu> elements for submenus within the menu, and <hr> elements for separator lines to break up the menu's content into sections. Context menus are then attached to the element they're activated from using either the associated element's contextmenu attribute or, for button-activated menus attached to <button> elements, the menu attribute. Toolbar menus consist of a <menu> element whose content is described in one of two ways: either as an unordered list of items represented b...
Standard metadata names - HTML: Hypertext Markup Language
Web › HTML › Element › meta › name
default values may vary between devices and browsers. To learn about this declaration in Firefox for Mobile, see this article. Accessibility concerns with viewport scaling Disabling zooming capabilities by setting user-scalable to a value of no prevents people experiencing low vision conditions from being able to read and understand page content. MDN Understanding WCAG, Guideline 1.4 explanations Understanding Success Criterion 1.4.4 | W3C Understanding WCAG 2.0 See also The @viewport CSS at-rule. Other metadata names The WHATWG Wiki MetaExtensions page contains a large set of non-standard metadata names that have not been formally accepted yet; however, some of the names included there are already used quite commonly in practice -- including the followin...
<plaintext>: The Plain Text element (Deprecated) - HTML: Hypertext Markup Language
xt> is obsolete in HTML5; browsers that accept it may instead treat it as a <pre> element that still interprets HTML within. If <plaintext> is the first element on the page (other than any non-displayed elements, like <head>), do not use HTML at all. Instead serve a text file with the text/plain MIME-type. Instead of <plaintext>, use the <pre> element or, if semantically accurate (such as for inline text), the <code> element. Escape any <, > and & characters, to prevent browsers inadvertently parsing content the element content as HTML. A monospaced font can be applied to any HTML element via a CSS font-family style with the monospace generic value. Attributes This element has no other attributes than the global attributes common to all elements. DOM interface This element implements ...
<samp>: The Sample Output element - HTML: Hypertext Markup Language
Web › HTML › Element › samp
Its contents are typically rendered using the browser's default monospaced font (such as Courier or Lucida Console). The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Content categories Flow content, phrasing content, palpable content. Permitted content Phrasing content. Tag omission None, both the starting and ending tag are mandatory. ...
<section>: The Generic Section element - HTML: Hypertext Markup Language
Web › HTML › Element › section
uding a heading (<h1>-<h6> element) as a child of the <section> element. If it makes sense to separately syndicate the content of a <section> element, use an <article> element instead. Do not use the <section> element as a generic container; this is what <div> is for, especially when the sectioning is only for styling purposes. A rule of thumb is that a section should logically appear in the outline of a document. Example Before <div> <h1>Heading</h1> <p>Bunch of awesome content</p> </div> After <section> <h1>Heading</h1> <p>Bunch of awesome content</p> </section> Specifications Specification Status Comment HTML Living StandardThe definition of '<section>' in that specification. Living Standard HTML 5.1The definition of '<section>'...
<strike> - HTML: Hypertext Markup Language
Web › HTML › Element › strike
Usage note: This element is deprecated in HTML 4 and XHTML 1, and obsoleted in HTML5. If semantically appropriate, i.e., if it represents deleted content, use <del> instead. In all other cases use <s>. ...
<strong>: The Strong Importance element - HTML: Hypertext Markup Language
Web › HTML › Element › strong
ot exactly. The <strong> element is for content that is of greater importance, while the <b> element is used to draw attention to text without indicating that it's more important. It may help to realize that both are valid and semantic elements in HTML5 and that it's a coincidence that they both have the same default styling (boldface) in most browsers (although some older browsers actually underline <strong>). Each element is meant to be used in certain types of scenarios, and if you want to bold text simply for decoration, you should instead actually use the CSS font-weight property. The intended meaning or purpose of the enclosed text should be what determines which element you use. Communicating meaning is what semantics are all about. <em> vs. <strong> Adding to the confusion is the f...
<style>: The Style Information element - HTML: Hypertext Markup Language
Web › HTML › Element › style
xt/css if it is not specified; values other than the empty string or text/css are not used. Note: There is very little reason to include this attribute in modern web documents. media This attribute defines which media the style should be applied to. Its value is a media query, which defaults to all if the attribute is missing. nonce A cryptographic nonce (number used once) used to whitelist inline styles in a style-src Content-Security-Policy. The server must generate a unique nonce value each time it transmits a policy. It is critical to provide a nonce that cannot be guessed as bypassing a resource's policy is otherwise trivial. title This attribute specifies alternative style sheet sets. Deprecated attributes scoped This attribute specifies that the styles only apply to th...
<table>: The Table element - HTML: Hypertext Markup Language
Web › HTML › Element › table
t, apply the border-spacing property to the <table> element. border-spacing does not have any effect if border-collapse is set to collapse. frame This enumerated attribute defines which side of the frame surrounding the table must be displayed. To achieve a similar effect, use the border-style and border-width properties. rules This enumerated attribute defines where rules, i.e. lines, should appear in a table. It can have the following values: none, which indicates that no rules will be displayed; it is the default value; groups, which will cause the rules to be displayed between row groups (defined by the <thead>, <tbody> and <tfoot> elements) and between column groups (defined by the <col> and <colgroup> elements) only; rows, which will cause the rules to be displ...
<td>: The Table Data Cell element - HTML: Hypertext Markup Language
Web › HTML › Element › td
ended cell height. Use the CSS height property instead. scope This enumerated attribute defines the cells that the header (defined in the <th>) element relates to. Only use this attribute with the <th> element to define the row or column for which it is a header. valign This attribute specifies how a text is vertically aligned inside a cell. Possible values for this attribute are: baseline: Positions the text near the bottom of the cell and aligns it with the baseline of the characters instead of the bottom. If characters don't descend below the baseline, the baseline value achieves the same effect as bottom. bottom: Positions the text near the bottom of the cell. middle: Centers the text in the cell. and top: Positions the text near the top of the cell. To achieve a simi...
<tfoot>: The Table Foot element - HTML: Hypertext Markup Language
Web › HTML › Element › tfoot
ters to offset the column data from the alignment characters specified by the char attribute. Note: Do not use this attribute as it is obsolete (and not supported) in the latest standard. valign Deprecated since HTML4Obsolete since HTML5 This attribute specifies the vertical alignment of the text within each row of cells of the table header. Possible values for this attribute are: baseline, which will put the text as close to the bottom of the cell as it is possible, but align it on the baseline of the characters instead of the bottom of them. If characters are all of the size, this has the same effect as bottom. bottom, which will put the text as close to the bottom of the cell as it is possible; middle, which will center the text in the cell; and top, which will put the tex...
<th> - HTML: Hypertext Markup Language
Web › HTML › Element › th
e latest standard. height Deprecated since HTML4, Obsolete since HTML5 This attribute is used to define a recommended cell height. Note: Do not use this attribute as it is obsolete in the latest standard: use the CSS height property instead. valign Obsolete since HTML5 This attribute specifies how a text is vertically aligned inside a cell. Possible values for this attribute are: baseline: Positions the text near the bottom of the cell and aligns it with the baseline of the characters instead of the bottom. If characters don't descend below the baseline, the baseline value achieves the same effect as bottom. bottom: Positions the text near the bottom of the cell. middle: Centers the text in the cell. and top: Positions the text near the top of the cell. Note: Do not use ...
<thead>: The Table Head element - HTML: Hypertext Markup Language
Web › HTML › Element › thead
he number of characters to offset the column data from the alignment characters specified by the char attribute. Note: Do not use this attribute as it is obsolete (and not supported) in the latest standard. valign in HTML 4, in HTML5 This attribute specifies the vertical alignment of the text within each row of cells of the table header. Possible values for this attribute are: baseline, which will put the text as close to the bottom of the cell as it is possible, but align it on the baseline of the characters instead of the bottom of them. If characters are all of the size, this has the same effect as bottom. bottom, which will put the text as close to the bottom of the cell as it is possible; middle, which will center the text in the cell; top, which will put the text as...
<tt>: The Teletype Text element (obsolete) - HTML: Hypertext Markup Language
Web › HTML › Element › tt
The obsolete HTML Teletype Text element (<tt>) creates inline text which is presented using the user agent's default monospace font face. This element was created for the purpose of rendering text as it would be displayed on a fixed-width display such as a teletype, text-only screen, or line printer. The terms non-proportional, monotype, and monospace are used interchangeably and have the same general meaning: they describe a typeface whose characters are all the same number of pixels wide. This element is obsolete, however. You should use the more semantically helpful <code>, <kbd>, <samp>, or <var> elements for inline text that needs to be presented in monospace type, or the <pre> tag for content that should be presented as a separate block. If none of the semantic elements are appropr...
<ul>: The Unordered List element - HTML: Hypertext Markup Language
Web › HTML › Element › ul
butes This element includes the global attributes. compact This Boolean attribute hints that the list should be rendered in a compact style. The interpretation of this attribute depends on the user agent, and it doesn't work in all browsers. Warning: Do not use this attribute, as it has been deprecated: use CSS instead. To give a similar effect as the compact attribute, the CSS property line-height can be used with a value of 80%. type This attribute sets the bullet style for the list. The values defined under HTML3.2 and the transitional version of HTML 4.0/4.01 are: circle disc square A fourth bullet type has been defined in the WebTV interface, but not all browsers support it: triangle. If not present and if no CSS list-style-type property applies to the ele...
<xmp> - HTML: Hypertext Markup Language
Web › HTML › Element › xmp
Note: Do not use this element. It has been deprecated since HTML3.2 and was not implemented in a consistent way. It was completely removed from the language in HTML5. Use the <pre> element or, if semantically adequate, the <code> element instead. ...
Microformats - HTML: Hypertext Markup Language
s names use prefixes. Prefixes are syntax independent from vocabularies, which are developed separately. "h-*" for root class names, e.g. "h-card", "h-entry", "h-feed", and many more. These top-level root classes usually indicate a type and corresponding expected vocabulary of properties. For example: h-card describes a person or organization h-entry describes episodic or date stamped online content like a blog post h-feed describes a stream or feed of posts You can find many more vocabularies on the microformats2 wiki. "p-*" for plain (text) properties, e.g. "p-name", "p-summary" Generic plain text parsing, element text in general. On certain HTML elements, use special attributes first, e.g. img/alt, abbr/title. "u-*" for URL properties, e.g. "u-url", "u-photo", "u...
HTML: Hypertext Markup Language
Web › HTML
e Elements in HTML have attributes. These are additional values that configure the elements or adjust their behavior in various ways. Global attributes Global attributes may be specified on all HTML elements, even those not specified in the standard. This means that any non-standard elements must still permit these attributes, even though those elements make the document HTML5-noncompliant. Inline elements and block-level elements HTML elements are usually "inline" or "block-level" elements. An inline element occupies only the space bounded by the tags that define it. A block-level element occupies the entire space of its parent element (container), thereby creating a "block." Link types In HTML, various link types can be used to establish and define the relationship between two documen...
HTTP authentication - HTTP
e or valuable information. Restricting access with Apache and basic authentication To password-protect a directory on an Apache server, you will need a .htaccess and a .htpasswd file. The .htaccess file typically looks like this: AuthType Basic AuthName "Access to the staging site" AuthUserFile /path/to/.htpasswd Require valid-user The .htaccess file references a .htpasswd file in which each line consists of a username and a password separated by a colon (:). You cannot see the actual passwords as they are hashed (using MD5-based hashing, in this case). Note that you can name your .htpasswd file differently if you like, but keep in mind this file shouldn't be accessible to anyone. (Apache is usually configured to prevent access to .ht* files). aladdin:$apr1$ZjTqBB3f$IF9gdYAGlMrs2fuINjHsz...
Basics of HTTP - HTTP
me structure, its purpose, and the way it's encoded. Connection management in HTTP/1.x HTTP/1.1 was the first version of HTTP to support persistent connection and pipelining. This article explains both concepts. Connection management in HTTP/2 HTTP/2 completely revisited how connections are created and maintained. This article explains how HTTP frames allow multiplexing and solve the 'head-of-line' blocking problem of former HTTP versions. Content Negotiation HTTP introduces a set of headers, starting with Accept as a way for a browser to announce the format, language, or encoding it prefers. This article explains how this advertisement happens, how the server is expected to react, and how it chooses the most adequate response. ...
Browser detection using the user agent - HTTP
imes with floats as a partial fallback. Also try to move less relevant/important information down to the bottom and group the page's content together meaningfully. Although it is off-topic, perhaps the following detailed example might give you insights and ideas that persuade you to forgo user agent sniffing. Let us imagine a page composed of boxes of information; each box is about a different feline breed or canine breed. Each box has an image, an overview, and a historical funfact. The pictures are kept to a maximum reasonable size even on large screens. For the purposes of grouping the content meaningfully, all the cat boxes are separated from all the dog boxes such that the cat and dog boxes are not intermixed together. On a large screen, it saves space to have multiple columns to reduce ...
Reason: CORS header 'Access-Control-Allow-Origin' does not match 'xyz' - HTTP
trol-Allow-Origin header. This error can also occur if the response includes more than one Access-Control-Allow-Origin header. If the service your code is accessing using a CORS request is under your control, make sure that it's configured to include your origin in its Access-Control-Allow-Origin header, and that only one such header is included in responses. The header itself accepts a comma-delineated list of origins, so adding a new origin is not difficult. For example, in Apache, add a line such as the following to the server's configuration (within the appropriate <Directory>, <Location>, <Files>, or <VirtualHost> section). The configuration is typically found in a .conf file (httpd.conf and apache.conf are common names for these), or in an .htaccess file. Header set Access-Control-Al...
Reason: invalid token ‘xyz’ in CORS header ‘Access-Control-Allow-Headers’ - HTTP
What went wrong? The response to the CORS request that was sent by the server includes an Access-Control-Allow-Headers header which includes at least one invalid header name. The Access-Control-Allow-Headers header is sent by the server in response to a preflight request; it lets the client know which HTTP headers are permitted in CORS requests. If the client user agent finds among the comma-delineated values provided by the header any header name it does not recognize, this error occurs. This is a problem that most likely can only be fixed on the server side, by modifying the server's configuration to no longer send the invalid or unknown header name with the Access-Control-Allow-Headers header. It may also be worth checking to ensure that the user agent or HTTP library you're using on th...
Reason: invalid token ‘xyz’ in CORS header ‘Access-Control-Allow-Methods’ - HTTP
' in CORS header 'Access-Control-Allow-Methods' What went wrong? The response to the CORS request that was sent by the server includes an Access-Control-Allow-Methods header which includes at least one invalid method name. The Access-Control-Allow-Methods header is sent by the server to let the client know what HTTP request methods it supports for CORS requests. The header's value is a comma-delineated string of HTTP method names, such as GET, POST, or HEAD. If any of the specified values are not recognized by the client user agent, this error occurs. This is a problem that most likely can only be fixed on the server side, by modifying the server's configuration to no longer send the invalid or unknown method name with the Access-Control-Allow-Methods header. It may also be worth checking ...
Reason: Did not find method in CORS header ‘Access-Control-Allow-Methods’ - HTTP
Reason Reason: Did not find method in CORS header 'Access-Control-Allow-Methods' What went wrong? The HTTP method being used by the CORS request is not included in the list of methods specified by the response's Access-Control-Allow-Methods header. This header specifies a comma-delineated list of the HTTP methods which may be used when using CORS to access the URL specified in the request; if the request is using any other method, this error occurs. For example, if the response includes: Access-Control-Allow-Methods: GET,HEAD,POST Trying to use a PUT request will fail with this error. Make sure your code only uses the permitted HTTP methods when accessing the service. Note: If the server includes any unrecognized or undefined method names in its Access-Control-Allow-methods header, a ...
Reason: missing token ‘xyz’ in CORS header ‘Access-Control-Allow-Headers’ from CORS preflight channel - HTTP
Reason Reason: missing token 'xyz' in CORS header 'Access-Control-Allow-Headers' from CORS preflight channel What went wrong? The Access-Control-Allow-Headers header is sent by the server to let the client know which headers it supports for CORS requests. The value of Access-Control-Allow-Headers should be a comma-delineated list of header names, such as "X-Custom-Information" or any of the standard but non-basic header names (which are always allowed). This error occurs when attempting to preflight a header that is not expressly allowed (that is, it's not included in the list specified by the Access-Control-Allow-Headers header sent by the server). To fix this, the server needs to be updated so that it allows the indicated header, or you need to avoid using that header. ...
Reason: CORS header 'Access-Control-Allow-Origin' missing - HTTP
equests without using the * wildcard (for example, to enable credentials), your server must read the value of the request's Origin header and use that value to set Access-Control-Allow-Origin, and must also set a Vary: Origin header to indicate that some headers are being set dynamically depending on the origin. The exact directive for setting headers depends on your web server. In Apache, add a line such as the following to the server's configuration (within the appropriate <Directory>, <Location>, <Files>, or <VirtualHost> section). The configuration is typically found in a .conf file (httpd.conf and apache.conf are common names for these), or in an .htaccess file. Header set Access-Control-Allow-Origin 'origin-list' For Nginx, the command to set up this header is: add_header 'Access-Con...
Configuring servers for Ogg media - HTTP
You'll need to convert it to seconds only, then serve that as your X-Content-Duration value. Just parse out the HH, MM, and SS into numbers, then do (HH*3600)+(MM*60)+SS to get the value you should report. It's important to note that it appears that oggz-info makes a read pass of the media in order to calculate its duration, so it'...
CSP: frame-ancestors - HTTP
ement. Syntax One or more sources can be set for the frame-ancestors policy: Content-Security-Policy: frame-ancestors <source>; Content-Security-Policy: frame-ancestors <source> <source>; Sources <source> can be one of the following: The frame-ancestors directive's syntax is similar to a source list of other directives (e.g. default-src), but doesn't allow 'unsafe-eval' or 'unsafe-inline' for example. It will also not fall back to a default-src setting. Only the sources listed below are allowed: <host-source> Internet hosts by name or IP address, as well as an optional URL scheme and/or port number, separated by spaces. The site's address may include an optional leading wildcard (the asterisk character, '*'), and you may use a wildcard (again, '*') as the port number, indica...
Content-Security-Policy-Report-Only - HTTP
t-Only header is used. document-uri The URI of the document in which the violation occurred. effective-directive The directive whose enforcement caused the violation. original-policy The original policy as specified by the Content-Security-Policy-Report-Only HTTP header. referrer The referrer of the document in which the violation occurred. script-sample The first 40 characters of the inline script, event handler, or style that caused the violation. status-code The HTTP status code of the resource on which the global object was instantiated. violated-directive The name of the policy section that was violated. Sample violation report Let's consider a page located at http://example.com/signup.html. It uses the following policy, disallowing everything but stylesheets from cdn.exa...
Keep-Alive - HTTP
entifiers are possible: timeout: indicating the minimum amount of time an idle connection has to be kept opened (in seconds). Note that timeouts longer than the TCP timeout may be ignored if no keep-alive TCP message is set at the transport level. max: indicating the maximum number of requests that can be sent on this connection before closing it. Unless 0, this value is ignored for non-pipelined connections as another request will be sent in the next response. An HTTP pipeline can use it to limit the pipelining. Examples A response containing a Keep-Alive header: HTTP/1.1 200 OK Connection: Keep-Alive Content-Encoding: gzip Content-Type: text/html; charset=utf-8 Date: Thu, 11 Aug 2016 15:23:13 GMT Keep-Alive: timeout=5, max=1000 Last-Modified: Mon, 25 Jul 2016 04:32:39 GMT Serve...
Set-Cookie - HTTP
ormatting. If unspecified, the cookie becomes a session cookie. A session finishes when the client shuts down, and session cookies will be removed. Warning: Many web browsers have a session restore feature that will save all tabs and restore them next time the browser is used. Session cookies will also be restored, as if the browser was never closed. When an Expires date is set, the deadline is relative to the client the cookie is being set on, not the server. Max-Age=<number> Optional Number of seconds until the cookie expires. A zero or negative number will expire the cookie immediately. If both Expires and Max-Age are set, Max-Age has precedence. Domain=<domain-value> Optional Host to which the cookie will be sent. If omitted, defaults to the host of the current document...
Firefox user agent string reference - HTTP
/26.0 Firefox/26.0 Device-specific user agent strings Although it is strongly discouraged by Mozilla, some handset manufacturers unfortunately include a token in their device's UA string that represents their device id. If this is the case, the Firefox OS UA string will look like the device-specific string in the table above, where nnnn; is the manufacturer's code for the device (see Guidelines). Some of them we have noticed are of the form "NexusOne;", "ZTEOpen;", or "Open C;" (note that putting space is also discouraged). We provide this information to assist with your UA detection logic, but Mozilla discourages the detection of a device id in UA strings. Here is a JavaScript regular expression that will detect all mobile devices, including devices with a device id in their UA strin...
X-XSS-Protection - HTTP
The HTTP X-XSS-Protection response header is a feature of Internet Explorer, Chrome and Safari that stops pages from loading when they detect reflected cross-site scripting (XSS) attacks. Although these protections are largely unnecessary in modern browsers when sites implement a strong Content-Security-Policy that disables the use of inline JavaScript ('unsafe-inline'), they can still provide protections for users of older web browsers that don't yet support CSP. Chrome has removed their XSS Auditor Firefox have not, and will not implement X-XSS-Protection Edge have retired their XSS filter This means that if you do not need to support legacy browsers, it is recommended that you use Content-Security-Policy without allowing unsafe-inline scripts instead. Header type Resp...
HTTP headers - HTTP
Web › HTTP › Headers
that are allowed to see values of attributes retrieved via features of the Resource Timing API, which would otherwise be reported as zero due to cross-origin restrictions. Do Not Track DNT Expresses the user's tracking preference. Tk Indicates the tracking status of the corresponding response. Downloads Content-Disposition Indicates if the resource transmitted should be displayed inline (default behavior without the header), or if it should be handled like a download and the browser should present a "Save As" dialog. Message body information Content-Length The size of the resource, in decimal number of bytes. Content-Type Indicates the media type of the resource. Content-Encoding Used to specify the compression algorithm. Content-Language Describes the human language...
OPTIONS - HTTP
Web › HTTP › Methods › OPTIONS
he entire server. ...
Proxy servers and tunneling - HTTP
When navigating through different networks of the Internet, proxy servers and HTTP tunnels are facilitating access to content on the World Wide Web. A proxy can be on the user's local computer, or anywhere between the user's computer and a destination server on the Internet. This page outlines some basics about proxies and introduces a few configuration options. There are two types of proxies: forward proxies (or tunnel, or gateway) and reverse proxies (used to control and protect access to a server for load-balancing, authentication, decryption or caching). Forward proxies A forward proxy, or gateway, or just "proxy" provides proxy services to a client or a group of clients. There are likely hundreds of thousands of open forward proxies on the Internet. They store and forward Internet ser...
HTTP range requests - HTTP
HTTP/1.1 200 OK ... Accept-Ranges: none Requesting a specific range from a server If the server supports range requests, you can issue such a request by using the Range header. It indicates the part(s) of a document that the server should return. Single part ranges We can request a single range from a resource. Again, we can test a request by using cURL. The "-H" option will append a header line to the request, which in this case is the Range header requesting the first 1024 bytes. curl http://i.imgur.com/z4d4kWk.jpg -i -H "Range: bytes=0-1023" The issued request looks like this: GET /z4d4kWk.jpg HTTP/1.1 Host: i.imgur.com Range: bytes=0-1023 The server responses with the 206 Partial Content status: HTTP/1.1 206 Partial Content Content-Range: bytes 0-1023/146515 Content-Length: 1024...
HTTP
Web › HTTP
a the img element. Web pages today very commonly load cross-site resources, including CSS stylesheets, images, scripts, and other resources. CORS allows web developers to control how their site reacts to cross-site requests. Evolution of HTTP A brief description of the changes between the early versions of HTTP, to the modern HTTP/2, the emergent HTTP/3 and beyond. Mozilla web security guidelines A collection of tips to help operational teams with creating secure web applications. HTTP Messages Describes the type and structure of the different kind of messages of HTTP/1.x and HTTP/2. A typical HTTP session Shows and explains the flow of a usual HTTP session. Connection management in HTTP/1.x Describes the three connection management models available in HTTP/1.x, their strengths...
JavaScript data types and data structures - JavaScript
ap and WeakMap associate a value to an object. The difference between Maps and WeakMaps is that in the former, object keys can be enumerated over. This allows garbage collection optimizations in the latter case. One could implement Maps and Sets in pure ECMAScript 5. However, since objects cannot be compared (in the sense of < "less than", for instance), look-up performance would necessarily be linear. Native implementations of them (including WeakMaps) can have look-up performance that is approximately logarithmic to constant time. Usually, to bind data to a DOM node, one could set properties directly on the object, or use data-* attributes. This has the downside that the data is available to any script running in the same context. Maps and WeakMaps make it easy to privately bind data to a...
Equality comparisons and sameness - JavaScript
arisons? Prior to ES2015, you might have said of double equals and triple equals that one is an "enhanced" version of the other. For example, someone might say that double equals is an extended version of triple equals, because the former does everything that the latter does, but with type conversion on its operands. E.g., 6 == "6". (Alternatively, someone might say that double equals is the baseline, and triple equals is an enhanced version, because it requires the two operands to be the same type, so it adds an extra constraint. Which one is the better model for understanding depends on how you choose to view things.) However, this way of thinking about the built-in sameness operators is not a model that can be stretched to allow a place for ES2015's Object.is on this "spectrum". Object.is...
Details of the object model - JavaScript
Engineer (String mach) { dept = "engineering"; machine = mach; } } These JavaScript definitions use a special idiom for setting default values: this.name = name || ''; The JavaScript logical OR operator (||) evaluates its first argument. If that argument converts to true, the operator returns it. Otherwise, the operator returns the value of the second argument. Therefore, this line of code tests to see if name has a useful value for the name property. If it does, it sets this.name to that value. Otherwise, it sets this.name to the empty string. This chapter uses this idiom for brevity; however, it can be puzzling at first glance. Note: This may not work as expected if the constructor function is called with arguments which convert to false (like 0 (zero) and empty string ...
Functions - JavaScript
fault parameters (pre-ECMAScript 2015) In the past, the general strategy for setting defaults was to test parameter values in the body of the function and assign a value if they are undefined. In the following example, if no value is provided for b, its value would be undefined when evaluating a*b, and a call to multiply would normally have returned NaN. However, this is prevented by the second line in this example: function multiply(a, b) { b = typeof b !== 'undefined' ? b : 1; return a * b; } multiply(5); // 5 With default parameters (post-ECMAScript 2015) With default parameters, a manual check in the function body is no longer necessary. You can simply put 1 as the default value for b in the function head: function multiply(a, b = 1) { return a * b; } multiply(5); // 5 Fo...
Using Promises - JavaScript
result3) */ Timing To avoid surprises, functions passed to then() will never be called synchronously, ev...
About the JavaScript reference - JavaScript
and language constructs. Structure of the reference In the JavaScript reference you can find the following chapters: Standard built-in objects This chapter documents all the JavaScript standard built-in objects, along with their methods and properties. Statements and declarations JavaScript applications consist of statements with an appropriate syntax. A single statement may span multiple lines. Multiple statements may occur on a single line if each statement is separated by a semicolon. This isn't a keyword, but a group of keywords. Expressions and operators This chapter documents all the JavaScript language operators, expressions and keywords. Functions Chapter about JavaScript functions. Classes Chapter about JavaScript classes introduced in ECMAScript 2015. Errors Chapter a...
SyntaxError: invalid regular expression flag "x" - JavaScript
r expression flags can be used separately or together in any order, but there are only six of them in ECMAScript. To include a flag with the regular expression, use this syntax: var re = /pattern/flags; or var re = new RegExp('pattern', 'flags'); Regular expression flags Flag Description g Global search. i Case-insensitive search. m Multi-line search. s Allow . to match newlines (added in ECMAScript 2018) u Unicode; treat pattern as a sequence of Unicode code points y Perform a "sticky" search that matches starting at the current position in the target string. See sticky Examples There are only six valid regular expression flags. /foo/bar; // SyntaxError: invalid regular expression flag "b"...
TypeError: can't assign to property "x" on "y": not an object - JavaScript
, a TypeError is raised when attempting to create a property on primitive value such as a symbol, a string, a number or a boolean. Primitive values cannot hold any property. The problem might be that an unexpected value is flowing at an unexpected place, or that an object variant of a String or a Number is expected. Examples Invalid cases 'use strict'; var foo = "my string"; // The following line does nothing if not in strict mode. foo.bar = {}; // TypeError: can't assign to property "bar" on "my string": not an object Fixing the issue Either fix the code to prevent the primitive from being used in such places, or fix the issue is to create the object equivalent Object. 'use strict'; var foo = new String("my string"); foo.bar = {}; ...
TypeError: setting getter-only property "x" - JavaScript
operty() page. ...
SyntaxError: illegal character - JavaScript
// <37e> is not ; but looks like this This should work: "This is actually a string"; 42 - 13; var foo = 'bar'; Some editors and IDEs will notify you or at least use a slightly different highlighting for it, but not all. When something like this happens to your code and you're not able to find the source of the problem, it's often best to just delete the problematic line and retype it. Forgotten characters It's easy to forget a character here or there. var colors = ['#000', #333', '#666']; // SyntaxError: illegal character Add the missing quote for '#333'. var colors = ['#000', '#333', '#666']; Hidden characters When copy pasting code from external sources, there might be invalid characters. Watch out! var foo = 'bar'; // SyntaxError: illegal character ...
SyntaxError: missing variable name - JavaScript
heck for typos! Message SyntaxError: missing variable name (Firefox) SyntaxError: Unexpected token = (Chrome) Error type SyntaxError What went wrong? A variable is missing a name. This is likely due to a syntax error in your code. Probably a comma is wrong somewhere or you struggled with coming up with a name. Totally understandable! Naming things is so hard. Check to ensure the previous lines / declaration does not end with a comma instead of a semi-colon. Examples Missing a variable name var = "foo"; It's tough coming up with good variable names. We all have been there. var ohGodWhy = "foo"; Reserved keywords can't be variable names There are a few variable names that are reserved keywords. You can't use these. Sorry :( var debugger = "whoop"; // SyntaxError: missing varia...
Arrow function expressions - JavaScript
cted. var func = () => { foo: 1 }; // Calling func() returns undefined! var func = () => { foo: function() {} }; // SyntaxError: function statement requires a name This is because the code inside braces ({}) is parsed as a sequence of statements (i.e. foo is treated like a label, not a key in an object literal). You must wrap the object literal in parentheses: var func = () => ({ foo: 1 }); Line breaks An arrow function cannot contain a line break between its parameters and its arrow. var func = (a, b, c) => 1; // SyntaxError: expected expression, got '=>' However, this can be amended by putting the line break after the arrow or using parentheses/braces as seen below to ensure that the code stays pretty and fluffy. You can also put line breaks between arguments. var func = (a, b, c...
Default parameters - JavaScript
was to test parameter values in the function body and assign a value if they are undefined. In the following example, if no value is provided for b when multiply is called, b's value would be undefined when evaluating a * b and multiply would return NaN. function multiply(a, b) { return a * b } multiply(5, 2) // 10 multiply(5) // NaN ! To guard against this, something like the second line would be used, where b is set to 1 if multiply is called with only one argument: function multiply(a, b) { b = (typeof b !== 'undefined') ? b : 1 return a * b } multiply(5, 2) // 10 multiply(5) // 5 With default parameters in ES2015, checks in the function body are no longer necessary. Now, you can assign 1 as the default value for b in the function head: function multiply(a, b = 1...
Array.prototype.forEach() - JavaScript
tems.length; i++) { copyItems.push(items[i]) } // after items.forEach(function(item){ copyItems.push(item) }) Printing the contents of an array Note: In order to display the content of an array in the console, you can use console.table(), which prints a formatted version of the array. The following example illustrates an alternative approach, using forEach(). The following code logs a line for each element in an array: function logArrayElements(element, index, array) { console.log('a[' + index + '] = ' + element) } // Notice that index 2 is skipped, since there is no item at // that position in the array... [2, 5, , 9].forEach(logArrayElements) // logs: // a[0] = 2 // a[1] = 5 // a[3] = 9 Using thisArg The following (contrived) example updates an object's properties from eac...
BigInt.prototype.toLocaleString() - JavaScript
G')); // -> ??????????????????????? // India uses thousands/lakh/crore separators console.log(bigint.toLocaleString('en-IN')); // -> 1,23,45,67,89,12,34,56,789 // the nu extension key requests a numbering system, e.g. ...
Date.parse() - JavaScript
N in all browsers compliant with ES5 and later: // ISO string with invalid values new Date('2014-25-23').toISOString(); // throws "RangeError: invalid date" in all ES5-compliant browsers SpiderMonkey's implementation-specific heuristic can be found in jsdate.cpp. The string "10 06 2014" is an example of a non-conforming ISO format and thus falls back to a custom routine. See also this rough outline on how the parsing works. new Date('10 06 2014'); will be treated as a local date of 6 October, 2014, and not 10 June, 2014. Other examples: new Date('foo-bar 2014').toString(); // returns: "Invalid Date" Date.parse('foo-bar 2014'); // returns: NaN Differences in assumed time zone This section contains implementation-specific behavior that can be inconsistent across implementations. G...
Date.prototype.setYear() - JavaScript
ethod. Syntax dateObj.setYear(yearValue) Parameters yearValue An integer. Return value The number of milliseconds between 1 January 1970 00:00:00 UTC and the updated date. Description If yearValue is a number between 0 and 99 (inclusive), then the year for dateObj is set to 1900 + yearValue. Otherwise, the year for dateObj is set to yearValue. Examples Using setYear() The first two lines set the year to 1996. The third sets the year to 2000. var theBigDay = new Date(); theBigDay.setYear(96); theBigDay.setYear(1996); theBigDay.setYear(2000); Specifications Specification ECMAScript (ECMA-262)The definition of 'Date.prototype.setYear' in that specification. ...
Date.prototype.toLocaleDateString() - JavaScript
Arabic in most Arabic speaking countries uses real Arabic digits console.log(date.toLocaleDateString('ar-EG')); // -> "???/???/????" // for Japanese, applications may want to use the Japanese calendar, // where 2012 was the year 24 of the Heisei era console.log(date.toLocaleDateString('ja-JP-u-ca-japanese')); // -> "24/12/20" // when requesting a language that may not be supported, such as // Balinese, include a fallback language, in this case Indonesian console.log(date.toLocaleDateString(['ban', 'id'])); // -> "20/12/2012" Using options The results provided by toLocaleDateString() can be customized using the options argument: var date = new Date(Date.UTC(2012, 11, 20, 3, 0, 0)); // request a weekday along with a long date var options = { weekday: 'long', year: 'numeric', month: 'long'...
Date.prototype.toLocaleString() - JavaScript
ost Arabic speaking countries uses real Arabic digits console.log(date.toLocaleString('ar-EG')); // -> "???/???/???? ?:??:?? ...
Date.prototype.toLocaleTimeString() - JavaScript
hour time without AM/PM console.log(date.toLocaleTimeString('en-GB')); // -> "03:00:00" // Korean uses 12-hour time with AM/PM console.log(date.toLocaleTimeString('ko-KR')); // -> "?? 12:00:00" // Arabic in most Arabic speaking countries uses real Arabic digits console.log(date.toLocaleTimeString('ar-EG')); // -> "?:??:?? ...
Date.prototype.toString() - JavaScript
0 or greater) "-" for negative offsets (less than zero) Two digit hour offset, e.g. "14" Two digit minute offset, e.g. "00" Optionally, a timezone name consisting of: space Left bracket, i.e. "(" An implementation dependent string representation of the timezone, which might be an abbreviation or full name (there is no standard for names or abbreviations of timezones), e.g. "Line Islands Time" or "LINT" Right bracket, i.e. ")" E.g. "Sat Sep 01 2018 14:53:26 GMT+1400 (LINT)" Until ECMAScript 2018 (edition 9), the format of the string returned by Date.prototype.toString was implementation dependent. Therefore it should not be relied upon to be in the specified format. The toString() method is automatically called when a date is to be represented as a text value,...
Error.prototype.columnNumber - JavaScript
The columnNumber property contains the column number in the line of the file that raised this error. Examples Using columnNumber var e = new Error('Could not parse input'); throw e; console.log(e.columnNumber) // 0 Specifications Not part of any standard. ...
Error.prototype.toSource() - JavaScript
g the source code of the error. Examples Using toSource Calling the toSource method of an Error instance (including NativeErrors) will return a string containing the source code of the error. This string can be evaluated to create an (approximately) equal object. Naturally, the string containing the source follows the structure of the Error constructor. For example: (newname(message ,fileName,lineNumber)) where these attributes correspond to the respective properties of the error instance. Note: Be aware that the properties used by the toSource method in the creation of this string are mutable and may not accurately reflect the function used to create an error instance or the filename or line number where the actual error occurred. Specifications Not part of any standard. ...
FinalizationRegistry - JavaScript
han another object, even if they become unreachable at the same time, e.g., due to generational collection. Garbage collection work can be split up over time using incremental and concurrent techniques. Various runtime heuristics can be used to balance memory usage, responsiveness. The JavaScript engine may hold references to things which look like they are unreachable (e.g., in closures, or inline caches). Different JavaScript engines may do these things differently, or the same engine may change its algorithms across versions. Complex factors may lead to objects being held alive for unexpected amounts of time, such as use with certain APIs. Notes on cleanup callbacks Some notes on cleanup callbacks: Developers shouldn't rely on cleanup callbacks for essential program logic. Clean...
InternalError() constructor - JavaScript
The InternalError() constructor creates an error that indicates an error that occurred internally in the JavaScript engine. For example: "InternalError: too much recursion". Syntax new InternalError([message[, fileName[, lineNumber]]]) Parameters message Optional. Human-readable description of the error fileName Optional. The name of the file containing the code that caused the exception lineNumber Optional. The line number of the code that caused the exception Examples Creating a new InternalError new InternalError("Engine failure"); Specifications Not part of any standard. ...
InternalError - JavaScript
ray initializer too large", "too much recursion". Constructor InternalError() Creates a new InternalError object. Instance properties InternalError.prototype.message Error message. Inherited from Error. InternalError.prototype.name Error name. Inherited from Error. InternalError.prototype.fileName Path to file that raised this error. Inherited from Error. InternalError.prototype.lineNumber Line number in file that raised this error. Inherited from Error. InternalError.prototype.columnNumber Column number in line that raised this error. Inherited from Error. InternalError.prototype.stack Stack trace. Inherited from Error. Examples Too much recursion This recursive function runs 10 times, as per the exit condition. function loop(x) { if (x >= 10) // "x >= 10" is the...
Intl.DateTimeFormat - JavaScript
king countries uses real Arabic digits console.log(new Intl.DateTimeFormat('ar-EG').format(date)); // -> "???/???/????" // for Japanese, applications may want to use the Japanese calendar, // where 2012 was the year 24 of the Heisei era console.log(new Intl.DateTimeFormat('ja-JP-u-ca-japanese').format(date)); // -> "24/12/19" // when requesting a language that may not be supported, such as // Balinese, include a fallback language, in this case Indonesian console.log(new Intl.DateTimeFormat(['ban', 'id']).format(date)); // -> "19/12/2012" Using options The date and time formats can be customized using the options argument: var date = new Date(Date.UTC(2012, 11, 20, 3, 0, 0, 200)); // request a weekday along with a long date var options = { weekday: 'long', year: 'numeric', month: 'long',...
Intl.Locale.prototype.caseFirst - JavaScript
urns whether case is taken into account for the locale's collation rules. Description A locale's collation rules are used to determine how strings are ordered in that locale. Certain locales use a character's case (UPPERCASE or lowercase) in the collation process. This additional rule can be expressed in a Locale's caseFirst property. There are 3 values that the caseFirst property can have, outlined in the table below. caseFirst values Value Description upper Upper case to be sorted before lower case. lower Lower case to be sorted before upper case. false No special case ordering. Examples Setting the caseFirst value via the locale string In the Unicode locale string spec, the values that caseFirst represents correspond to the k...
Intl.Locale.prototype.numberingSystem - JavaScript
by Unicode. A table of the standard Unicode numeral systems can be seen below. ...
Intl.NumberFormat - JavaScript
rmat(number)); // -> ?????????? // India uses thousands/lakh/crore separators console.log(new Intl.NumberFormat('en-IN').format(number)); // -> 1,23,456.789 // the nu extension key requests a numbering system, e.g. ...
JSON.parse() - JavaScript
value[k]; } } } } return reviver.call(holder, key, value); } // Parsing happens in four stages. In the first stage, we replace certain // Unicode characters with escape sequences. JavaScript handles many characters // incorrectly, either silently deleting them, or treating them as line endings. text = String(text); rx_dangerous.lastIndex = 0; if (rx_dangerous.test(text)) { text = text.replace(rx_dangerous, function(a) { return ( "\\u" + ("0000" + a.charCodeAt(0).toString(16)).slice(-4) ); }); } // In the second stage, we run the text against ...
JSON.stringify() - JavaScript
rialize circular references you can use a library that supports them (e.g. cycle.js by Douglas Crockford) or implement a solution by yourself, which will require finding and replacing (or removing) the cyclic references by serializable values. Issue with plain JSON.stringify for use as JavaScript Historically, JSON was not a completely strict subset of JavaScript. The literal code points U+2028 LINE SEPARATOR and U+2029 PARAGRAPH SEPARATOR could appear literally in string literals and property names in JSON text. But they could not appear literally in similar context in JavaScript text, only using Unicode escapes as \u2028 and \u2029. This recently changed: now both code points may appear literally in strings in JSON and JavaScript both. Therefore, if compatibility with older JavaScript en...
Map.prototype.forEach() - JavaScript
once, except in the case when it was deleted and re-added before forEach has finished. callback is not invoked for values deleted before being visited. New values added before forEach has finished will be visited. forEach executes the callback function once for each element in the Map object. It does not return a value. ...
Math.atan() - JavaScript
{2} radians. Because atan() is a static method of Math, you always use it as Math.atan(), rather than as a method of a Math object you created (Math is not a constructor). Examples Using Math.atan() Math.atan(1); // 0.7853981633974483 Math.atan(0); // 0 Math.atan(-0); // -0 Math.atan(Infinity); // 1.5707963267948966 Math.atan(-Infinity); // -1.5707963267948966 // The angle that the line [(0,0);(x,y)] forms with the x-axis in a Cartesian coordinate system Math.atan(y / x); Note that you may want to avoid using +-Infinity for stylistic reasons. In this case, Math.atan2() with 0 as the second argument may be a better solution. Specifications Specification ECMAScript (ECMA-262)The definition of 'Math.atan' in that specification. ...
Number.prototype.toLocaleString() - JavaScript
console.log(number.toLocaleString('ar-EG')); // -> ?????????? // India uses thousands/lakh/crore separators console.log(number.toLocaleString('en-IN')); // -> 1,23,456.789 // the nu extension key requests a numbering system, e.g. ...
Object.prototype.constructor - JavaScript
function Parent() { /* ... */ } Parent.prototype.parentMethod = function parentMethod() {} function Child() { Parent.call(this) // Make sure everything is initialized properly } Child.prototype = Object.create(Parent.prototype) // re-define child prototype to Parent prototype Child.prototype.constructor = Child // return original constructor to Child But when do we need to perform the last line here? Unfortunately, the answer is: it depends. Let's try to define the cases in which re-assignment of the original constructor will play a major role, and when it will be one superfluous line of code. Take the following case: the object has the create() method to create itself. function Parent() { /* ... */ } function CreatedConstructor() { Parent.call(this) } CreatedConstructor.prototyp...
Object.defineProperty() - JavaScript
.a); // logs 37 o.a = 25; // No error thrown // (it would throw in strict mode, // even if the value had been the same) console.log(o.a); // logs 37. The assignment didn't work. // strict mode (function() { 'use strict'; var o = {}; Object.defineProperty(o, 'b', { value: 2, writable: false }); o.b = 3; // throws TypeError: "b" is read-only return o.b; // returns 2 without the line above }()); As seen in the example, trying to write into the non-writable property doesn't change it but doesn't throw an error either. Enumerable attribute The enumerable property attribute defines whether the property is picked by Object.assign() or spread operator. For non-Symbols properties it also defines whether it shows up in a for...in loop and Object.keys() or not. var o = {}; Objec...
RangeError - JavaScript
geError object. Instance properties RangeError.prototype.message Error message. Although ECMA-262 specifies that RangeError should provide its own message property, in SpiderMonkey, it inherits Error.prototype.message. RangeError.prototype.name Error name. Inherited from Error. RangeError.prototype.fileName Path to file that raised this error. Inherited from Error. RangeError.prototype.lineNumber Line number in file that raised this error. Inherited from Error. RangeError.prototype.columnNumber Column number in line that raised this error. Inherited from Error. RangeError.prototype.stack Stack trace. Inherited from Error. Examples Using RangeError (for numeric values) function check(n) { if( !(n >= -500 && n <= 500) ) { throw new RangeError("The argument mus...
RegExp() constructor - JavaScript
e reset to 0) (as of ES2015). If flags is not specified and a regular expressions object is supplied, that object's flags (and lastIndex value) will be copied over. flags may contain any combination of the following characters: g (global match) Find all matches rather than stopping after the first match. i (ignore case) If u flag is also enabled, use Unicode case folding. m (multiline) Treat beginning and end characters (^ and $) as working over multiple lines. In other words, match the beginning or end of each line (delimited by \n or \r), not only the very beginning or end of the whole input string. s ("dotAll") Allows . to match newlines. u (unicode) Treat pattern as a sequence of Unicode code points. (See also Binary strings). y (sticky) Matches only from the...
RegExp.prototype.compile() - JavaScript
The deprecated compile() method is used to (re-)compile a regular expression during execution of a script. It is basically the same as the RegExp constructor. Syntax regexObj.compile(pattern, flags) Parameters pattern The text of the regular expression. flags If specified, flags can have any combination of the following values: g global match i ignore case m multiline; treat beginning and end characters (^ and $) as working over multiple lines (i.e., match the beginning or end of each line (delimited by \n or \r), not only the very beginning or end of the whole input string) y sticky; matches only from the index indicated by the lastIndex property of this regular expression in the target string (and does not attempt to match from any later indexes). Descr...
RegExp.prototype.dotAll - JavaScript
instance. Property attributes of RegExp.prototype.dotAll Writable no Enumerable no Configurable yes Description The value of dotAll is a Boolean and true if the "s" flag was used; otherwise, false. The "s" flag indicates that the dot special character (".") should additionally match the following line terminator ("newline") characters in a string, which it would not match otherwise: U+000A LINE FEED (LF) ("\n") U+000D CARRIAGE RETURN (CR) ("\r") U+2028 LINE SEPARATOR U+2029 PARAGRAPH SEPARATOR This effectively means the dot will match any character on the Unicode Basic Multilingual Plane (BMP). To allow it to match astral characters, the "u" (unicode) flag should be used. Using both fl...
RegExp.prototype.exec() - JavaScript
string that was matched against. "The Quick Brown Fox Jumps Over The Lazy Dog" re lastIndex The index at which to start the next match. If g is absent, this will always be 0. 25 ignoreCase Indicates if the i flag was used to ignore case. true global Indicates if the g flag was used for a global match. true multiline Indicates if the m flag was used to search across multiple lines. false source The text of the pattern. "quick\s(brown).+?(jumps)" Examples Finding successive matches If your regular expression uses the "g" flag, you can use the exec() method multiple times to find successive matches in the same string. When you do so, the search starts at the substring of str specif...
RegExp.prototype.source - JavaScript
Enumerable no Configurable yes Examples Using source var regex = /fooBar/ig; console.log(regex.source); // "fooBar", doesn't contain /.../ and "ig". Empty regular expressions and escaping Starting with ECMAScript 5, the source property no longer returns an empty string for empty regular expressions. Instead, the string "(?:)" is returned. In addition, line terminators (such as "\n") are escaped now. new RegExp().source; // "(?:)" new RegExp('\n').source === '\n'; // true, prior to ES5 new RegExp('\n').source === '\\n'; // true, starting with ES5 Specifications Specification ECMAScript (ECMA-262)The definition of 'RegExp.prototype.source' in that specification. ...
RegExp.prototype.toString() - JavaScript
ion. Examples Using toString() The following example displays the string value of a RegExp object: var myExp = new RegExp('a+b+c'); console.log(myExp.toString()); // logs '/a+b+c/' var foo = new RegExp('bar', 'g'); console.log(foo.toString()); // logs '/bar/g' Empty regular expressions and escaping Starting with ECMAScript 5, an empty regular expression returns the string "/(?:)/" and line terminators such as "\n" are escaped: new RegExp().toString(); // "/(?:)/" new RegExp('\n').toString() === '/\n/'; // true, prior to ES5 new RegExp('\n').toString() === '/\\n/'; // true, starting with ES5 Specifications Specification ECMAScript (ECMA-262)The definition of 'RegExp.prototype.toString' in that specification. ...
Set.prototype.forEach() - JavaScript
, except in the case when it was deleted and re-added before forEach() has finished. callback is not invoked for values deleted before being visited. New values added before forEach() has finished will be visited. forEach() executes the callback function once for each element in the Set object; it does not return a value. ...
Planned changes to shared memory - JavaScript
essage() for SharedArrayBuffer objects throws by default). These changes provide further isolation between sites and help reduce the impact of attacks with high-resolution timers, which can be created with shared memory. Starting with Firefox 79, the features described in this document are enabled by default. Chrome intends to implement similar restrictions. New HTTP header bonanza As a baseline requirement, documents will need to be in a secure context. For top-level documents, two headers will need to be set: Cross-Origin-Opener-Policy with same-origin as value (protects your origin from attackers) Cross-Origin-Embedder-Policy with require-corp as value (protects victims from your origin) With these two headers set, postMessage() will no longer throw for SharedArrayBuffer object...
SharedArrayBuffer - JavaScript
Context.getBufferSubData() Security requirements Shared memory and high-resolution timers were effectively disabled at the start of 2018 in light of Spectre. In 2020, a new, secure approach has been standardized to re-enable shared memory. With a few security measures, postMessage() will no longer throw for SharedArrayBuffer objects and shared memory across threads will be available: As a baseline requirement, your document needs to be in a secure context. For top-level documents, two headers will need to be set to cross-origin isolate your site: Cross-Origin-Opener-Policy with same-origin as value (protects your origin from attackers) Cross-Origin-Embedder-Policy with require-corp as value (protects victims from your origin) Cross-Origin-Opener-Policy: same-origin Cross-Origin-Embe...
String.raw() - JavaScript
e will call this with proper arguments for you, (just like with other tag functions). String.raw() is the only built-in tag function of template strings. It works just like the default template function and performs concatenation. You can even re-implement it with normal JavaScript code. Examples Using String.raw() String.raw`Hi\n${2+3}!`; // 'Hi\n5!', the character after 'Hi' // is not a newline character, // '\' and 'n' are two characters. String.raw`Hi\u000A!`; // 'Hi\u000A!', same here, this time we will get the // \, u, 0, 0, 0, A, 6 characters. // All kinds of escape characters will be ineffective // and backslashes will be present in the output string. // You can confirm this by checking the .length property // of the string. let name = 'Bob'; String.raw`Hi\n${name}!`; // 'Hi\nB...
String.prototype.replace() - JavaScript
logs 'oranges are round, and oranges are juicy'. Switching words in a string The following script switches the words in the string. For the replacement text, the script uses capturing groups and the $1 and $2 replacement patterns. let re = /(\w+)\s(\w+)/; let str = 'John Smith'; let newstr = str.replace(re, '$2, $1'); console.log(newstr); // Smith, John This logs 'Smith, John'. Using an inline function that modifies the matched characters In this example, all occurrences of capital letters in the string are converted to lower case, and a hyphen is inserted just before the match location. The important thing here is that additional operations are needed on the matched item before it is given back as a replacement. The replacement function accepts the matched snippet as its parameter, ...
String.prototype.split() - JavaScript
or more spaces, followed by a semicolon, followed by zero or more spaces--and, when found, removes the spaces and the semicolon from the string. nameList is the array returned as a result of split(). const names = 'Harry Trump ;Fred Barney; Helen Rigby ; Bill Abel ;Chris Hand ' console.log(names) const re = /\s*(?:;|$)\s*/ const nameList = names.split(re) console.log(nameList) This logs two lines; the first line logs the original string, and the second line logs the resulting array. Harry Trump ;Fred Barney; Helen Rigby ; Bill Abel ;Chris Hand [ "Harry Trump", "Fred Barney", "Helen Rigby", "Bill Abel", "Chris Hand", "" ] Returning a limited number of splits In the following example, split() looks for spaces in a string and returns the first 3 splits that it finds. const myString = '...
String.prototype.trim() - JavaScript
The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Syntax str.trim() Return value A new string representing the str stripped of whitespace from both ends. ...
TypedArray.prototype.forEach() - JavaScript
ts of the typed array are changed, the value passed to callback will be the value at the time forEach() visits them; elements that are deleted before being visited are not visited. forEach() executes the callback function once for each typed array element; unlike every() and some() it, always returns the value undefined. Examples Logging the contents of a typed array The following code logs a line for each element in a typed array: function logArrayElements(element, index, array) { console.log('a[' + index + '] = ' + element); } new Uint8Array([0, 1, 2, 3]).forEach(logArrayElements); // logs: // a[0] = 0 // a[1] = 1 // a[2] = 2 // a[3] = 3 Specifications Specification ECMAScript (ECMA-262)The definition of '%TypedArray%.prototype.forEach' in that specification. ...
WeakRef - JavaScript
han another object, even if they become unreachable at the same time, e.g., due to generational collection. Garbage collection work can be split up over time using incremental and concurrent techniques. Various runtime heuristics can be used to balance memory usage, responsiveness. The JavaScript engine may hold references to things which look like they are unreachable (e.g., in closures, or inline caches). Different JavaScript engines may do these things differently, or the same engine may change its algorithms across versions. Complex factors may lead to objects being held alive for unexpected amounts of time, such as use with certain APIs. Notes on WeakRefs Some notes on WeakRefs: If your code has just created a WeakRef for a target object, or has gotten a target object from a W...
WebAssembly.Memory() constructor - JavaScript
ayBuffer. var memory = new WebAssembly.Memory({initial:10, maximum:100}); The second way to get a WebAssembly.Memory object is to have it exported by a WebAssembly module. The following example (see memory.html on GitHub, and view it live also) fetches and instantiates the loaded memory.wasm byte code using the WebAssembly.instantiateStreaming() method, while importing the memory created in the line above. It then stores some values in that memory, then exports a function and uses it to sum some values. WebAssembly.instantiateStreaming(fetch('memory.wasm'), { js: { mem: memory } }) .then(obj => { var i32 = new Uint32Array(memory.buffer); for (var i = 0; i < 10; i++) { i32[i] = i; } var sum = obj.instance.exports.accumulate(0, 10); console.log(sum); }); Creating a shared memor...
WebAssembly.Memory.prototype.buffer - JavaScript
The buffer prototype property of the WebAssembly.Memory object returns the buffer contained in the memory. Examples Using buffer The following example (see memory.html on GitHub, and view it live also) fetches and instantiates the loaded memory.wasm byte code using the WebAssembly.instantiateStreaming() method, while importing the memory created in the line above. It then stores some values in that memory, then exports a function and uses it to sum some values. WebAssembly.instantiateStreaming(fetch('memory.wasm'), { js: { mem: memory } }) .then(obj => { var i32 = new Uint32Array(memory.buffer); for (var i = 0; i < 10; i++) { i32[i] = i; } var sum = obj.instance.exports.accumulate(0, 10); console.log(sum); }); Specifications Specification WebAssembly ...
WebAssembly.Memory - JavaScript
yBuffer. var memory = new WebAssembly.Memory({initial:10, maximum:100}); The second way to get a WebAssembly.Memory object is to have it exported by a WebAssembly module. The following example (see memory.html on GitHub, and view it live also) fetches and instantiates the loaded memory.wasm byte code using the WebAssembly.instantiateStreaming() method, while importing the memory created in the line above. It then stores some values in that memory, then exports a function and uses it to sum some values. WebAssembly.instantiateStreaming(fetch('memory.wasm'), { js: { mem: memory } }) .then(obj => { var i32 = new Uint32Array(memory.buffer); for (var i = 0; i < 10; i++) { i32[i] = i; } var sum = obj.instance.exports.accumulate(0, 10); console.log(sum); }); Creating a shared memor...
Inequality (!=) - JavaScript
ent types. The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Syntax x != y Description The inequality operator checks whether its operands are not equal. It is the negation of the equality operator so the following two lines will always give the same result: x != y !(x == y) For details of the comparison algorithm, see the page for the equality operator. Like the equality operator, the inequality operator will attempt to convert and compare operands of different types: 3 != "3"; // false To prevent this, and require that different types are considered to be different, use the strict inequality operator instead...
Strict inequality (!==) - JavaScript
he source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request. Syntax x !== y Description The strict inequality operator checks whether its operands are not equal. It is the negation of the strict equality operator so the following two lines will always give the same result: x !== y !(x === y) For details of the comparison algorithm, see the page for the strict equality operator. Like the strict equality operator, the strict inequality operator will always consider operands of different types to be different: 3 !== "3"; // true Examples Comparing operands of the same type console.log("hello" !== "hello"); // false console.
async function - JavaScript
e(1).then(() => undefined) } Code after each await expression can be thought of as existing in a .then callback. In this way a promise chain is progressively constructed with each reentrant step through the function. The return value forms the final link in the chain. In the following example, we successively await two promises. Progress moves through function foo in three stages. The first line of the body of function foo is executed synchronously, with the await expression configured with the pending promise. Progress through foo is then suspended and control is yielded back to the function that called foo. Some time later, when the first promise has either been fulfilled or rejected, control moves back into foo. The result of the first promise fulfilment (if it was not rejected) is r...
for...in - JavaScript
he object itself and those the object inherits from its prototype chain (properties of nearer prototypes take precedence over those of prototypes further away from the object in its prototype chain). Deleted, added, or modified properties A for...in loop iterates over the properties of an object in an arbitrary order (see the delete operator for more on why one cannot depend on the seeming orderliness of iteration, at least in a cross-browser setting). If a property is modified in one iteration and then visited at a later time, its value in the loop is its value at that later time. A property that is deleted before it has been visited will not be visited later. Properties added to the object over which iteration is occurring may either be visited or omitted from iteration. In general, it i...
for - JavaScript
Specifications Specification ECMAScript (ECMA-262)The definition of 'for statement' in that specification. ...
import.meta - JavaScript
module.js"></script> you can access meta information about the module using the import.meta object. console.log(import.meta); // { url: "file:///home/user/my-module.js" } It returns an object with a url property indicating the base URL of the module. This will either be the URL from which the script was obtained, for external scripts, or the document base URL of the containing document, for inline scripts. Note that this will include query parameters and/or hash (i.e., following the ? or #). For example, with the following HTML: <script type="module"> import './index.mjs?someURLInfo=5'; </script> ..the following JavaScript file will log the `someURLInfo parameter: // index.mjs new URL(import.meta.url).searchParams.get('someURLInfo'); // 5 The same applies when a file imports another:...
let - JavaScript
eferenceError: // prints out 'undefined' console.log(typeof undeclaredVariable); // results in a 'ReferenceError' console.log(typeof i); let i = 10; Another example of temporal dead zone combined with lexical scoping Due to lexical scoping, the identifier foo inside the expression (foo + 55) evaluates to the if block's foo, and not the overlying variable foo with the value of 33. In the same line, the if block's foo has already been created in the lexical environment, but has not yet reached (and terminated) its initialization (which is part of the statement itself). The if block's foo is still in the temporal dead zone. function test(){ var foo = 33; if(foo) { let foo = (foo + 55); // ReferenceError } } test(); This phenomenon may confuse you in a situation like the fol...
return - JavaScript
re x is a number. function square(x) { return x * x; } var demo = square(3); // demo will equal 9 If the value is omitted, undefined is returned instead. The following return statements all break the function execution: return; return true; return false; return x; return x + y / 3; Automatic Semicolon Insertion The return statement is affected by automatic semicolon insertion (ASI). No line terminator is allowed between the return keyword and the expression. return a + b; is transformed by ASI into: return; a + b; The console will warn "unreachable code after return statement". Starting with Firefox 40, a warning is shown in the console if unreachable code is found after a return statement. To avoid this problem (to prevent ASI), you could use parentheses: return ( a + b ...
throw - JavaScript
Examples Throw an object You can specify an object when you throw an exception. You can then reference the object's properties in the catch block. The following example creates an object of type UserException and uses it in a throw statement. function UserException(message) { this.message = message; this.name = 'UserExc...
var - JavaScript
var a, b = a = 'A'; Be mindful of the order: var x = y, y = 'A'; console.log(x + y); // undefinedA Here, x and y are declared before any code is executed, but the assignments occur later. At the time "x = y" is evaluated, y exists so no ReferenceError is thrown and its value is undefined. So, x is assigned the undefined value. Then, y is assigned the value 'A'. Consequently, after the first line, x === undefined && y === 'A', hence the result. Initialization of several variables var x = 0; function f() { var x = y = 1; // Declares x locally; declares y globally. } f(); console.log(x, y); // 0 1 // In non-strict mode: // x is the global one as expected; // y is leaked outside of the function, though! The same example as above but with a strict mode: 'use strict'; var x = 0; funct...
Statements and declarations - JavaScript
This isn't a keyword, but a group of keywords. Statements and declarations by category For an alphabetical listing see the sidebar on the left. Control flow Block A block statement is used to group zero or more statements. The block is delimited by a pair of curly brackets. break Terminates the current loop, switch, or label statement and transfers program control to the statement following the terminated statement. ...
Transitioning to strict mode - JavaScript
...
Web app manifests
Web app manifests are part of a collection of web technologies called progressive web apps (PWAs), which are websites that can be installed to a device's homescreen without an app store. Unlike regular web apps with simple homescreen links or bookmarks, PWAs can be downloaded in advance and can work offline, as well as use regular Web APIs. The web app manifest provides information about a web application in a JSON text file, necessary for the web app to be downloaded and be presented to the user similarly to a native app (e.g., be installed on the homescreen of a device, providing users with quicker access and a richer experience). PWA manifests include its name, author, icon(s), version, description, and list of all the necessary resources (among other things). Can PWA manifest contai...
<merror> - MathML
Web › MathML › Element › merror
r not well-formed XML. You will still get an XML parsing error (in case of the XHTML notation of MathML), which has nothing to do with <merror>. Attributes class, id, style Provided for use with stylesheets. href Used to set a hyperlink to a specified URI. mathbackground The background color. You can use #rgb, #rrggbb and HTML color names. mathcolor The text color and also the fraction line color. You can use #rgb, #rrggbb and HTML color names. Examples <math> <merror> <mrow> <mtext> Division by zero: </mtext> <mfrac> <mn> 1 </mn> <mn> 0 </mn> </mfrac> </mrow> </merror> </math> Specifications Specification Status Comment MathML 3.0The definition of 'merror' in that specification. Recommendation Current specificati...
<mfenced> - MathML
. Use the <mrow> and <mo> elements instead. Attributes class, id, style Provided for use with stylesheets. close A string for the closing delimiter. The default value is ")" and any white space is trimmed. href Used to set a hyperlink to a specified URI. mathbackground The background color. You can use #rgb, #rrggbb and HTML color names. mathcolor The text color and also the fraction line color. You can use #rgb, #rrggbb and HTML color names. open A string for the opening delimiter. The default value is "(" and any white space is trimmed. separators A sequence of zero or more characters to be used for different separators, optionally divided by white space, which is ignored. The default value is ",". By specifying more than one character, it is possible to set different separa...
<mglyph> - MathML
Web › MathML › Element › mglyph
ted formats, or until the image is downloaded. class, id, style Provided for use with stylesheets. height The height of the image. href Used to set a hyperlink to a specified URI. mathbackground The background color (if the image has transparency). You can use #rgb, #rrggbb and HTML color names. src The image URL. valign Specifies the vertical alignment with respect to the current baseline. width The width of the image. Examples <math> <mi><mglyph src="my-glyph.png" alt="my glyph"/></mi> </math> Specifications Specification Status Comment MathML 3.0The definition of 'mglyph' in that specification. Recommendation Current specification MathML 2.0The definition of 'mglyph' in that specification. Recommendation Initial specific...
<mlabeledtr> - MathML
s row. Possible values are: left, center and right. groupalign href Used to set a hyperlink to a specified URI. mathbackground The background color. You can use #rgb, #rrggbb and HTML color names. mathcolor The text color. You can use #rgb, #rrggbb and HTML color names. rowalign Overrides the vertical alignment of cells specified by <mtable> for this row. Possible values are: axis, baseline, bottom, center and top. Examples Rendering: <math> <mtable> <mlabeledtr> <mtd><mn>1</mn></mtd> <!-- label --> <mtd><mi>A</mi></mtd> <mtd><mi>B</mi></mtd> </mlabeledtr> <mtr> <mtd><mi>C</mi></mtd> <mtd><mi>D</mi></mtd> <mtd><mi>E</mi></mtd> </mtr> </mtable> </math> Specifications Specification Status Comment ...
<mmultiscripts> - MathML
mples section for a correct usage. Attributes class, id, style Provided for use with stylesheets. href Used to set a hyperlink to a specified URI. mathbackground The background color. You can use #rgb, #rrggbb and HTML color names. mathcolor The text color. You can use #rgb, #rrggbb and HTML color names. subscriptshift The minimum space by which to shift the subscript below the baseline of the expression, as a CSS length. This property is deprecated and will be removed in the future. superscriptshift The minimum space by which to shift the superscript above the baseline of the expression, as a CSS length. This property is deprecated and will be removed in the future. Examples Using <mprescripts/> Sample rendering: Rendering in your browser: X d c b a <math> ...
<mo> - MathML
Web › MathML › Element › mo
ttribute, but it specifies whether the operator is a separator (such as commas). Allowed values are true or false. stretchy Specifies whether the operator stretches to the size of the adjacent element. Allowed values are true or false. symmetric If stretchy is true, this attribute specifies whether the operator should be vertically symmetric around the imaginary math axis (centered fraction line). The default value is true if stretchy is set to true and otherwise false. Allowed values are true or false. Examples <math> <mrow> <mn>5</mn> <mo>+</mo> <mn>5</mn> </mrow> <mrow> <mo> [ </mo> <!-- default form value: prefix --> <mrow> <mn> 0 </mn> <mo> ; </mo> <!-- default form value: infix --> <mn> 1 </mn> </mrow> <mo> ) </mo> <!-- default form value: postfix --...
<mphantom> - MathML
Attributes class, id, style Provided for use with stylesheets. mathbackground The background color. You can use #rgb, #rrggbb and HTML color names. Examples Sample rendering: Rendering in your browser: x + y + z <math> <mrow> <mi> x </mi> <mo> + </mo> <mphantom> <mi> y </mi> <mo> + </mo> </mphantom> <mi> z </mi> </mrow> </math> Specifications Specification Status Comment MathML 3.0The definition of 'mphantom' in that specification. ...
<mrow> - MathML
Web › MathML › Element › mrow
This element renders as a horizontal row containing its arguments. When writing a MathML expression, you should group elements within an <mrow> in the same way as they are grouped in the mathematical interpretation of the expression. Proper grouping helps the rendering of the expression in several ways: It can improve the display by possibly affecting spacing. It allows for more intelligent line-breaking and indentation. It simplifies the interpretation of the expression by automated systems such as computer algebra systems and audio renderers. Attributes class, id, style Provided for use with stylesheets. dir Overall directionality of formulas. Possible values are either ltr (left to right) or rtl (right to left). href Used to set a hyperlink to a specified URI. mathbackgrou...
<mspace> - MathML
Web › MathML › Element › mspace
The MathML <mspace> element is used to display a blank space, whose size is set by its attributes. Attributes class, id, style Provided for use with stylesheets. depth The desired depth (below the baseline) of the space (see length for values and units). height The desired height (above the baseline) of the space (see length for values and units). linebreak Indicates a line-break at the space. Possible values: auto (default value), newline, nobreak, goodbreak, badbreak. Starting with MathML 3, it is preferred to use <mo> to control linebreaking. mathbackground The background color. You can use #rgb, #rrggbb and HTML color names. width The desired width of the space (see length for values and units). Note that some common attributes like mathcolor, mathvariant or dir have no ...
<mstyle> - MathML
Web › MathML › Element › mstyle
ble> columns, if the decimalpoint value is used to specify the alignment. displaystyle A Boolean value specifying whether more vertical space is used for displayed equations or, if set to false, a more compact layout is used to display formulas. The main effect is that larger versions of operators are displayed, when displaystyle is set to true. See also largeop and movablelimits on <mo>. infixlinebreakstyle Specifies the default linebreakstyle to use for infix operators. The values before, after and duplicate are allowed. scriptlevel Controls mostly the font-size. The higher the scriptlevel, the smaller the font size. This attribute accepts a non-negative integer, as well as a "+" or a "-" sign, which increments or decrements the current value. In addition, the scriptlevel attribute can...
<msub> - MathML
Web › MathML › Element › msub
ax: <msub> base subscript </msub>. Attributes class, id, style Provided for use with stylesheets. href Used to set a hyperlink to a specified URI. mathbackground The background color. You can use #rgb, #rrggbb and HTML color names. mathcolor The text color. You can use #rgb, #rrggbb and HTML color names. subscriptshift The minimum space by which to shift the subscript below the baseline of the expression, as a length value. This attribute is deprecated and will be removed in the future. Examples Sample rendering: Rendering in your browser: X 1 <math> <msub> <mi>X</mi> <mn>1</mn> </msub> </math> Specifications Specification Status Comment MathML 3.0The definition of 'msub' in that specification. Recommendation Current ...
<msubsup> - MathML
subscript superscript </msubsup>. Attributes class, id, style Provided for use with stylesheets. href Used to set a hyperlink to a specified URI. mathbackground The background color. You can use #rgb, #rrggbb and HTML color names. mathcolor The text color. You can use #rgb, #rrggbb and HTML color names. subscriptshift The minimum space by which to shift the subscript below the baseline of the expression, as a length value. This attribute is deprecated and will be removed in the future. superscriptshift The minimum space by which to shift the superscript above the baseline of the expression, as a length value. This attribute is deprecated and will be removed in the future. Examples Sample rendering: Rendering in your browser: ? 0 1 <math displaystyle="true">...
<msup> - MathML
Web › MathML › Element › msup
p> base superscript </msup>. Attributes class, id, style Provided for use with stylesheets. href Used to set a hyperlink to a specified URI. mathbackground The background color. You can use #rgb, #rrggbb and HTML color names. mathcolor The text color. You can use #rgb, #rrggbb and HTML color names. superscriptshift The minimum space by which to shift the superscript up from the baseline of the expression, as a length value. This attribute is deprecated and will be removed in the future. Examples Sample rendering: Rendering in your browser: X 2 <math> <msup> <mi>X</mi> <mn>2</mn> </msup> </math> Specifications Specification Status Comment MathML 3.0The definition of 'msup' in that specification. Recommendation Current ...
<mtd> - MathML
Web › MathML › Element › mtd
the cell extend. groupalign Unimplemented href Used to set a hyperlink to a specified URI. mathbackground The background color. You can use #rgb, #rrggbb and HTML color names. mathcolor The text color. You can use #rgb, #rrggbb and HTML color names. rowalign Specifies the vertical alignment of this cell and overrides values specified by <mtable> or <mtr>. Possible values are: axis, baseline, bottom, center and top. rowspan A non-negative integer value that indicates on how many rows does the cell extend. Specifications Specification Status Comment MathML 3.0The definition of 'mtd' in that specification. Recommendation Current specification MathML 2.0The definition of 'mtd' in that specification. Recommendation Initial specificati...
<mtr> - MathML
Web › MathML › Element › mtr
e values are: left, center and right. groupalign Unimplemented href Used to set a hyperlink to a specified URI. mathbackground The background color. You can use #rgb, #rrggbb and HTML color names. mathcolor The text color. You can use #rgb, #rrggbb and HTML color names. rowalign Overrides the vertical alignment of cells specified by <mtable> for this row. Possible values are: axis, baseline, bottom, center and top. Specifications Specification Status Comment MathML 3.0The definition of 'mtr' in that specification. Recommendation Current specification MathML 2.0The definition of 'mtr' in that specification. Recommendation Initial specification ...
MathML: Deriving the Quadratic Formula - MathML
We take a quadratic equation in its general form, and solve for x: a x 2 + b x + c = 0 a x 2 + b x = - c x 2 + b a ? x = -c a Divide out leading coefficient. x 2 + b a ? x + b 2 a 2 = - c ( 4 a ) a ( 4 a ) + b 2 4 a 2 Complete the square. ( x + b 2 a ) ( x + b 2 a ) = b 2 - 4 a c 4 a 2 Discriminant revealed. ( x + b 2 a ) 2 = b 2 - 4 a c 4 a 2 x + b 2 a = b 2 - 4 a c 4 a 2 x = -b 2 a +-{C} b 2 - 4 a c 4 a 2 There's the vertex formula. ...
Examples - MathML
MathML Torture Test Large set of test markup. ...
Digital audio concepts - Web media technologies
then converted into digital form by a circuit that captures the incoming wave's amplitude at regular intervals, converting that data into a number in a form that is understood by the audio recording system. Each of these captured moments is a sample. By chaining all the samples together, you can approximately represent the original wave, as seen in the diagram below. In this example, the blue line represents the samples taken from the audio waveform, which is black. At regular intervals, the A/D converter circuitry reads the voltage of the signal as a value between (in this case) -1.0 and +1.0. Since the amplitude varies over the duration of that time slice, the A/D converter must choose a value to represent that slice, whether by simply taking the value at a particular moment (in the diag...
Handling media support issues in web content - Web media technologies
and codecs to support. This places a small, but reasonably easily overcome, burden on the web developer: to properly handle the situation when the user's browser can't handle a particular type of media. This guide covers techniques you can use to develop web content that meets your media needs while providing the most broadly compatible experience possible. Topics we will examine fallbacks, baseline media formats, and error handling practices that will let your content work in as many situations as possible. Using poster frames A poster frame is a still image that's representative of the content of a video. This may be simply the first frame of video; however, in many cases, the first frame is blank, or contains nothing but the logo of a business, or some other image that doesn't give the ...
Media type and format guide: image, audio, and video content - Web media technologies
Web › Media › Formats
ge file types and content formats across the major web browsers, as well as providing basic information about each type: benefits, limitations, and use cases of interest to web designers and developers. Image file types for web designers Fundamental information about the various image file types that may be useful for web designers, including best practices and use cases for each type, and guidelines for choosing the right image file format for specific types of content. Media file types and codecs Media containers (file types) A guide to the file types that contain media data. Some are audio-specific, while others may be used for either audio or combined audiovisual content such as movies. Includes overviews of each of the file types supported by the major web browsers, along with bro...
Performance Monitoring: RUM vs synthetic monitoring - Web Performance
g where performance bottlenecks have been occurring and identifying the source of any performance issues. For example, but it isn't reflective of the actual experience of users, especially the long tail. Synthetic monitoring can be an important component of regression testing and production site monitoring. Test the site at every stage of development and regularly in production. Changes from baseline performance as part of continuous integration should fail a push. If an issue arises in production, synthetic monitoring can provide insight, helping identify, isolate, and resolve problems before they negatively user experience. Real User Monitoring Real User Monitoring or RUM measures the performance of a page from real users' machines. Generally, a third party script injects a script on each...
Privacy, permissions, and information security
privacy features available to users on the web, let's define some important terms. Personally identifiable information Personally identifiable information (PII) is information which can be used, in whole or in part, to track down and/or identify a specific person. As such, PII extends beyond the web to all aspects of life. For example, if a site leaks a list of users' names and zip codes online, a bad actor could almost certainly track down at least some percentage of those users by simply using the corresponding phone books. Personally identification can include information like usernames, real names, passwords, phone numbers or addresses (or even portions of them), information about medical history, Social Security Numbers, driver licenses, or any other form of ID or ID number, cred...
Installing and uninstalling web apps - Progressive web apps (PWAs)
re supported, while others are not. iOS 13 introduced a much more comparable install experience, which is also described here. The install user experience We've written a very simple example web site (see our demo live, and also see the source code) that doesn't do much, but was developed with the necessary code to allow it to be installed, as well as a service worker to enable it to be used offline. The example displays a series of fox pictures.If you have a web application compatible device available, use it to navigate to our demo at https://mdn.github.io/pwa-examples/a2hs/. You'll see fox pictures, but more importantly, some form of user interface will be available to let you install the site as a web app. The UI for this varies from browser to browser, but the general idea is the same.
PWA developer guide - Progressive web apps (PWAs)
elopment documentation. --->>> Titles below are just for the list; give articles good SEO names and feel free to tweak those and this as needed... <<<--- Web app basics Introduction and getting started with PWA development some description Installing and uninstalling web apps An introductory guide to how a web app can be installed on the user's device... ...
Progressive loading - Progressive web apps (PWAs)
emember about the progressive enhancement approach -- offer a usable product no matter the device or platform, but be sure to enrich the experience to those using modern browsers. Final thoughts That's all for this tutorial series -- we went through the source code of the js13kPWA example app and learned about the use of progressive web apps features including an Introduction, PWA structure, offline availability with Service Workers, installable PWAs, and finally notifications. We also explained push with help from the Service Worker Cookbook. And in this article, we've looked into the concept of progressive loading, including an interesting example that makes use of the Intersection Observer API. Feel free to experiment with the code, enhance your existing app with PWA features, or build s...
Graphic design for responsive sites - Progressive web apps (PWAs)
for non-developers. SVG SVG, just like HTML/CSS, can be manipulated via JavaScript. So adding interactivity is not difficult. You can also add links direcly into SVG and can create animations using SMIL (Synchronized Multimedia Intergration Language). WebGL/Canvas You can create a canvas to draw interactive graphics on using the HTML <canvas> element, then use the Canvas API to create shapes, lines, import image files, create text, do compositing operations, and much more. Standard JavaScript can then be used to animate the image output, etc. You can create 2D imagery using the regular 2D canvas context, or 3D imagery using the more nascent WebGL API. Canvas is very powerful, but it needs to be used with caution. It is good for the visuals of games and complex data visualisions, but for s...
Web technology reference
our learning area, which is filled with step-by-step tutorials that will guide you from total webdev newbie to at least semi-pro! HTML -- Structuring the web HyperText Markup Language is used to define and describe semantically the content (markup) of a web page in a well-structured format. HTML provides a means to create structured documents made up of blocks called HTML elements that are delineated by tags, written using angle brackets. Some introduce content into the page directly, others provide information about document text and may include other tags as sub-elements. Obviously, browsers do not display them, since they are used to interpret the content of the page. Introduction to HTML | Learn HTML | HTML5 | Developer guide | Element reference | Reference CSS -- Styling the web ...
contentStyleType - SVG: Scalable Vector Graphics
not specify their own styling language, such as the style attribute that is available on many elements. The value specifies a media type, per MIME Part Two: Media Types [RFC2046]. Usage notes Value One of the content types specified in the Media Types Default value text/css Animatable No Since CSS is the only widely deployed style sheet language for online styling and it's already defined as default value if contentStyleType is ommitted, the attribute is not well supported in user agents. If other style sheet languages become more popular they might not use the style attribute, instead it could be easily declared which style language is used in the <style>'s type attribute. The use of contentStyleType is therefore deprecated. Specifications ...
direction - SVG: Scalable Vector Graphics
The direction attribute specifies the inline-base direction of a <text> or <tspan> element. It defines the start and end points of a line of text as used by the text-anchor and inline-size properties. It also may affect the direction in which characters are positioned if the unicode-bidi property's value is either embed or bidi-override. It applies only to glyphs oriented perpendicular to the inline-base direction, which includes the usual case of horizontally-oriented Latin or Arabic text and the case of narrow-cell Latin or Arabic characters rotated 90 degrees clockwise relative to a top-to-bottom inline-base direction. In many cases, the bidirectional Unicode algorithm produces the desired result automatically, so this attribute doesn't need to be specified in those cases. For other case...
externalResourcesRequired - SVG: Scalable Vector Graphics
ility of external resources in order to render properly. Usage notes Value false | true Default value false Animatable No true This value indicates that resources external to the current document are required. If an external resource is not available, progressive rendering is suspended, the document's SVGLoad event is not fired and the animation timeline does not begin until that resource and all other required resources become available, have been parsed and are ready to be rendered. false This value indicates that resources external to the current document are optional. Document rendering can proceed even if external resources are unavailable to the current element and its descendants. Specifications Specification Status Com...
fill-opacity - SVG: Scalable Vector Graphics
fill-opacity attribute is a presentation attribute defining the opacity of the paint server (color, gradient, pattern, etc) applied to a shape. Note: As a presentation attribute fill-opacity can be used as a CSS property. ...
fill-rule - SVG: Scalable Vector Graphics
The fill-rule attribute is a presentation attribute defining the algorithm to use to determine the inside part of a shape. Note: As a presentation attribute, fill-rule can be used as a CSS property. As a presentation attribute, it can be applied to any element but it has effect only on the following 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. It is therefore considered outside the shape, and not filled.
glyph-orientation-vertical - SVG: Scalable Vector Graphics
Otherwise, if the angle is not a multiple of 180 degrees, then the current text position is incremented according to the horizontal metrics of the glyph. This attribute is applied only to text written in a vertical writing-mode. ...
hanging - SVG: Scalable Vector Graphics
Web › SVG › Attribute › hanging
The value is an offset in the font coordinate system. Only one element is using this attribute: <font-face> Usage notes Value <number> Default value None Animatable No <number> This value indicates the alignment coordinate for the glyphs. ...
ideographic - SVG: Scalable Vector Graphics
The value is an offset in the font coordinate system. Only one element is using this attribute: <font-face> Usage notes Value <number> Default value None Animatable No <number> This value indicates the alignment coordinate for the glyphs. ...
keyPoints - SVG: Scalable Vector Graphics
Default value None Animatable No <number> [; <number>] ;? This value defines a semicolon-separated list of floating point values between 0 and 1 and indicates how far along the motion path the object shall move at the mo...
keyTimes - SVG: Scalable Vector Graphics
; <number> ]* ;? Default value None Animatable No The value of the keyTimes attribute is a semicolon-separated list of values. There must be exactly as many values in the keyTimes list as in the values list. Each successive time value must be greater than or equal to the preceding time value. The keyTimes list semantics depends upon the interpolation mode: For linear and spline animation, the first time value in the list must be 0, and the last time value in the list must be 1. The key time associated with each value defines when the value is set; values are interpolated between the key times. For discrete animation, the first time value in the list must be 0. The time associated with each value defines when the value is set; the animation function uses th...
mask - SVG: Scalable Vector Graphics
Web › SVG › Attribute › mask
, the mask attribute is defined as a css property and is a shorthand for many other properties: mask-image, mask-mode, mask-repeat, mask-position, mask-clip, mask-origin, mask-size, and mask-composite. As a presentation attribute, it can be applied to any element but it has noticeable effects mostly on the following nineteen elements: <a>, <circle>, <clipPath>, <ellipse>, <g>, <glyph>, <image>, <line>, <marker>, <mask>, <path>, <pattern>, <polygon>, <polyline>, <rect>, <svg>, <symbol>, <text>, <use> Usage notes Value See the CSS property mask Default value none Animatable Yes Specifications Specification Status Comment CSS Masking Module Level 1The definition of 'mask' in that specification. Candidate Recommendation ...
mathematical - SVG: Scalable Vector Graphics
The value is an offset in the font coordinate system. Only one element is using this attribute: <font-face> Usage notes Value <number> Default value None Animatable No <number> This value indicates the alignment coordinate for the glyphs. ...
method - SVG: Scalable Vector Graphics
Web › SVG › Attribute › method
Yes align This value indicates that the characters should be rendered so that they are not stretched or warped. The characters are rotated, scaled and stretched when they are rendered. As a result, for fonts with connected characters (e.g. cursive fonts), the connections may not align properly when text is rendered along the path. stretch This value indicates that the character outlines will be converted into paths, and then stretched and possibly warped. With this approach, connected characters, such as in cursive fonts, will maintain their connections. Specifications Specification Status Comment Scalable Vector Graphics (SVG) 2The definition of 'method' in that specification. Candidate Recommendation Described the stretch value in more det...
orient - SVG: Scalable Vector Graphics
Web › SVG › Attribute › orient
r id="arrow" viewBox="0 0 10 10" refX="5" refY="5" markerWidth="6" markerHeight="6" orient="auto-start-reverse"> <path d="M 0 0 L 10 5 L 0 10 z" /> </marker> <marker id="dataArrow" viewBox="0 0 10 10" refX="5" refY="5" markerWidth="6" markerHeight="6" orient="-65deg"> <path d="M 0 0 L 10 5 L 0 10 z" fill="red" /> </marker> </defs> <polyline points="10,10 10,90 90,90" fill="none" stroke="black" marker-start="url(#arrow)" marker-end="url(#arrow)" /> <polyline points="15,80 29,50 43,60 57,30 71,40 85,15" fill="none" stroke="grey" marker-start="url(#dataArrow)" marker-mid="url(#dataArrow)" marker-end="url(#dataArrow)" /> </svg> Usage notes Value auto | auto-start-reverse | <angle> | <number> ...
overflow - SVG: Scalable Vector Graphics
of the values, please see the css overflow property. Specifications Specification Status Comment CSS Level 2 (Revision 1)The definition of 'overflow' in that specification. Recommendation Definition in CSS Scalable Vector Graphics (SVG) 2The definition of 'overflow' in that specification. Candidate Recommendation Simplifies the definition and outlines the values within the user agent stylesheet. Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'overflow' in that specification. Recommendation Initial definition ...
pointer-events - SVG: Scalable Vector Graphics
r to fit CSS requirements const fill = '#' + color.toString(16).padStart(6,'0') // Let's apply our color in the // element we actually clicked on e.target.style.fill = fill }) As a presentation attribute, it can be applied to any element but it is mostly relevant only on the following twenty-three elements: <a>, <circle>, <clipPath>, <defs>, <ellipse>, <foreignObject>, <g>, <image>, <line>, <marker>, <mask>, <path>, <pattern>, <polygon>, <polyline>, <rect>, <svg>, <switch>, <symbol>, <text>, <textPath>, <tspan>, <use> Usage notes Value bounding-box | visiblePainted | visibleFill | visibleStroke | visible | painted | fill | stroke | all | none Default value visiblePainted Animatable Yes For a detailed explanation of each possible value, ...
preserveAspectRatio - SVG: Scalable Vector Graphics
preserveAspectRatio="xMaxYMid slice" x="150" y="0"> <use href="#smiley" /> </svg> <!-- none --> <rect x="0" y="30" width="160" height="60"> <title>none</title> </rect> <svg viewBox="0 0 100 100" width="160" height="60" preserveAspectRatio="none" x="0" y="30"> <use href="#smiley" /> </svg> </svg> path { fill: yellow; stroke: black; stroke-width: 8px; stroke-linecap: round; stroke-linejoin: round; pointer-events: none; } rect:hover, rect:active { outline: 1px solid red; } Syntax preserveAspectRatio="<align> [<meetOrSlice>]" Its value is made of one or two keywords: A required alignment value and an optional "meet or slice" reference as described below: Alignment value The alignment value indicates whether to force uniform scaling and, if ...
restart - SVG: Scalable Vector Graphics
Web › SVG › Attribute › restart
The restart attribute specifies whether or not an animation can restart. ...
rotate - SVG: Scalable Vector Graphics
Web › SVG › Attribute › rotate
reverse, it turns its left-hand side in the current direction of motion. Setting rotate's value to a number specifies a constant rotation, in degrees, that does not change with the animation. The default value of 0 keeps the animated element in its original orientation. ...
systemLanguage - SVG: Scalable Vector Graphics
The systemLanguage attribute represents a list of supported language tags. This list is matched against the language defined in the user preferences. 35 elements are using this attribute: <a>, <altGlyph>, <animate>, <animateColor>, <animateMotion>, <animateTransform>, <audio>, <canvas>, <circle>, <clipPath>, <cursor>, <defs>, <discard>, <ellipse>, <foreignObject>, <g>, <iframe>, <image>, <line>, <mask>, <path>, <pattern>, <polygon>, <polyline>, <rect>, <set>, <svg>, <switch>, <text>, <textPath>, <tref>, <tspan>, <unknown>, <use>, and <video> Usage notes Value <language-tags> Default value None Animatable No <language-tags> The value is a set of comma-separated tokens, each of which must be a Language-Tag value, as defined in BCP 47. systemLan...
text-rendering - SVG: Scalable Vector Graphics
speed and geometric precision. The user agent will often choose whether to apply anti-aliasing techniques, built-in font hinting or both to produce the most legible text. geometricPrecision This value indicates that the user agent shall emphasize geometric precision over legibility and rendering speed. This option will usually cause the user agent to suspend the use of hinting so that glyph outlines are drawn with comparable geometric precision to the rendering of path data. Specifications Specification Status Comment Scalable Vector Graphics (SVG) 2The definition of 'text-rendering' in that specification. Candidate Recommendation No change Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'text-rendering' in that specificatio...
textLength - SVG: Scalable Vector Graphics
tLength="6em">Small text length</text> <text y="40" textLength="120%">Big text length</text> </svg> Usage notes Value <length-percentage> | <number> Default value None Animatable Yes <length-percentage> This value specifies the width of the space the text will be adjusted to occupy as absolute length or percentage. <number> A numeric value outlines a length referring to the units of the current coordinate system. Example Let's create a simple example that presents text you can resize using an <input> element of type "range". CSS .controls { font: 16px "Open Sans", "Arial", sans-serif; } SVG Let's start with the SVG. It's pretty basic, with a 1000-by-300 pixel space mapped into a 10 centimeter by 3 centimeter box. <svg width="10...
transform - SVG: Scalable Vector Graphics
r, be aware that there are some difference in syntax between the CSS property and the attribute. See the documentation for the CSS property transform for the specific syntax to use in that case. As a presentation attribute, transform can be used by any element (in SVG 1.1, only these 16 elements were allowed to use it: <a>, <circle>, <clipPath>, <defs>, <ellipse>, <foreignObject>, <g>, <image>, <line>, <path>, <polygon>, <polyline>, <rect>, <switch>, <text>, and <use>). Also, as a legacy from SVG 1.1, <linearGradient> and <radialGradient> support the gradientTransform attribute, and <pattern> supports the patternTransform attribute, both of which act exactly like the transform attribute. Value <transform-list> Default value none Animatable Yes Tran...
type - SVG: Scalable Vector Graphics
Web › SVG › Attribute › type
ve document SVG 1.1 (2nd Edition) For the <feColorMatrix> element Categories None Value matrix | saturate | hueRotate | luminanceToAlpha Animatable Yes Normative document SVG 1.1 (2nd Edition) For the <feFuncR>, <feFuncG>, <feFuncB>, and <feFuncA> elements Categories None Value identity | table | discrete | linear | gamma Animatable Yes Normative document SVG 1.1 (2nd Edition) For the <feTurbulence> element Categories None Value fractalNoise | turbulence Animatable Yes Normative document SVG 1.1 (2nd Edition) For the <style> and <script> elements Categories None Value <content-type> An...
units-per-em - SVG: Scalable Vector Graphics
This is the size of the design grid on which glyphs are laid out. Note: This value is almost always necessary as nearly every other attribute requires the definition of a design grid. Only one element is using this attribute: <font-face> Usage notes Value <number> Default value 1000 Animatable No <number> This value indicates the the number of coordinate units on the em square. ...
v-alphabetic - SVG: Scalable Vector Graphics
The value is an offset in the font coordinate system relative to the glyph-specific vert-origin-x attribute. ...
v-hanging - SVG: Scalable Vector Graphics
The v-hanging attribute indicates the alignment coordinate for glyphs to achieve hanging baseline alignment. The value is an offset in the font coordinate system relative to the glyph-specific vert-origin-x attribute. Only one element is using this attribute: <font-face> Usage notes Value <number> Default value None Animatable No <number> This value indicates the alignment coordinate for the glyphs to achieve hanging baseline alignment. Specifications Specification Status Comment Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'v-hanging' in that specification. Recommendation Initial definition ...
v-ideographic - SVG: Scalable Vector Graphics
The value is an offset in the font coordinate system relative to the glyph-specific vert-origin-x attribute. Only one element is using this attribute: <font-face> Usage notes Value <number> Default value None Animatable No <number> This value indicates the alignment coordinate for the glyphs. ...
v-mathematical - SVG: Scalable Vector Graphics
The value is an offset in the font coordinate system relative to the glyph-specific vert-origin-x attribute. Only one element is using this attribute: <font-face> Usage notes Value <number> Default value None Animatable No <number> This value indicates the alignment coordinate for the glyphs. ...
viewBox - SVG: Scalable Vector Graphics
Web › SVG › Attribute › viewBox
n user space, of an SVG viewport. The value of the viewBox attribute is a list of four numbers: min-x, min-y, width and height. The numbers separated by whitespace and/or a comma, which specify a rectangle in user space which is mapped to the bounds of the viewport established for the associated SVG element (not the browser viewport). ...
xlink:arcrole - SVG: Scalable Vector Graphics
Specifications Specification Status Comment Scalable Vecto...
xlink:type - SVG: Scalable Vector Graphics
The xlink:type attribute identifies the type of XLink being used. In SVG, only simple links are available. Twentytwo elements are using this attribute: <a>, <altGlyph>, <animate>, <animateColor>, <animateMotion>, <animateTransform>, <color-profile>, <cursor>, <feImage>, <filter>, <font-face-uri>, <glyphRef>, <image>, <linearGradient>, <mpath>, <pattern>, <radialGradient>, <script>, <set>, <textPath>, <tref>, and <use> Usage notes Value simple Default value simple Animatable No simple This value specifies that the referred resource is a simple link. Specifications Specification Status Comment Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of 'xlink:type' in that specification. Recommendation ...
<altGlyph> - SVG: Scalable Vector Graphics
Web › SVG › Element › altGlyph
ore Attributes Most notably: id lang Styling Attributes class, style Conditional Processing Attributes Most notably: requiredExtensions, systemLanguage Event Attributes Global event attributes, Document element event attributes, Graphical event attributes Presentation Attributes Most notably: clip-path, clip-rule, color, color-interpolation, color-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 ele...
<animateMotion> - SVG: Scalable Vector Graphics
ually to make it pointing in the direction of the animation. ...
<clipPath> - SVG: Scalable Vector Graphics
Web › SVG › Element › clipPath
OnUse; Animatable: yes Global attributes Core Attributes Most notably: id Styling Attributes class, style Conditional Processing Attributes Most notably: requiredExtensions, systemLanguage Presentation Attributes Most notably: clip-path, clip-rule, color, display, fill, fill-opacity, fill-rule, filter, mask, opacity, shape-rendering, stroke, stroke-dasharray, stroke-dashoffset, stroke-linecap, stroke-linejoin, stroke-miterlimit, stroke-opacity, stroke-width, transform, vector-effect, visibility Usage notes CategoriesNonePermitted contentAny number of the following elements, in any order:Animation elementsDescriptive elementsShape elements<text>, <use> Specifications Specification Status Comment CSS Masking Module Level 1The definition of '<clipPath>...
<font-face> - SVG: Scalable Vector Graphics
Web › SVG › Element › font-face
any order. Attributes Global attributes Core attributes Specific attributes font-family font-style font-variant font-weight font-stretch font-size unicode-range units-per-em panose-1 stemv stemh slope cap-height x-height accent-height ascent descent widths bbox ideographic alphabetic mathematical hanging v-ideographic v-alphabetic v-mathematical v-hanging underline-position underline-thickness strikethrough-position strikethrough-thickness overline-position overline-thickness DOM Interface This element implements the SVGFontFaceElement interface. Specifications Specification Status Comment Scalable Vector Graphics (SVG) 1.1 (Second Edition)The definition of '<font-face>' in that specification. Recommendation Initi...
<image> - SVG: Scalable Vector Graphics
Web › SVG › Element › image
esources aren't loaded, :visited styles aren't applied, and they cannot be interactive. To include dynamic SVG elements, try <use> with an external URL. To include SVG files and run scripts inside them, try <object> inside of <foreignObject>. Note: The HTML spec defines <image> as a synonym for <img> while parsing HTML. This specific element and its behavior only apply inside SVG documents or inline SVG. Usage context CategoriesGraphics element, Graphics referencing elementPermitted contentAny number of the following elements, in any order:Animation elementsDescriptive elements Attributes Global attributes Conditional processing attributes Core attributes Graphical event attributes Presentation attributes Xlink attributes class style externalResourcesRequired transform Spec...
<mask> - SVG: Scalable Vector Graphics
Web › SVG › Element › mask
120%; Animatable: yes Global attributes Core Attributes Most notably: id Styling Attributes class, style Conditional Processing Attributes Most notably: requiredExtensions, systemLanguage Presentation Attributes Most notably: clip-path, clip-rule, color, display, fill, fill-opacity, fill-rule, filter, mask, opacity, shape-rendering, stroke, stroke-dasharray, stroke-dashoffset, stroke-linecap, stroke-linejoin, stroke-miterlimit, stroke-opacity, stroke-width, transform, vector-effect, visibility Usage notes CategoriesContainer elementPermitted contentAny number of the following elements, in any order:Animation elementsDescriptive elementsShape elementsStructural elementsGradient elements<a>, <altGlyphDef>, <clipPath>, <color-profile>, <cursor>, <filter>, <font>, <font-face>, <for...
<mpath> - SVG: Scalable Vector Graphics
Web › SVG › Element › mpath
cesRequired Specific attributes xlink:href DOM Interface This element implements the SVGMPathElement interface. Example SVG <svg width="100%" height="100%" viewBox="0 0 500 300" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" > <rect x="1" y="1" width="498" height="298" fill="none" stroke="blue" stroke-width="2" /> <!-- Draw the outline of the motion path in blue, along with three small circles at the start, middle and end. --> <path id="path1" d="M100,250 C 100,50 400,50 400,250" fill="none" stroke="blue" stroke-width="7.06" /> <circle cx="100" cy="250" r="17.64" fill="blue" /> <circle cx="250" cy="100" r="17.64" fill="blue" /> <circle cx="400" cy="250" r="17.64" fill="blue" /> <!-- Here is a tr...
<pattern> - SVG: Scalable Vector Graphics
Web › SVG › Element › pattern
bly: id, tabindex Styling Attributes class, style Conditional Processing Attributes Most notably: requiredExtensions, systemLanguage Presentation Attributes Most notably: clip-path, clip-rule, color, color-interpolation, color-rendering, cursor, display, 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, transform, vector-effect, visibility XLink Attributes Most notably: xlink:title Usage notes CategoriesContainer elementPermitted contentAny number of the following elements, in any order:Animation elementsDescriptive elementsShape elementsStructural elementsGradient elements<a>, <altGlyphDef>, <clipPath>, <color-profile>, ...
<stop> - SVG: Scalable Vector Graphics
Web › SVG › Element › stop
The SVG <stop> element defines a color and its position to use on a gradient. This element is always a child of a <linearGradient> or <radialGradient> element. html,body,svg { height:100% } <svg viewBox="0 0 10 10" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> <defs> <linearGradient id="myGradient" gradientTransform="rotate(90)"> <stop offset="5%" stop-color="gold" /> <stop offset="95%" stop-color="red" /> </linearGradient> </defs> <!-- using my linear gradient --> <circle cx="5" cy="5" r="4" fill="url('#myGradient')" /> </svg> Attributes offset This attribute defines where the gradient stop is placed along the gradient vector. Value type: <number>|<percentage>; Default value: 0; Animatable: yes stop-color Th...
Example - SVG: Scalable Vector Graphics
ess to the velocity. this.vx += Rand(3)-1; this.vy += Rand(3)-1; // Put an upper limit on velocity. this.capVelocity(); // Apply velocity. var old_x = this.x, old_y = this.y; this.x += this.vx; this.y += this.vy; this.capPosition(); // Draw it. ...
Namespaces crash course - SVG: Scalable Vector Graphics
ixes can also be used for element names. This tells the user agent that that particular element (but not its children this time!) belongs to the namespace assigned to the prefix. Knowing this will save you some confusion if you come across markup like in the following example: <html xmlns="http://www.w3.org/1999/xhtml" xmlns:svg="http://www.w3.org/2000/svg"> <body> <h1>SVG embedded inline in XHTML</h1> <svg:svg width="300px" height="200px"> <svg:circle cx="150" cy="100" r="50" fill="#ff0000"/> </svg:svg> </body> </html> Note that because a namespace prefix is used for the <svg:svg> element and its child <svg:circle>, it wasn't necessary to redeclare the default namespace. In general though it is better to redeclare the default namespace rather than prefix lots of...
SVG animation with SMIL - SVG: Scalable Vector Graphics
e="rotate" from="0 60 60" to="360 100 60" repeatCount="indefinite" /> </rect> </svg> Animation following a path The <animateMotion> element lets you animate an element position and rotation according to a path. The path is defined the same way as in <path>. You can set the attribute to define whether the object rotates following the tangent of the path. Example 1: Linear motion In this example, a blue circle bounces between the left and right edges of a black box, over and over again, indefinitely. The animation here is handled by the <animateMotion> element. In this case, we're establishing a path consisting of a MoveTo command to establish the starting point for the animation, then the Horizontal-line command to move the circle 300 pixels to the right, follo...
SVG as an Image - SVG: Scalable Vector Graphics
introduced support for using SVG in these contexts: CSS list-style-image CSS content SVG <image> element SVG <feImage> element Canvas drawImage function Restrictions For security purposes, Gecko places some restrictions on SVG content when it's being used as an image: JavaScript is disabled. External resources (e.g. images, stylesheets) cannot be loaded, though they can be used if inlined through data: URIs. :visited-link styles aren't rendered. Platform-native widget styling (based on OS theme) is disabled. Note that the above restrictions are specific to image contexts; they don't apply when SVG content is viewed directly, or when it's embedded as a document via the <iframe>, <object>, or <embed> elements. Specifications Specification Status Comment ...
Tools for SVG - SVG: Scalable Vector Graphics
as some features that were originally planned for SVG 1.2. Batik offers a viewer (Squiggle), a rasterizer for PNG output, an SVG pretty printer to format SVG files, and a TrueType-to-SVG-Font converter. Together with Apache FOP Batik can transform SVG to PDF. Other renderers Several projects exist that can create a raster image from an SVG source. ImageMagick is one of the most famous command-line image processing tools. The Gnome library rsvg is used by the Wikipedia to raster their SVG graphics. Usage of headless browsers such as SlimerJS and PhantomJS are also popular for this purpose, as the image produced is closer to what the SVG will look like in the browser. Raphael JS URL: raphaeljs.com This is a JavaScript library, that acts as an abstraction layer between browser implementati...
SVG: Scalable Vector Graphics
Web › SVG
ether with HTML, CSS and JavaScript. Use SVG to enhance a regular HTML page or web application. View All... Community View Mozilla forums... Mailing list Newsgroup RSS feed Tools SVG Test Suite Markup Validator More Tools... Other resources: XML, CSS, DOM, Canvas Examples Google Maps (route overlay) & Docs (spreadsheet charting) SVG bubble menus SVG authoring guidelines An overview of the Mozilla SVG Project Frequently asked questions regarding SVG and Mozilla SVG as an image SVG animation with SMIL SVG art gallery Animation and interactions Like HTML, SVG has a document model (DOM) and events, and is accessible from JavaScript. This allows developers to create rich animations and interactive images. Some real eye-candy SVG at svg-wow.org Firefox ex...
Certificate Transparency - Web security
monitor for certificate misissuances. Newly issued certificates are 'logged' to publicly run, often independent CT logs which maintain an append-only, cryptographically assured record of issued TLS certificates. In this way, certificate authorities (CAs) can be subject to much greater public scrutiny and oversight. Potentially malicious certificates, such as those that violate the CA/B Forum Baseline Requirements, can be detected and revoked much more quickly. Browser vendors and root store maintainers are also empowered to make more informed decisions regarding problematic CAs that they may decide to distrust. Background CT logs are built upon the foundation of the Merkle tree data structure. Nodes are labelled with the cryptographic hashes of their child nodes. Leaf nodes contain hashes o...
Mixed content - Web security
Firefox Web Console displays a mixed content warning message in the Net pane when a page on your website has this issue. 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. As well as finding these warnings in the Web Console, you could use Content Security Policy (CSP) to report issues. You could also use an online crawler like SSL-check or Missing Padlock that will check your website recursively and find links to insecure content. Starting in Firefox 23, mixed active content is blocked by default (and mixed display content can be blocked by setting a preference). To make it easier for web developers to find mixed content errors, all blocked mixed content requests are logged to the Security pane of the Web...
Secure contexts - Web security
}); } Specifications Specification Status Comment Secure Contexts Candidate Recommendation Editor's Draft ...
Tutorials
t some basic experience with using it, its time to dive a bit deeper. This module looks at the cascade and inheritance, all the selector types we have available, units, sizing, styling backgrounds and borders, debugging, and lots more. The aim here is to provide you with a toolkit for writing competent CSS and help you understand all the essential theory, before moving on to more specific disciplines like text styling and CSS layout. Styling text Here we look at text styling fundamentals, including setting font, boldness, and italics, line and letter spacing, and drop shadows and other text features. We round off the module by looking at applying custom fonts to your page, and styling lists and links. Common CSS Questions Common questions and answers for beginners. Intermediate lev...
Using shadow DOM - Web Components
let img = document.createElement('img'); img.src = imgUrl; icon.appendChild(img); Styling the shadow DOM After that we create a <style> element and populate it with some CSS to style it: // Create some CSS to apply to the shadow dom let style = document.createElement('style'); style.textContent = ` .wrapper { position: relative; } .info { font-size: 0.8rem; width: 200px; display: inline-block; border: 1px solid black; padding: 10px; background: white; border-radius: 10px; opacity: 0; transition: 0.6s all; position: absolute; bottom: 20px; left: 10px; z-index: 3; } img { width: 1.2rem; } .icon:hover + .info, .icon:focus + .info { opacity: 1; }`; Attaching the shadow DOM to the shadow root The final step is to attach all the created elements to the sh...
format-number - XPath
elements, EXSLT functions, XPath functions, XPath axes The format-number function evaluates a number and returns a string representing the number in a given format. Syntax format-number(number ,pattern [,decimal-format] ) Arguments number The number to be formatted pattern A string in the format of the JDK 1.1 DecimalFormat class. (The documentation for JDK 1.1 is not available online. Here is the Java SE 6 DecimalFormat.) decimal-format (optional) The name of an xsl:decimal-format element that defines the number format to be used. If omitted, the default decimal-format will be used. Returns A string representing the number in the new format. Notes This function is an XSLT-specific addition to XPath. It is not a part of the core XPath function library. Defined XSL...
XPath
ke for web-apps languages or settings XML documents, for example). In these cases JXON could represent the most practical way and valid alternative to XPath. View All... Tools ChroPath XPath panel that integrates tightly into FireBug, providing an editor and inspector (FireFox Add-On). XMLQuire (formerly known as SketchPath) A Graphical XPath Builder/Debugger(.NET). XPath tester An online XPath Builder/Debugger. Related Topics XSLT, XQuery, XML, DOM, JXON, JSONPath Comparison of CSS Selectors and XPath ...
Transforming XML with XSLT - XSLT: Extensible Stylesheet Language Transformations
All rights reserved. Note: This reprinted article was originally part of the DevEdge site. ...
Compiling a New C/C++ Module to WebAssembly - WebAssembly
Opera (you can also run wasm code in Firefox 47+ by enabling the javascript.options.wasm flag in about:config, or Chrome (51+) and Opera (38+) by going to chrome://flags and enabling the Experimental WebAssembly flag.) Note: If you try to open generated HTML file (hello.html) directly from your local hard drive (e.g. file://your_path/hello.html), you will end up with an error message along the lines of both async and sync fetching of the wasm failed. You need to run your HTML file through an HTTP server (http://) -- see How do you set up a local testing server? for more information. If everything has worked as planned, you should see "Hello world" output in the Emscripten console appearing on the web page, and your browser's JavaScript console. Congratulations, you've just compiled C to W...
Exported WebAssembly functions - WebAssembly
results. They are real functions In the previous example, the return value of each Table.prototype.get() call is an exported WebAssembly function -- exactly what we have been talking about. It is worth noting that these are real JavaScript functions, in addition to being wrappers for WebAssembly functions. If you load the above example in a WebAssembly-supporting browser, and run the following lines in your console: var testFunc = otherTable.get(0); typeof testFunc; you'll get the result function returned. You can then go on to do pretty much anything to this function that you can do to other functions in JavaScript -- call(), bind(), etc. testFunc.toString() returns an interesting result: function 0() { [native code] } This gives you more of an idea of its wrapper-type nature. Som...